langchain.js
    Preparing search index...

    A specialized translator designed to work with Supabase, extending the BaseTranslator class. It translates structured queries into a format that can be understood by the Supabase database.

    const selfQueryRetriever = new SelfQueryRetriever({
    llm: new ChatOpenAI({ model: "gpt-4o-mini" }),
    vectorStore: new SupabaseVectorStore(),
    documentContents: "Brief summary of a movie",
    attributeInfo: [],
    structuredQueryTranslator: new SupabaseTranslator(),
    });

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

    Type Parameters

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    allowedComparators: Comparator[] = ...
    allowedOperators: Operator[] = ...
    VisitComparisonOutput: SupabaseFilterRPCCall
    VisitOperationOutput: SupabaseFilterRPCCall

    Methods

    • Builds a column name based on the attribute and value provided. The column name is used in filtering data in a Supabase database.

      Parameters

      • attr: string

        The attribute to be used in the column name.

      • value: string | number

        The value to be used in the column name.

      • includeType: boolean = true

        Whether to include the data type in the column name.

      Returns string

      The built column name.

    • Returns string

    • Returns a function that applies the appropriate comparator operation on the attribute and value provided. The function returned is used to filter data in a Supabase database.

      Type Parameters

      • C extends Comparator

      Parameters

      • comparator: Comparator

        The comparator to be used in the operation.

      Returns (attr: string, value: ValueType[C]) => SupabaseFilterRPCCall

      A function that applies the comparator operation on the attribute and value provided.

    • Visits a comparison and returns a function that applies the comparison on a Supabase database. This is used in translating a structured query into a format that can be understood by Supabase.

      Parameters

      • comparison: Comparison

        The comparison to be visited.

      Returns SupabaseFilterRPCCall

      A function that applies the comparison on a Supabase database.

    • Visits a comparison and returns a string representation of it. This is used in translating a structured query into a format that can be understood by Supabase.

      Parameters

      • comparison: Comparison

        The comparison to be visited.

      Returns string

      A string representation of the comparison.

    • Visits an operation and returns a function that applies the operation on a Supabase database. This is used in translating a structured query into a format that can be understood by Supabase.

      Parameters

      • operation: Operation

        The operation to be visited.

      Returns SupabaseFilterRPCCall

      A function that applies the operation on a Supabase database.

    • Visits an operation and returns a string representation of it. This is used in translating a structured query into a format that can be understood by Supabase.

      Parameters

      • operation: Operation

        The operation to be visited.

      Returns string

      A string representation of the operation.

    • Visits a structured query and returns a function that applies the query on a Supabase database. This is used in translating a structured query into a format that can be understood by Supabase.

      Parameters

      • query: StructuredQuery

        The structured query to be visited.

      Returns unknown

      A function that applies the query on a Supabase database.