UNPKG

2.17 kBTypeScriptView Raw
1/**
2 * Specifies how multiple vector searches are combined.
3 *
4 * @category Full Text Search
5 */
6export declare enum VectorQueryCombination {
7 /**
8 * Indicates that multiple vector queries should be combined with logical AND.
9 */
10 AND = "and",
11 /**
12 * Indicates that multiple vector queries should be combined with logical OR.
13 */
14 OR = "or"
15}
16/**
17 * @category Full Text Search
18 */
19export interface VectorSearchOptions {
20 /**
21 * Specifies how multiple vector queries should be combined.
22 */
23 vectorQueryCombination?: VectorQueryCombination;
24}
25/**
26 * Represents a vector query.
27 *
28 * @category Full Text Search
29 */
30export declare class VectorQuery {
31 private _fieldName;
32 private _vector;
33 private _vectorBase64;
34 private _numCandidates;
35 private _boost;
36 constructor(fieldName: string, vector: number[] | string);
37 /**
38 * @internal
39 */
40 toJSON(): any;
41 /**
42 * Adds boost option to vector query.
43 *
44 * @param boost A floating point value.
45 */
46 boost(boost: number): VectorQuery;
47 /**
48 * Adds numCandidates option to vector query. Value must be >= 1.
49 *
50 * @param numCandidates An integer value.
51 */
52 numCandidates(numCandidates: number): VectorQuery;
53 /**
54 * Creates a vector query.
55 *
56 * @param fieldName The name of the field in the JSON document that holds the vector.
57 * @param vector List of floating point values that represent the vector.
58 */
59 static create(fieldName: string, vector: number[] | string): VectorQuery;
60}
61/**
62 * Represents a vector search.
63 *
64 * @category Full Text Search
65 */
66export declare class VectorSearch {
67 private _queries;
68 private _options;
69 constructor(queries: VectorQuery[], options?: VectorSearchOptions);
70 /**
71 * @internal
72 */
73 get queries(): VectorQuery[];
74 /**
75 * @internal
76 */
77 get options(): VectorSearchOptions | undefined;
78 /**
79 * Creates a vector search from a single VectorQuery.
80 *
81 * @param query A vectory query that should be a part of the vector search.
82 */
83 static fromVectorQuery(query: VectorQuery): VectorSearch;
84}