langchain.retrievers.self_query.redis.RedisTranslator¶

class langchain.retrievers.self_query.redis.RedisTranslator(schema: RedisModel)[source]¶

Visitor for translating structured queries to Redis filter expressions.

Attributes

allowed_comparators

Subset of allowed logical comparators.

allowed_operators

Subset of allowed logical operators.

Methods

__init__(schema)

from_vectorstore(vectorstore)

visit_comparison(comparison)

Translate a Comparison.

visit_operation(operation)

Translate an Operation.

visit_structured_query(structured_query)

Translate a StructuredQuery.

Parameters

schema (RedisModel) –

__init__(schema: RedisModel) None[source]¶
Parameters

schema (RedisModel) –

Return type

None

classmethod from_vectorstore(vectorstore: Redis) RedisTranslator[source]¶
Parameters

vectorstore (Redis) –

Return type

RedisTranslator

visit_comparison(comparison: Comparison) RedisFilterExpression[source]¶

Translate a Comparison.

Parameters

comparison (Comparison) –

Return type

RedisFilterExpression

visit_operation(operation: Operation) Any[source]¶

Translate an Operation.

Parameters

operation (Operation) –

Return type

Any

visit_structured_query(structured_query: StructuredQuery) Tuple[str, dict][source]¶

Translate a StructuredQuery.

Parameters

structured_query (StructuredQuery) –

Return type

Tuple[str, dict]