Abstract class that provides a blueprint for creating specific translator classes. Defines two abstract methods: formatFunction and mergeFilters.

Type Parameters

Hierarchy

Constructors

Properties

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

Type declaration

  • Optional filter?: T["FilterType"]
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.

  • Merges two filters into one, using a specified merge type.

    Parameters

    • defaultFilter: undefined | VectaraFilter

      The default filter.

    • generatedFilter: undefined | VectaraFilter

      The generated filter.

    • mergeType: string = "and"

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

    • forceDefaultFilter: boolean = false

      If true, the default filter will be used even if the generated filter is not empty.

    Returns undefined | VectaraFilter

    The merged filter, or undefined if both filters are empty.

  • Visits a comparison and returns a VectaraComparisonResult. The comparison's value is checked for type and the comparator is formatted. Throws an error if the value type is not supported.

    Parameters

    Returns String

    A VectaraComparisonResult.

  • Visits an operation and returns a VectaraOperationResult. The operation's arguments are visited and the operator is formatted.

    Parameters

    • operation: Operation

      The operation to visit.

    Returns String

    A VectaraOperationResult.

  • Visits a structured query and returns a VectaraStructuredQueryResult. If the query has a filter, it is visited.

    Parameters

    Returns {
        filter?: T["FilterType"];
    }

    A VectaraStructuredQueryResult.

    • Optional filter?: T["FilterType"]

Generated using TypeDoc