Specialized translator for the Chroma vector database. It extends the BasicTranslator class and translates internal query language elements to valid filters. The class defines a subset of allowed logical operators and comparators that can be used in the translation process.

const chromaTranslator = new ChromaTranslator();
const selfQueryRetriever = new SelfQueryRetriever({
llm: new ChatOpenAI(),
vectorStore: new Chroma(),
documentContents: "Brief summary of a movie",
attributeInfo: [],
structuredQueryTranslator: chromaTranslator,
});

const relevantDocuments = await selfQueryRetriever.getRelevantDocuments(
"Which movies are directed by Greta Gerwig?",
);

Type Parameters

  • T extends VectorStore

Hierarchy (view full)

Constructors

Properties

VisitComparisonOutput: VisitorComparisonResult
VisitOperationOutput: VisitorOperationResult
VisitStructuredQueryOutput: VisitorStructuredQueryResult
allowedComparators: Comparator[]
allowedOperators: Operator[]

Methods

  • Formats a given function (either an operator or a comparator) into a string.

    Parameters

    Returns string

    Formatted string representation of the function.