A class that translates or converts data into a format that can be used with Weaviate, a vector search engine. It extends the BaseTranslator class and provides specific implementation for Weaviate.

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

const relevantDocuments = await selfQueryRetriever.getRelevantDocuments(
"Which movies are rated higher than 8.5?",
);

Type Parameters

  • T extends VectorStore

Hierarchy (view full)

Constructors

Properties

VisitComparisonOutput: WeaviateComparisonResult
VisitOperationOutput: WeaviateOperationResult
VisitStructuredQueryOutput: {
    filter?: T["FilterType"];
}
allowedComparators: Comparator[] = ...
allowedOperators: Operator[] = ...

Methods

  • Merges two filters into one. If both filters are empty, returns undefined. If one filter is empty or the merge type is 'replace', returns the other filter. If the merge type is 'and' or 'or', returns a new filter with the merged results. Throws an error for unknown merge types.

    Parameters

    • defaultFilter: any

      The default filter to merge.

    • generatedFilter: any

      The generated filter to merge.

    • mergeType: string = "and"

      The type of merge to perform. Can be 'and', 'or', or 'replace'. Defaults to 'and'.

    Returns any

    A merged WeaviateFilter, or undefined if both filters are empty.