pipecat.filter module¶
Functions to filter records as they pass through a Pipecat pipe.
-
pipecat.filter.
duplicates
(source, key)¶ Discard records unless the given key value changes.
Parameters: - source (Record generator, required)
- key (string or tuple-of-strings, required) – Records will be discarded unless this key value changes.
-
pipecat.filter.
keep
(source, key=None, value=None)¶ Discard all records that don’t match the given criteria
Examples
Discard any record that doesn’t have an ‘id’ key with value “GPGGA”:
>>> pipe = # Defined elsewhere >>> pipe = pipecat.filter.keep(pipe, key="id", value="GPGGA") >>> for record in pipe: ... print record
Parameters: - source (Record generator, required)
- key (string or tuple-of-strings, optional) – Records must contain this key or they will be discarded.
- value (optional.) – Records with field ‘key’ must match this value or they will be discarded.