RetrievalFilterDict¶
Union Type¶
RetrievalFilterDict
module-attribute
¶
RetrievalFilterDict = Union[RetrievalFilterEqualsDict | RetrievalFilterNotEqualsDict | RetrievalFilterGreaterThanDict | RetrievalFilterGreaterThanOrEqualsDict | RetrievalFilterLessThanDict | RetrievalFilterLessThanOrEqualsDict | RetrievalFilterInDict | RetrievalFilterNotInDict | RetrievalFilterStartsWithDict | RetrievalFilterListContainsDict | RetrievalFilterStringContainsDict | RetrievalFilterAndAllDict | RetrievalFilterOrAllDict]
Dictionary form of RetrievalFilter, setting exactly one variant.
Union Member Types¶
RetrievalFilterEqualsDict
¶
Bases: TypedDict
Attributes¶
equals
instance-attribute
¶
equals: FilterAttribute | FilterAttributeDict
Knowledge base data sources are returned if they contain a metadata attribute whose name matches the key and whose value matches the value in this object.
The following example would return data sources with an animal attribute
whose value is 'cat': "equals": { "key": "animal", "value": "cat" }
RetrievalFilterNotEqualsDict
¶
Bases: TypedDict
Attributes¶
not_equals
instance-attribute
¶
not_equals: FilterAttribute | FilterAttributeDict
Knowledge base data sources that contain a metadata attribute whose name matches the key and whose value doesn't match the value in this object are returned.
The following example would return data sources that don't contain an
animal attribute whose value is 'cat':
"notEquals": { "key": "animal", "value": "cat" }
RetrievalFilterGreaterThanDict
¶
Bases: TypedDict
Attributes¶
greater_than
instance-attribute
¶
greater_than: FilterAttribute | FilterAttributeDict
Knowledge base data sources are returned if they contain a metadata attribute whose name matches the key and whose value is greater than the value in this object.
The following example would return data sources with an year attribute
whose value is greater than '1989':
"greaterThan": { "key": "year", "value": 1989 }
RetrievalFilterGreaterThanOrEqualsDict
¶
Bases: TypedDict
Attributes¶
greater_than_or_equals
instance-attribute
¶
greater_than_or_equals: FilterAttribute | FilterAttributeDict
Knowledge base data sources are returned if they contain a metadata attribute whose name matches the key and whose value is greater than or equal to the value in this object.
The following example would return data sources with an year attribute
whose value is greater than or equal to '1989':
"greaterThanOrEquals": { "key": "year", "value": 1989 }
RetrievalFilterLessThanDict
¶
Bases: TypedDict
Attributes¶
less_than
instance-attribute
¶
less_than: FilterAttribute | FilterAttributeDict
Knowledge base data sources are returned if they contain a metadata attribute whose name matches the key and whose value is less than the value in this object.
The following example would return data sources with an year attribute
whose value is less than to '1989':
"lessThan": { "key": "year", "value": 1989 }
RetrievalFilterLessThanOrEqualsDict
¶
Bases: TypedDict
Attributes¶
less_than_or_equals
instance-attribute
¶
less_than_or_equals: FilterAttribute | FilterAttributeDict
Knowledge base data sources are returned if they contain a metadata attribute whose name matches the key and whose value is less than or equal to the value in this object.
The following example would return data sources with an year attribute
whose value is less than or equal to '1989':
"lessThanOrEquals": { "key": "year", "value": 1989 }
RetrievalFilterInDict
¶
Bases: TypedDict
Attributes¶
in_
instance-attribute
¶
Knowledge base data sources are returned if they contain a metadata attribute whose name matches the key and whose value is in the list specified in the value in this object.
The following example would return data sources with an animal attribute
that is either 'cat' or 'dog':
"in": { "key": "animal", "value": ["cat", "dog"] }
RetrievalFilterNotInDict
¶
Bases: TypedDict
Attributes¶
not_in
instance-attribute
¶
not_in: FilterAttribute | FilterAttributeDict
Knowledge base data sources are returned if they contain a metadata attribute whose name matches the key and whose value isn't in the list specified in the value in this object.
The following example would return data sources whose animal attribute
is neither 'cat' nor 'dog':
"notIn": { "key": "animal", "value": ["cat", "dog"] }
RetrievalFilterStartsWithDict
¶
Bases: TypedDict
Attributes¶
starts_with
instance-attribute
¶
starts_with: FilterAttribute | FilterAttributeDict
Knowledge base data sources are returned if they contain a metadata attribute whose name matches the key and whose value starts with the value in this object. This filter is currently only supported for Amazon OpenSearch Serverless vector stores.
The following example would return data sources with an animal attribute
starts with 'ca' (for example, 'cat' or 'camel').
"startsWith": { "key": "animal", "value": "ca" }
RetrievalFilterListContainsDict
¶
Bases: TypedDict
Attributes¶
list_contains
instance-attribute
¶
list_contains: FilterAttribute | FilterAttributeDict
Knowledge base data sources are returned if they contain a metadata attribute whose name matches the key and whose value is a list that contains the value as one of its members.
The following example would return data sources with an animals
attribute that is a list containing a cat member (for example,
["dog", "cat"]):
"listContains": { "key": "animals", "value": "cat" }
RetrievalFilterStringContainsDict
¶
Bases: TypedDict
Attributes¶
string_contains
instance-attribute
¶
string_contains: FilterAttribute | FilterAttributeDict
Knowledge base data sources are returned if they contain a metadata attribute whose name matches the key and whose value is one of the following:
A string that contains the value as a substring. The following example
would return data sources with an animal attribute that contains the
substring at (for example, 'cat'):
"stringContains": { "key": "animal", "value": "at" }
A list with a member that contains the value as a substring. The
following example would return data sources with an animals attribute
that is a list containing a member that contains the substring at (for
example, ["dog", "cat"]):
"stringContains": { "key": "animals", "value": "at" }
RetrievalFilterAndAllDict
¶
Bases: TypedDict
Attributes¶
and_all
instance-attribute
¶
and_all: Sequence[RetrievalFilter | RetrievalFilterDict]
Knowledge base data sources are returned if their metadata attributes fulfill all the filter conditions inside this list.
RetrievalFilterOrAllDict
¶
Bases: TypedDict
Attributes¶
or_all
instance-attribute
¶
or_all: Sequence[RetrievalFilter | RetrievalFilterDict]
Knowledge base data sources are returned if their metadata attributes fulfill at least one of the filter conditions inside this list.