import { ... } from "@langchain/core/structured_query";Casts a value that might be string or number to actual string or number. Since LLM might return back an integer/float as a string, we need to cast it back to a number, as many vector databases can't handle number as string values as a comparator.
Checks if the provided value is a boolean.
Checks if a provided filter is empty. The filter can be a function, an object, a string, or undefined.
Checks if the provided value is a floating-point number.
Checks if the provided value is an integer.
Checks if the provided argument is an object and not an array.
Checks if the provided value is a string that cannot be parsed into a number.
Abstract class that provides a blueprint for creating specific translator classes. Defines two abstract methods: formatFunction and mergeFilters.
Class that extends the BaseTranslator class and provides concrete implementations for the abstract methods. Also declares three types: VisitOperationOutput, VisitComparisonOutput, and VisitStructuredQueryOutput, which are used as the return types for the visitOperation, visitComparison, and visitStructuredQuery methods respectively.
Class representing a comparison filter directive. It extends the FilterDirective class.
Abstract class representing an expression. Subclasses must implement the exprName property and the accept method.
Abstract class representing a filter directive. It extends the Expression class.
A class that extends BaseTranslator to translate structured queries
into functional filters.
Class representing an operation filter directive. It extends the FilterDirective class.
Class representing a structured query expression. It extends the Expression class.
Abstract class for visiting expressions. Subclasses must implement visitOperation, visitComparison, and visitStructuredQuery methods.
Represents logical AND operator.
Represents a comparison operator which can be EQ, NE, LT, GT, LTE, or GTE.
Represents equality comparison operator.
A type alias for a function that takes a Document as an argument and
returns a boolean. This function is used as a filter for documents.
Represents greater than comparison operator.
Represents greater than or equal to comparison operator.
Represents less than comparison operator.
Represents less than or equal to comparison operator.
Represents inequality comparison operator.
Represents logical NOT operator.
Represents a logical operator which can be AND, OR, or NOT.
Represents logical OR operator.
Options object for the BasicTranslator class. Specifies the allowed operators and comparators.
Represents the result of visiting a comparison expression.
Represents the result of visiting an operation expression.
Represents the result of visiting an operation or comparison expression.
Represents the result of visiting a structured query expression.