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.

Example

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

Hierarchy

Constructors

Properties

VisitComparisonOutput: WeaviateComparisonResult
VisitOperationOutput: WeaviateOperationResult
VisitStructuredQueryOutput: {
    filter?: T["FilterType"];
}

Type declaration

  • Optional 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: undefined | WeaviateFilter

      The default filter to merge.

    • generatedFilter: undefined | WeaviateFilter

      The generated filter to merge.

    • mergeType: string = "and"

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

    Returns undefined | WeaviateFilter

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

Generated using TypeDoc