import { type SQL, type AnyColumn } from "drizzle-orm"; export { vectorTiDBType } from "../customTypes"; /** * Input accepted by TiDB vector SQL helpers. * * - `number[]`: converted to `VEC_FROM_TEXT('[...]')` * - `string`: treated as raw SQL vector expression, for example: * `CAST('[0.3, 0.5, -0.1]' AS VECTOR)` * - `SQL` / `AnyColumn`: passed through as-is */ type VectorInput = string | number[] | SQL | AnyColumn; /** * Converts a text representation of a vector into a TiDB VECTOR expression. * * TiDB function: `VEC_FROM_TEXT(string)`. * * @example * vecFromText("[1, 2, 3]") */ export declare function vecFromText(text: string): SQL; /** * Converts a vector value/expression to its normalized string representation. * * TiDB function: `VEC_AS_TEXT(vector)`. * * @example * vecAsText(table.embedding) */ export declare function vecAsText(vector: VectorInput): SQL; /** * Returns the dimension (number of elements) of a vector. * * TiDB function: `VEC_DIMS(vector)`. * * Accepts vector column/expression, `sql.raw(...)`, raw SQL string expression, * or `number[]`. * * @example * vecDims(table.embedding) * vecDims(sql.raw("CAST('[0.3, 0.5, -0.1]' AS VECTOR)")) * vecDims("CAST('[0.3, 0.5, -0.1]' AS VECTOR)") */ export declare function vecDims(vector: VectorInput): SQL; /** * Calculates L2 norm (Euclidean norm) of a vector. * * TiDB function: `VEC_L2_NORM(vector)`. */ export declare function vecL2Norm(vector: VectorInput): SQL; /** * Calculates L2 distance (Euclidean distance) between two vectors. * * TiDB function: `VEC_L2_DISTANCE(vector1, vector2)`. * * Both vectors must have the same dimensions. */ export declare function vecL2Distance(left: VectorInput, right: VectorInput): SQL; /** * Calculates cosine distance between two vectors. * * TiDB function: `VEC_COSINE_DISTANCE(vector1, vector2)`. * * Both vectors must have the same dimensions. */ export declare function vecCosineDistance(left: VectorInput, right: VectorInput): SQL; /** * Calculates negative inner product distance between two vectors. * * TiDB function: `VEC_NEGATIVE_INNER_PRODUCT(vector1, vector2)`. * * Both vectors must have the same dimensions. */ export declare function vecNegativeInnerProduct(left: VectorInput, right: VectorInput): SQL; /** * Calculates L1 distance (Manhattan distance) between two vectors. * * TiDB function: `VEC_L1_DISTANCE(vector1, vector2)`. * * Both vectors must have the same dimensions. */ export declare function vecL1Distance(left: VectorInput, right: VectorInput): SQL; //# sourceMappingURL=VectorTiDB.d.ts.map