@convex-dev/agent
Version:
A agent component for Convex.
58 lines • 4.38 kB
TypeScript
import { type GenericTableSearchIndexes, type SchemaDefinition, type TableDefinition } from "convex/server";
import { type GenericId, type Infer, type ObjectType, type VId, type VObject, type VUnion } from "convex/values";
import type { QueryCtx } from "../_generated/server.js";
declare const embeddings: {
model: import("convex/values").VString<string, "required">;
table: import("convex/values").VString<string, "required">;
userId: import("convex/values").VString<string | undefined, "optional">;
threadId: import("convex/values").VString<string | undefined, "optional">;
model_table_userId: import("convex/values").VArray<string[] | undefined, import("convex/values").VString<string, "required">, "optional">;
model_table_threadId: import("convex/values").VArray<string[] | undefined, import("convex/values").VString<string, "required">, "optional">;
vector: import("convex/values").VArray<number[], import("convex/values").VFloat64<number, "required">, "required">;
};
export declare const vEmbeddingsWithoutDenormalizedFields: VObject<{
userId?: string | undefined;
threadId?: string | undefined;
model: string;
table: string;
vector: number[];
}, {
model: import("convex/values").VString<string, "required">;
table: import("convex/values").VString<string, "required">;
userId: import("convex/values").VString<string | undefined, "optional">;
threadId: import("convex/values").VString<string | undefined, "optional">;
vector: import("convex/values").VArray<number[], import("convex/values").VFloat64<number, "required">, "required">;
}, "required", "userId" | "threadId" | "model" | "table" | "vector">;
export type EmbeddingsWithoutDenormalizedFields = Infer<typeof vEmbeddingsWithoutDenormalizedFields>;
type VectorTable<D extends number> = TableDefinition<VObject<ObjectType<typeof embeddings>, typeof embeddings>, {
model_table_threadId: ["model", "table", "threadId", "_creationTime"];
}, GenericTableSearchIndexes, VectorIndex<D>>;
type VectorIndex<D extends number> = {
vector: {
vectorField: "vector";
dimensions: D;
filterFields: "model_table_userId" | "model_table_threadId";
};
};
export type VectorSchema = SchemaDefinition<{
[key in VectorTableName]: VectorTable<128>;
}, true>;
export declare const VectorDimensions: readonly [128, 256, 512, 768, 1024, 1408, 1536, 2048, 3072, 4096];
export declare function validateVectorDimension(dimension: number): asserts dimension is VectorDimension;
export type VectorDimension = (typeof VectorDimensions)[number];
export declare const VectorTableNames: `embeddings_${(typeof VectorDimensions)[number]}`[];
export type VectorTableName = (typeof VectorTableNames)[number];
export type VectorTableId = GenericId<(typeof VectorTableNames)[number]>;
export declare const vVectorDimension: VUnion<128 | 256 | 512 | 768 | 1024 | 1408 | 1536 | 2048 | 3072 | 4096, import("convex/values").VLiteral<128 | 256 | 512 | 768 | 1024 | 1408 | 1536 | 2048 | 3072 | 4096, "required">[], "required", never>;
export declare const vVectorTableName: VUnion<"embeddings_128" | "embeddings_256" | "embeddings_512" | "embeddings_768" | "embeddings_1024" | "embeddings_1408" | "embeddings_1536" | "embeddings_2048" | "embeddings_3072" | "embeddings_4096", import("convex/values").VLiteral<"embeddings_128" | "embeddings_256" | "embeddings_512" | "embeddings_768" | "embeddings_1024" | "embeddings_1408" | "embeddings_1536" | "embeddings_2048" | "embeddings_3072" | "embeddings_4096", "required">[], "required", never>;
export declare const vVectorId: VUnion<GenericId<(typeof VectorTableNames)[number]>, VId<(typeof VectorTableNames)[number]>[]>;
export declare function getVectorTableName(dimension: VectorDimension): VectorTableName;
export declare function getVectorIdInfo(ctx: QueryCtx, id: VectorTableId): {
tableName: "embeddings_128" | "embeddings_256" | "embeddings_512" | "embeddings_768" | "embeddings_1024" | "embeddings_1408" | "embeddings_1536" | "embeddings_2048" | "embeddings_3072" | "embeddings_4096";
dimension: 128 | 256 | 512 | 768 | 1024 | 1408 | 1536 | 2048 | 3072 | 4096;
};
declare const tables: {
[K in keyof typeof VectorDimensions & number as `embeddings_${(typeof VectorDimensions)[K]}`]: VectorTable<(typeof VectorDimensions)[K]>;
};
export default tables;
//# sourceMappingURL=tables.d.ts.map