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.

Example

const selfQueryRetriever = new SelfQueryRetriever({
llm: new ChatOpenAI(),
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

  • BaseTranslator<T>
    • SupabaseTranslator

Constructors

Properties

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

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.

  • 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 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 {}

    A function that applies the query on a Supabase database.

    Generated using TypeDoc