import { Id, Value } from "../values/value.js"; import { DocumentByInfo, FieldTypeFromFieldPath, GenericDataModel, GenericDocument, GenericTableInfo, GenericVectorIndexConfig, NamedTableInfo, NamedVectorIndex, TableNamesInDataModel, VectorIndexNames } from "./data_model.js"; /** * An object with parameters for performing a vector search against a vector index. * @public */ export interface VectorSearchQuery> { /** * The query vector. * * This must have the same length as the `dimensions` of the index. * This vector search will return the IDs of the documents most similar to * this vector. */ vector: number[]; /** * The number of results to return. If specified, must be between 1 and 256 * inclusive. * * @default 10 */ limit?: number; /** * Optional filter expression made up of `q.or` and `q.eq` operating * over the filter fields of the index. * * e.g. `filter: q => q.or(q.eq("genre", "comedy"), q.eq("genre", "drama"))` * * @param q * @returns */ filter?: (q: VectorFilterBuilder, NamedVectorIndex>) => FilterExpression; } export type VectorSearch, IndexName extends VectorIndexNames>> = (tableName: TableName, indexName: IndexName, query: VectorSearchQuery, IndexName>) => Promise; _score: number; }>>; /** * Expressions are evaluated to produce a {@link values.Value} in the course of executing a query. * * To construct an expression, use the {@link VectorFilterBuilder} provided within * {@link VectorSearchQuery}. * * @typeParam T - The type that this expression evaluates to. * @public */ export declare abstract class FilterExpression { private _isExpression; private _value; } /** * An interface for defining filters for vector searches. * * This has a similar interface to {@link FilterBuilder}, which is used in * database queries, but supports only the methods that can be efficiently * done in a vector search. * * @public */ export interface VectorFilterBuilder { /** * Is the field at `fieldName` equal to `value` * * @public * */ eq(fieldName: FieldName, value: FieldTypeFromFieldPath): FilterExpression; /** * `exprs[0] || exprs[1] || ... || exprs[n]` * * @public */ or(...exprs: Array>): FilterExpression; } //# sourceMappingURL=vector_search.d.ts.map