@anvia/core 1.0.0-rc.1 → 1.0.0-rc.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +344 -85
- package/dist/agent/index.d.ts +33 -18
- package/dist/agent/index.js +42 -17
- package/dist/agent-CXScUOpX.d.ts +150 -0
- package/dist/{chunk-R2LJSQUW.js → chunk-3CMWKK32.js} +260 -104
- package/dist/chunk-3CMWKK32.js.map +1 -0
- package/dist/chunk-3RM57ZT2.js +31 -0
- package/dist/chunk-3RM57ZT2.js.map +1 -0
- package/dist/chunk-5MK3BISB.js +704 -0
- package/dist/chunk-5MK3BISB.js.map +1 -0
- package/dist/chunk-AI5JMUW7.js +45 -0
- package/dist/chunk-AI5JMUW7.js.map +1 -0
- package/dist/{chunk-FNQB2JEH.js → chunk-AZB6N7P4.js} +94 -65
- package/dist/chunk-AZB6N7P4.js.map +1 -0
- package/dist/chunk-BEYBU7VJ.js +53 -0
- package/dist/chunk-BEYBU7VJ.js.map +1 -0
- package/dist/chunk-BY4OMNIU.js +4699 -0
- package/dist/chunk-BY4OMNIU.js.map +1 -0
- package/dist/chunk-D2ECOWN5.js +515 -0
- package/dist/chunk-D2ECOWN5.js.map +1 -0
- package/dist/{chunk-A3UBYTJT.js → chunk-FN7HLLAZ.js} +60 -6
- package/dist/chunk-FN7HLLAZ.js.map +1 -0
- package/dist/chunk-GKDERULJ.js +50 -0
- package/dist/chunk-GKDERULJ.js.map +1 -0
- package/dist/chunk-GQL5KRAH.js +331 -0
- package/dist/chunk-GQL5KRAH.js.map +1 -0
- package/dist/{chunk-5XKDW36Z.js → chunk-KFR4CDGK.js} +70 -75
- package/dist/chunk-KFR4CDGK.js.map +1 -0
- package/dist/chunk-KV6QCRQ4.js +171 -0
- package/dist/chunk-KV6QCRQ4.js.map +1 -0
- package/dist/{chunk-DMPUP4R3.js → chunk-LXMAFD23.js} +5 -5
- package/dist/{chunk-I6G7BC42.js → chunk-MGNTXGTX.js} +2 -6
- package/dist/chunk-MGNTXGTX.js.map +1 -0
- package/dist/chunk-PK5LKOFL.js +239 -0
- package/dist/chunk-PK5LKOFL.js.map +1 -0
- package/dist/chunk-QOUPWOGW.js +29 -0
- package/dist/chunk-QOUPWOGW.js.map +1 -0
- package/dist/chunk-TRQ3XRFD.js +54 -0
- package/dist/chunk-TRQ3XRFD.js.map +1 -0
- package/dist/chunk-VKYZZXP5.js +323 -0
- package/dist/chunk-VKYZZXP5.js.map +1 -0
- package/dist/chunk-ZCPOIDAQ.js +127 -0
- package/dist/chunk-ZCPOIDAQ.js.map +1 -0
- package/dist/client-DvUatElp.d.ts +84 -0
- package/dist/completion/index.d.ts +5 -4
- package/dist/completion/index.js +25 -28
- package/dist/documents/index.d.ts +34 -0
- package/dist/documents/index.js +315 -0
- package/dist/documents/index.js.map +1 -0
- package/dist/{dynamic-tools-i9woysFa.d.ts → dynamic-tools-AEBOTgu1.d.ts} +21 -9
- package/dist/embeddings/index.d.ts +11 -9
- package/dist/embeddings/index.js +3 -3
- package/dist/evals/index.d.ts +53 -25
- package/dist/evals/index.js +153 -103
- package/dist/evals/index.js.map +1 -1
- package/dist/extractor/index.d.ts +23 -26
- package/dist/extractor/index.js +7 -8
- package/dist/guardrails/index.d.ts +7 -129
- package/dist/guardrails/index.js +1 -1
- package/dist/image-generation/index.d.ts +18 -16
- package/dist/image-generation/index.js +2 -2
- package/dist/index.d.ts +26 -23
- package/dist/index.js +71 -48
- package/dist/interactions-csssHYcN.d.ts +174 -0
- package/dist/internal/agent.d.ts +36 -29
- package/dist/internal/agent.js +48 -15
- package/dist/internal/agent.js.map +1 -1
- package/dist/mcp/index.d.ts +19 -13
- package/dist/mcp/index.js +14 -348
- package/dist/mcp/index.js.map +1 -1
- package/dist/memory/index.d.ts +20 -6
- package/dist/memory/index.js +10 -10
- package/dist/message-schema-B2M7AYzR.d.ts +52 -0
- package/dist/model-call-options-CZkSw_xN.d.ts +6 -0
- package/dist/model-listing/index.d.ts +3 -1
- package/dist/observability/index.d.ts +21 -6
- package/dist/observability/index.js +8 -5
- package/dist/observability/index.js.map +1 -1
- package/dist/pipeline/index.d.ts +106 -57
- package/dist/pipeline/index.js +419 -236
- package/dist/pipeline/index.js.map +1 -1
- package/dist/{retry-D3Ruy-ba.d.ts → retry-CjvSlKGW.d.ts} +2 -1
- package/dist/skills/index.d.ts +5 -4
- package/dist/skills/index.js +8 -7
- package/dist/speech-generation/index.d.ts +37 -0
- package/dist/speech-generation/index.js +8 -0
- package/dist/text-C_6eKrbC.d.ts +32 -0
- package/dist/{think-tool-DZqZj2LV.d.ts → think-tool-D8frXxwV.d.ts} +16 -2
- package/dist/tool/index.d.ts +9 -7
- package/dist/tool/index.js +12 -10
- package/dist/{tool-C_8GudXn.d.ts → tool-r62gf3QY.d.ts} +17 -8
- package/dist/transcription/index.d.ts +23 -14
- package/dist/transcription/index.js +2 -2
- package/dist/types-C3gv9EX6.d.ts +130 -0
- package/dist/{index-DxB74ybJ.d.ts → types-CElwurHZ.d.ts} +139 -88
- package/dist/types-CIPaIbZo.d.ts +105 -0
- package/dist/types-Cr4uiYo5.d.ts +99 -0
- package/dist/types-D9rKQ_as.d.ts +341 -0
- package/dist/types-DbolvLtZ.d.ts +155 -0
- package/dist/{types-DhQfwiZn.d.ts → types-RT3cuyRk.d.ts} +1 -1
- package/dist/vector-store/index.d.ts +33 -34
- package/dist/vector-store/index.js +7 -6
- package/package.json +10 -14
- package/dist/agent-DGYY_onS.d.ts +0 -145
- package/dist/audio-generation/index.d.ts +0 -31
- package/dist/audio-generation/index.js +0 -8
- package/dist/chunk-5XKDW36Z.js.map +0 -1
- package/dist/chunk-6WGGTJE6.js +0 -139
- package/dist/chunk-6WGGTJE6.js.map +0 -1
- package/dist/chunk-A3UBYTJT.js.map +0 -1
- package/dist/chunk-ADH7NNCS.js +0 -512
- package/dist/chunk-ADH7NNCS.js.map +0 -1
- package/dist/chunk-DZ3CKYTH.js +0 -267
- package/dist/chunk-DZ3CKYTH.js.map +0 -1
- package/dist/chunk-FNQB2JEH.js.map +0 -1
- package/dist/chunk-I6G7BC42.js.map +0 -1
- package/dist/chunk-IL3ZSNJI.js +0 -3748
- package/dist/chunk-IL3ZSNJI.js.map +0 -1
- package/dist/chunk-J6GNQART.js +0 -122
- package/dist/chunk-J6GNQART.js.map +0 -1
- package/dist/chunk-M3IOWB4Y.js +0 -280
- package/dist/chunk-M3IOWB4Y.js.map +0 -1
- package/dist/chunk-QY5GZ7HR.js +0 -39
- package/dist/chunk-QY5GZ7HR.js.map +0 -1
- package/dist/chunk-R2LJSQUW.js.map +0 -1
- package/dist/chunk-RFDVKCIE.js +0 -12
- package/dist/chunk-RFDVKCIE.js.map +0 -1
- package/dist/chunk-RMUBRRSK.js +0 -34
- package/dist/chunk-RMUBRRSK.js.map +0 -1
- package/dist/chunk-RXKHOYEH.js +0 -466
- package/dist/chunk-RXKHOYEH.js.map +0 -1
- package/dist/chunk-XDRSPSR7.js +0 -38
- package/dist/chunk-XDRSPSR7.js.map +0 -1
- package/dist/chunk-XWUC7CIT.js +0 -1
- package/dist/chunk-XWUC7CIT.js.map +0 -1
- package/dist/errors-CYKUcU89.d.ts +0 -17
- package/dist/json-Zo7K3xmt.d.ts +0 -40
- package/dist/loaders/index.d.ts +0 -86
- package/dist/loaders/index.js +0 -299
- package/dist/loaders/index.js.map +0 -1
- package/dist/middleware-KynLg_RW.d.ts +0 -56
- package/dist/types-B3A4YxaA.d.ts +0 -354
- package/dist/types-BBEGKB9m.d.ts +0 -119
- package/dist/types-DT3nEemY.d.ts +0 -79
- package/dist/types-DulRCYdB.d.ts +0 -70
- package/dist/types-p55Jc-sr.d.ts +0 -47
- package/dist/ui/index.d.ts +0 -107
- package/dist/ui/index.js +0 -10
- package/dist/ui/index.js.map +0 -1
- /package/dist/{chunk-DMPUP4R3.js.map → chunk-LXMAFD23.js.map} +0 -0
- /package/dist/{audio-generation → speech-generation}/index.js.map +0 -0
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { M as ModelCallOptions } from './model-call-options-CZkSw_xN.js';
|
|
2
|
+
import { b as RetrySetting } from './retry-CjvSlKGW.js';
|
|
3
|
+
|
|
4
|
+
type Embedding = {
|
|
5
|
+
document: string;
|
|
6
|
+
vector: number[];
|
|
7
|
+
};
|
|
8
|
+
type SparseVector = {
|
|
9
|
+
indices: number[];
|
|
10
|
+
values: number[];
|
|
11
|
+
};
|
|
12
|
+
type SparseEmbedding = {
|
|
13
|
+
document: string;
|
|
14
|
+
vector: SparseVector;
|
|
15
|
+
};
|
|
16
|
+
interface EmbeddingModel {
|
|
17
|
+
readonly provider: string;
|
|
18
|
+
readonly modelId: string;
|
|
19
|
+
readonly dimensions?: number | undefined;
|
|
20
|
+
readonly maxBatchSize?: number | undefined;
|
|
21
|
+
embedTexts(texts: string[], options?: ModelCallOptions | undefined): Promise<Embedding[]>;
|
|
22
|
+
}
|
|
23
|
+
/** Sparse lexical/neural encoder used for hybrid retrieval channels. */
|
|
24
|
+
interface SparseEmbeddingModel {
|
|
25
|
+
readonly provider: string;
|
|
26
|
+
readonly modelId: string;
|
|
27
|
+
readonly maxBatchSize?: number | undefined;
|
|
28
|
+
/** Embed passage/document texts for indexing. */
|
|
29
|
+
embedTexts(texts: string[], options?: ModelCallOptions | undefined): Promise<SparseEmbedding[]>;
|
|
30
|
+
/** Embed a search query (may differ from passage encoding for models like SPLADE). */
|
|
31
|
+
embedQuery(query: string, options?: ModelCallOptions | undefined): Promise<SparseEmbedding>;
|
|
32
|
+
}
|
|
33
|
+
type EmbeddedDocument<T, Metadata extends VectorMetadata = VectorMetadata> = {
|
|
34
|
+
id: string;
|
|
35
|
+
document: T;
|
|
36
|
+
metadata?: Metadata | undefined;
|
|
37
|
+
embeddings: Embedding[];
|
|
38
|
+
/** Optional sparse vectors aligned 1:1 with `embeddings` by chunk index. */
|
|
39
|
+
sparseEmbeddings?: SparseEmbedding[] | undefined;
|
|
40
|
+
};
|
|
41
|
+
type VectorMetadataValue = string | number | boolean | null;
|
|
42
|
+
type VectorMetadata = Record<string, VectorMetadataValue>;
|
|
43
|
+
type EmbeddingOperationOptions = {
|
|
44
|
+
retries?: RetrySetting | undefined;
|
|
45
|
+
abortSignal?: AbortSignal | undefined;
|
|
46
|
+
};
|
|
47
|
+
type EmbedTextOptions = EmbeddingOperationOptions & {
|
|
48
|
+
model: EmbeddingModel;
|
|
49
|
+
text: string;
|
|
50
|
+
};
|
|
51
|
+
type EmbedTextsOptions = EmbeddingOperationOptions & {
|
|
52
|
+
model: EmbeddingModel;
|
|
53
|
+
texts: string[];
|
|
54
|
+
concurrency?: number | undefined;
|
|
55
|
+
};
|
|
56
|
+
type EmbedSparseTextsOptions = EmbeddingOperationOptions & {
|
|
57
|
+
model: SparseEmbeddingModel;
|
|
58
|
+
texts: string[];
|
|
59
|
+
concurrency?: number | undefined;
|
|
60
|
+
};
|
|
61
|
+
type EmbedSparseQueryOptions = EmbeddingOperationOptions & {
|
|
62
|
+
model: SparseEmbeddingModel;
|
|
63
|
+
query: string;
|
|
64
|
+
};
|
|
65
|
+
type EmbedDocumentsBaseOptions<T, Metadata extends VectorMetadata = VectorMetadata> = EmbeddingOperationOptions & {
|
|
66
|
+
documents: T[];
|
|
67
|
+
id?: ((document: T, index: number) => string) | undefined;
|
|
68
|
+
content(document: T, index: number): string | string[];
|
|
69
|
+
metadata?: ((document: T, index: number) => Metadata | undefined) | undefined;
|
|
70
|
+
concurrency?: number | undefined;
|
|
71
|
+
};
|
|
72
|
+
type EmbedDocumentsOptions<T, Metadata extends VectorMetadata = VectorMetadata> = EmbedDocumentsBaseOptions<T, Metadata> & {
|
|
73
|
+
model: EmbeddingModel;
|
|
74
|
+
models?: never;
|
|
75
|
+
};
|
|
76
|
+
type EmbedHybridDocumentsOptions<T, Metadata extends VectorMetadata = VectorMetadata> = EmbedDocumentsBaseOptions<T, Metadata> & {
|
|
77
|
+
model?: never;
|
|
78
|
+
models: {
|
|
79
|
+
dense: EmbeddingModel;
|
|
80
|
+
sparse: SparseEmbeddingModel;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
type EmbedTextResult = {
|
|
84
|
+
embedding: Embedding;
|
|
85
|
+
};
|
|
86
|
+
type EmbedTextsResult = {
|
|
87
|
+
embeddings: Embedding[];
|
|
88
|
+
};
|
|
89
|
+
type EmbedSparseTextsResult = {
|
|
90
|
+
embeddings: SparseEmbedding[];
|
|
91
|
+
};
|
|
92
|
+
type EmbedSparseQueryResult = {
|
|
93
|
+
embedding: SparseEmbedding;
|
|
94
|
+
};
|
|
95
|
+
type EmbedDocumentsResult<T, Metadata extends VectorMetadata = VectorMetadata> = {
|
|
96
|
+
documents: Array<EmbeddedDocument<T, Metadata>>;
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export type { EmbeddingModel as E, SparseVector as S, VectorMetadata as V, EmbeddedDocument as a, VectorMetadataValue as b, SparseEmbeddingModel as c, EmbedDocumentsOptions as d, EmbedDocumentsResult as e, EmbedHybridDocumentsOptions as f, EmbedSparseQueryOptions as g, EmbedSparseQueryResult as h, EmbedSparseTextsOptions as i, EmbedSparseTextsResult as j, EmbedTextOptions as k, EmbedTextResult as l, EmbedTextsOptions as m, EmbedTextsResult as n, EmbedDocumentsBaseOptions as o, Embedding as p, EmbeddingOperationOptions as q, SparseEmbedding as r };
|
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
import { M as ModelCallOptions } from './model-call-options-CZkSw_xN.js';
|
|
2
|
+
|
|
3
|
+
type JsonPrimitive = string | number | boolean | null;
|
|
4
|
+
type JsonValue = JsonPrimitive | JsonObject | JsonValue[];
|
|
5
|
+
type JsonObject = {
|
|
6
|
+
[key: string]: JsonValue | undefined;
|
|
7
|
+
};
|
|
8
|
+
type Document = {
|
|
9
|
+
id: string;
|
|
10
|
+
text: string;
|
|
11
|
+
additionalProps?: Record<string, string>;
|
|
12
|
+
};
|
|
13
|
+
type TextPart = Readonly<{
|
|
14
|
+
type: "text";
|
|
15
|
+
text: string;
|
|
16
|
+
signature?: string;
|
|
17
|
+
}>;
|
|
18
|
+
type ImageDetail = "auto" | "low" | "high";
|
|
19
|
+
type FileData = Readonly<{
|
|
20
|
+
type: "url";
|
|
21
|
+
url: string;
|
|
22
|
+
}> | Readonly<{
|
|
23
|
+
type: "data";
|
|
24
|
+
data: string;
|
|
25
|
+
}> | Readonly<{
|
|
26
|
+
type: "text";
|
|
27
|
+
text: string;
|
|
28
|
+
}>;
|
|
29
|
+
type ImagePart = Readonly<{
|
|
30
|
+
type: "image";
|
|
31
|
+
image: Exclude<FileData, Readonly<{
|
|
32
|
+
type: "text";
|
|
33
|
+
text: string;
|
|
34
|
+
}>>;
|
|
35
|
+
mediaType?: string;
|
|
36
|
+
detail?: ImageDetail;
|
|
37
|
+
}>;
|
|
38
|
+
type FilePart = Readonly<{
|
|
39
|
+
type: "file";
|
|
40
|
+
data: FileData;
|
|
41
|
+
mediaType: string;
|
|
42
|
+
filename?: string;
|
|
43
|
+
}>;
|
|
44
|
+
type ReasoningPart = Readonly<{
|
|
45
|
+
type: "reasoning";
|
|
46
|
+
text: string;
|
|
47
|
+
id?: string;
|
|
48
|
+
details?: readonly ReasoningDetail[];
|
|
49
|
+
}>;
|
|
50
|
+
type ReasoningDetail = Readonly<{
|
|
51
|
+
type: "text";
|
|
52
|
+
text: string;
|
|
53
|
+
signature?: string;
|
|
54
|
+
}> | Readonly<{
|
|
55
|
+
type: "summary";
|
|
56
|
+
text: string;
|
|
57
|
+
}> | Readonly<{
|
|
58
|
+
type: "encrypted";
|
|
59
|
+
data: string;
|
|
60
|
+
}> | Readonly<{
|
|
61
|
+
type: "redacted";
|
|
62
|
+
data: string;
|
|
63
|
+
}>;
|
|
64
|
+
type ReasoningContentType = ReasoningDetail["type"];
|
|
65
|
+
type ToolCallPart = Readonly<{
|
|
66
|
+
type: "tool-call";
|
|
67
|
+
toolCallId: string;
|
|
68
|
+
callId?: string;
|
|
69
|
+
toolName: string;
|
|
70
|
+
input: JsonValue;
|
|
71
|
+
signature?: string;
|
|
72
|
+
}>;
|
|
73
|
+
type ToolResultContentPart = TextPart | FilePart;
|
|
74
|
+
type ToolResultOutput = Readonly<{
|
|
75
|
+
type: "text";
|
|
76
|
+
value: string;
|
|
77
|
+
}> | Readonly<{
|
|
78
|
+
type: "json";
|
|
79
|
+
value: JsonValue;
|
|
80
|
+
}> | Readonly<{
|
|
81
|
+
type: "content";
|
|
82
|
+
value: readonly ToolResultContentPart[];
|
|
83
|
+
}> | Readonly<{
|
|
84
|
+
type: "execution-denied";
|
|
85
|
+
reason?: string;
|
|
86
|
+
}> | Readonly<{
|
|
87
|
+
type: "error-text";
|
|
88
|
+
value: string;
|
|
89
|
+
}> | Readonly<{
|
|
90
|
+
type: "error-json";
|
|
91
|
+
value: JsonValue;
|
|
92
|
+
}>;
|
|
93
|
+
type ToolResultPart = Readonly<{
|
|
94
|
+
type: "tool-result";
|
|
95
|
+
toolCallId: string;
|
|
96
|
+
callId?: string;
|
|
97
|
+
toolName: string;
|
|
98
|
+
output: ToolResultOutput;
|
|
99
|
+
}>;
|
|
100
|
+
type ToolApprovalResponsePart = Readonly<{
|
|
101
|
+
type: "tool-approval-response";
|
|
102
|
+
interactionId: string;
|
|
103
|
+
toolCallId: string;
|
|
104
|
+
callId?: string;
|
|
105
|
+
toolName: string;
|
|
106
|
+
approved: boolean;
|
|
107
|
+
reason?: string;
|
|
108
|
+
}>;
|
|
109
|
+
type ToolQuestionAnswer = Readonly<{
|
|
110
|
+
questionId: string;
|
|
111
|
+
value: string;
|
|
112
|
+
}>;
|
|
113
|
+
type ToolQuestionResponsePart = Readonly<{
|
|
114
|
+
type: "tool-question-response";
|
|
115
|
+
interactionId: string;
|
|
116
|
+
toolCallId: string;
|
|
117
|
+
callId?: string;
|
|
118
|
+
toolName: string;
|
|
119
|
+
answers: readonly ToolQuestionAnswer[];
|
|
120
|
+
}>;
|
|
121
|
+
type ToolInteractionResponsePart = ToolApprovalResponsePart | ToolQuestionResponsePart;
|
|
122
|
+
type UserContentPart = TextPart | ImagePart | FilePart;
|
|
123
|
+
type AssistantContentPart = TextPart | ImagePart | FilePart | ReasoningPart | ToolCallPart;
|
|
124
|
+
type SystemMessage<Metadata extends JsonObject = JsonObject> = Readonly<{
|
|
125
|
+
role: "system";
|
|
126
|
+
content: string;
|
|
127
|
+
metadata?: Metadata;
|
|
128
|
+
}>;
|
|
129
|
+
type UserMessage<Metadata extends JsonObject = JsonObject> = Readonly<{
|
|
130
|
+
role: "user";
|
|
131
|
+
content: string | readonly UserContentPart[];
|
|
132
|
+
metadata?: Metadata;
|
|
133
|
+
}>;
|
|
134
|
+
type AssistantMessage<Metadata extends JsonObject = JsonObject> = Readonly<{
|
|
135
|
+
role: "assistant";
|
|
136
|
+
id?: string;
|
|
137
|
+
content: string | readonly AssistantContentPart[];
|
|
138
|
+
metadata?: Metadata;
|
|
139
|
+
}>;
|
|
140
|
+
type ToolMessage<Metadata extends JsonObject = JsonObject> = Readonly<{
|
|
141
|
+
role: "tool";
|
|
142
|
+
content: readonly (ToolResultPart | ToolInteractionResponsePart)[];
|
|
143
|
+
metadata?: Metadata;
|
|
144
|
+
}>;
|
|
145
|
+
type Message<Metadata extends JsonObject = JsonObject> = SystemMessage<Metadata> | UserMessage<Metadata> | AssistantMessage<Metadata> | ToolMessage<Metadata>;
|
|
146
|
+
declare function reasoningDisplayText(reasoning: ReasoningPart | readonly ReasoningDetail[]): string;
|
|
147
|
+
type ToolChoice = "auto" | "required" | "none" | {
|
|
148
|
+
type: "function";
|
|
149
|
+
name: string;
|
|
150
|
+
};
|
|
151
|
+
type ToolDefinition = {
|
|
152
|
+
name: string;
|
|
153
|
+
description: string;
|
|
154
|
+
parameters: JsonObject;
|
|
155
|
+
};
|
|
156
|
+
/**
|
|
157
|
+
* A tool executed by the model provider rather than by Anvia's local tool runtime.
|
|
158
|
+
*
|
|
159
|
+
* Provider packages expose typed factories for these values. Application code can
|
|
160
|
+
* pass them through the same high-level `tools` APIs used for local tools.
|
|
161
|
+
*/
|
|
162
|
+
type ProviderTool = {
|
|
163
|
+
kind: "provider";
|
|
164
|
+
provider: string;
|
|
165
|
+
name: string;
|
|
166
|
+
configuration?: JsonObject;
|
|
167
|
+
};
|
|
168
|
+
type CompletionTool = ToolDefinition | ProviderTool;
|
|
169
|
+
declare function isProviderTool(value: unknown): value is ProviderTool;
|
|
170
|
+
type CompletionSource = {
|
|
171
|
+
type: "url";
|
|
172
|
+
url: string;
|
|
173
|
+
title?: string;
|
|
174
|
+
id?: string;
|
|
175
|
+
startIndex?: number;
|
|
176
|
+
endIndex?: number;
|
|
177
|
+
};
|
|
178
|
+
type ProviderToolCall = {
|
|
179
|
+
id: string;
|
|
180
|
+
name: string;
|
|
181
|
+
status?: string;
|
|
182
|
+
details?: JsonObject;
|
|
183
|
+
};
|
|
184
|
+
/**
|
|
185
|
+
* Provider-normalized, mutually exclusive usage buckets.
|
|
186
|
+
*
|
|
187
|
+
* Every token should appear in exactly one non-total bucket. `total` is the
|
|
188
|
+
* only aggregate key and should equal the sum of the other buckets.
|
|
189
|
+
*/
|
|
190
|
+
type UsageDetails = Record<string, number>;
|
|
191
|
+
type ModelContextLimits = {
|
|
192
|
+
contextWindow: number;
|
|
193
|
+
maxInputTokens?: number;
|
|
194
|
+
maxOutputTokens?: number;
|
|
195
|
+
};
|
|
196
|
+
type CompletionModelInfo = {
|
|
197
|
+
modelId: string;
|
|
198
|
+
context: ModelContextLimits;
|
|
199
|
+
};
|
|
200
|
+
type ContextUsage = {
|
|
201
|
+
model: CompletionModelInfo;
|
|
202
|
+
usedTokens: number;
|
|
203
|
+
remainingTokens: number;
|
|
204
|
+
usedPercent: number;
|
|
205
|
+
remainingPercent: number;
|
|
206
|
+
};
|
|
207
|
+
declare function calculateContextUsage(usage: Usage, model: CompletionModelInfo | undefined): ContextUsage | undefined;
|
|
208
|
+
declare function withContextUsage<RawResponse>(response: CompletionResponse<RawResponse>, model: CompletionModelInfo | undefined): CompletionResponse<RawResponse>;
|
|
209
|
+
declare function resolveModelContextLimits(modelId: string, catalog: Readonly<Record<string, ModelContextLimits>>, override?: ModelContextLimits): ModelContextLimits | undefined;
|
|
210
|
+
type AssistantGenerationMetadata = {
|
|
211
|
+
provider: string;
|
|
212
|
+
modelId: string;
|
|
213
|
+
usage: Usage;
|
|
214
|
+
contextUsage?: ContextUsage;
|
|
215
|
+
sources?: CompletionSource[];
|
|
216
|
+
providerToolCalls?: ProviderToolCall[];
|
|
217
|
+
};
|
|
218
|
+
type Usage = {
|
|
219
|
+
inputTokens: number;
|
|
220
|
+
outputTokens: number;
|
|
221
|
+
totalTokens: number;
|
|
222
|
+
cachedInputTokens: number;
|
|
223
|
+
cacheCreationInputTokens: number;
|
|
224
|
+
details?: UsageDetails;
|
|
225
|
+
};
|
|
226
|
+
declare const Usage: {
|
|
227
|
+
empty(): Usage;
|
|
228
|
+
add(left: Usage, right: Usage): Usage;
|
|
229
|
+
};
|
|
230
|
+
declare function getAssistantGenerationMetadata(message: Message): AssistantGenerationMetadata | undefined;
|
|
231
|
+
type CompletionRequest = {
|
|
232
|
+
instructions?: string;
|
|
233
|
+
chatHistory: Message[];
|
|
234
|
+
documents: Document[];
|
|
235
|
+
tools: ToolDefinition[];
|
|
236
|
+
providerTools?: ProviderTool[];
|
|
237
|
+
temperature?: number;
|
|
238
|
+
maxTokens?: number;
|
|
239
|
+
toolChoice?: ToolChoice;
|
|
240
|
+
providerOptions?: JsonObject;
|
|
241
|
+
outputSchema?: JsonObject;
|
|
242
|
+
};
|
|
243
|
+
type CompletionResponse<RawResponse = unknown> = {
|
|
244
|
+
choice: AssistantContentPart[];
|
|
245
|
+
usage: Usage;
|
|
246
|
+
contextUsage?: ContextUsage;
|
|
247
|
+
rawResponse: RawResponse;
|
|
248
|
+
messageId?: string;
|
|
249
|
+
sources?: CompletionSource[];
|
|
250
|
+
providerToolCalls?: ProviderToolCall[];
|
|
251
|
+
};
|
|
252
|
+
type CompletionResult<Output = string, RawResponse = unknown> = {
|
|
253
|
+
output: Output;
|
|
254
|
+
text: string;
|
|
255
|
+
content: readonly AssistantContentPart[];
|
|
256
|
+
usage: Usage;
|
|
257
|
+
contextUsage?: ContextUsage;
|
|
258
|
+
rawResponse: RawResponse;
|
|
259
|
+
messageId?: string;
|
|
260
|
+
sources?: readonly CompletionSource[];
|
|
261
|
+
providerToolCalls?: readonly ProviderToolCall[];
|
|
262
|
+
};
|
|
263
|
+
type CompletionModelCapabilities = {
|
|
264
|
+
streaming: boolean;
|
|
265
|
+
tools: boolean;
|
|
266
|
+
toolChoice: boolean;
|
|
267
|
+
imageInput: boolean;
|
|
268
|
+
documentInput: boolean;
|
|
269
|
+
outputSchema: boolean;
|
|
270
|
+
reasoning: boolean;
|
|
271
|
+
providerTools?: boolean;
|
|
272
|
+
};
|
|
273
|
+
interface CompletionModel<RawResponse = unknown> {
|
|
274
|
+
readonly provider: string;
|
|
275
|
+
readonly modelId: string;
|
|
276
|
+
readonly contextLimits?: ModelContextLimits | undefined;
|
|
277
|
+
readonly capabilities: CompletionModelCapabilities;
|
|
278
|
+
traceRequest?(request: CompletionRequest, options?: {
|
|
279
|
+
stream?: boolean | undefined;
|
|
280
|
+
}): JsonObject | undefined;
|
|
281
|
+
completion(request: CompletionRequest, options?: ModelCallOptions): Promise<CompletionResponse<RawResponse>>;
|
|
282
|
+
}
|
|
283
|
+
type ToolCallArgumentsMode = "append" | "replace";
|
|
284
|
+
type CompletionStreamPart = {
|
|
285
|
+
type: "text_delta";
|
|
286
|
+
delta: string;
|
|
287
|
+
} | {
|
|
288
|
+
type: "reasoning_delta";
|
|
289
|
+
delta: string;
|
|
290
|
+
id?: string;
|
|
291
|
+
contentType?: ReasoningContentType;
|
|
292
|
+
signature?: string;
|
|
293
|
+
} | {
|
|
294
|
+
type: "tool_call_delta";
|
|
295
|
+
id: string;
|
|
296
|
+
callId?: string;
|
|
297
|
+
name?: string;
|
|
298
|
+
argumentsDelta?: string;
|
|
299
|
+
argumentsMode?: ToolCallArgumentsMode;
|
|
300
|
+
signature?: string;
|
|
301
|
+
} | {
|
|
302
|
+
type: "tool_call";
|
|
303
|
+
toolCall: ToolCallPart;
|
|
304
|
+
} | {
|
|
305
|
+
type: "source";
|
|
306
|
+
source: CompletionSource;
|
|
307
|
+
} | {
|
|
308
|
+
type: "provider_tool_call";
|
|
309
|
+
toolCall: ProviderToolCall;
|
|
310
|
+
} | {
|
|
311
|
+
type: "message_id";
|
|
312
|
+
id: string;
|
|
313
|
+
};
|
|
314
|
+
type CompletionModelStreamEvent<RawResponse = unknown> = CompletionStreamPart | {
|
|
315
|
+
type: "final";
|
|
316
|
+
response: CompletionResponse<RawResponse>;
|
|
317
|
+
} | {
|
|
318
|
+
type: "error";
|
|
319
|
+
error: unknown;
|
|
320
|
+
usage?: Usage;
|
|
321
|
+
};
|
|
322
|
+
type CompletionStreamEvent<Output = string, RawResponse = unknown> = CompletionStreamPart | {
|
|
323
|
+
type: "final";
|
|
324
|
+
result: CompletionResult<Output, RawResponse>;
|
|
325
|
+
} | {
|
|
326
|
+
type: "error";
|
|
327
|
+
error: unknown;
|
|
328
|
+
usage: Usage;
|
|
329
|
+
};
|
|
330
|
+
interface StreamingCompletionModel<RawResponse = unknown> extends CompletionModel<RawResponse> {
|
|
331
|
+
streamCompletion(request: CompletionRequest, options?: ModelCallOptions): AsyncIterable<CompletionModelStreamEvent<RawResponse>>;
|
|
332
|
+
}
|
|
333
|
+
declare class CompletionCapabilityError extends Error {
|
|
334
|
+
constructor(message: string);
|
|
335
|
+
}
|
|
336
|
+
declare function assertCompletionRequestSupported(model: CompletionModel, request: CompletionRequest, options?: {
|
|
337
|
+
streaming?: boolean | undefined;
|
|
338
|
+
}): void;
|
|
339
|
+
declare function textFromAssistantContent(content: readonly AssistantContentPart[]): string;
|
|
340
|
+
|
|
341
|
+
export { type ToolQuestionResponsePart as $, type AssistantContentPart as A, type UserContentPart as B, type CompletionModel as C, type Document as D, type UserMessage as E, type FileData as F, calculateContextUsage as G, getAssistantGenerationMetadata as H, type ImageDetail as I, type JsonObject as J, isProviderTool as K, resolveModelContextLimits as L, type Message as M, withContextUsage as N, CompletionCapabilityError as O, type ProviderTool as P, type CompletionModelCapabilities as Q, type ReasoningContentType as R, type SystemMessage as S, type TextPart as T, Usage as U, type CompletionStreamPart as V, type StreamingCompletionModel as W, type ToolApprovalResponsePart as X, type ToolCallArgumentsMode as Y, type ToolInteractionResponsePart as Z, type ToolQuestionAnswer as _, type AssistantGenerationMetadata as a, type UsageDetails as a0, assertCompletionRequestSupported as a1, reasoningDisplayText as a2, textFromAssistantContent as a3, type AssistantMessage as b, type CompletionModelInfo as c, type CompletionModelStreamEvent as d, type CompletionRequest as e, type CompletionResponse as f, type CompletionResult as g, type CompletionSource as h, type CompletionStreamEvent as i, type CompletionTool as j, type ContextUsage as k, type FilePart as l, type ImagePart as m, type JsonPrimitive as n, type JsonValue as o, type ModelContextLimits as p, type ProviderToolCall as q, type ReasoningDetail as r, type ReasoningPart as s, type ToolCallPart as t, type ToolChoice as u, type ToolDefinition as v, type ToolMessage as w, type ToolResultContentPart as x, type ToolResultOutput as y, type ToolResultPart as z };
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { U as Usage, J as JsonObject, M as Message, S as SystemMessage, C as CompletionModel } from './types-D9rKQ_as.js';
|
|
2
|
+
import { b as RetrySetting } from './retry-CjvSlKGW.js';
|
|
3
|
+
|
|
4
|
+
type MemorySavePolicy = "message" | "turn" | "run";
|
|
5
|
+
type MemoryScope = {
|
|
6
|
+
sessionId: string;
|
|
7
|
+
userId?: string | undefined;
|
|
8
|
+
metadata?: JsonObject | undefined;
|
|
9
|
+
};
|
|
10
|
+
type MemoryScopeKeyOptions = {
|
|
11
|
+
includeUserId?: boolean | undefined;
|
|
12
|
+
metadataKeys?: readonly string[] | undefined;
|
|
13
|
+
};
|
|
14
|
+
type CreateMemoryScopeKeyOptions = MemoryScopeKeyOptions & {
|
|
15
|
+
scope: MemoryScope;
|
|
16
|
+
};
|
|
17
|
+
type MemoryScopeKeyResolver = MemoryScopeKeyOptions | ((options: {
|
|
18
|
+
scope: MemoryScope;
|
|
19
|
+
}) => string);
|
|
20
|
+
type MemoryLoadOptions = {
|
|
21
|
+
scope: MemoryScope;
|
|
22
|
+
};
|
|
23
|
+
type MemoryAppendOptions = {
|
|
24
|
+
scope: MemoryScope;
|
|
25
|
+
runId: string;
|
|
26
|
+
turn: number;
|
|
27
|
+
messages: Message[];
|
|
28
|
+
};
|
|
29
|
+
type MemoryClearOptions = {
|
|
30
|
+
scope: MemoryScope;
|
|
31
|
+
};
|
|
32
|
+
type MemoryErrorOptions = {
|
|
33
|
+
scope: MemoryScope;
|
|
34
|
+
runId: string;
|
|
35
|
+
error: unknown;
|
|
36
|
+
messages: Message[];
|
|
37
|
+
};
|
|
38
|
+
type MemoryConversationListOptions = {
|
|
39
|
+
limit: number;
|
|
40
|
+
userId?: string | undefined;
|
|
41
|
+
};
|
|
42
|
+
type MemoryConversationGetOptions = {
|
|
43
|
+
ref: string;
|
|
44
|
+
};
|
|
45
|
+
type MemoryConversationSummary = {
|
|
46
|
+
/** Opaque, store-specific reference used to retrieve this exact conversation. */
|
|
47
|
+
ref: string;
|
|
48
|
+
sessionId: string;
|
|
49
|
+
userId?: string | undefined;
|
|
50
|
+
metadata?: JsonObject | undefined;
|
|
51
|
+
createdAt: string;
|
|
52
|
+
updatedAt: string;
|
|
53
|
+
messageCount: number;
|
|
54
|
+
};
|
|
55
|
+
type MemoryConversationMessage = {
|
|
56
|
+
position: number;
|
|
57
|
+
runId: string;
|
|
58
|
+
turn: number;
|
|
59
|
+
createdAt: string;
|
|
60
|
+
message: Message;
|
|
61
|
+
};
|
|
62
|
+
type MemoryConversation = MemoryConversationSummary & {
|
|
63
|
+
messages: MemoryConversationMessage[];
|
|
64
|
+
};
|
|
65
|
+
/** Optional, read-only discovery surface for developer tooling such as Studio. */
|
|
66
|
+
interface MemoryInspector {
|
|
67
|
+
listConversations(options: MemoryConversationListOptions): Promise<MemoryConversationSummary[]>;
|
|
68
|
+
getConversation(options: MemoryConversationGetOptions): Promise<MemoryConversation | undefined>;
|
|
69
|
+
}
|
|
70
|
+
interface MemoryStore {
|
|
71
|
+
readonly inspector?: MemoryInspector | undefined;
|
|
72
|
+
readonly compaction?: MemoryCompactionCapability | undefined;
|
|
73
|
+
load(options: MemoryLoadOptions): Promise<Message[]>;
|
|
74
|
+
append(options: MemoryAppendOptions): Promise<void>;
|
|
75
|
+
clear(options: MemoryClearOptions): Promise<void>;
|
|
76
|
+
recordError?(options: MemoryErrorOptions): Promise<void>;
|
|
77
|
+
}
|
|
78
|
+
type MemoryCompactionMetadata = {
|
|
79
|
+
version: 1;
|
|
80
|
+
compactedMessageCount: number;
|
|
81
|
+
};
|
|
82
|
+
type MemoryCompactionMessage = Omit<SystemMessage, "metadata"> & {
|
|
83
|
+
metadata: {
|
|
84
|
+
anvia: {
|
|
85
|
+
memoryCompaction: MemoryCompactionMetadata;
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
type MemoryCompactionSnapshot = {
|
|
90
|
+
/** Opaque store revision used to reject stale compaction replacements. */
|
|
91
|
+
revision: string;
|
|
92
|
+
messages: Message[];
|
|
93
|
+
};
|
|
94
|
+
type MemoryCompactionSnapshotOptions = {
|
|
95
|
+
scope: MemoryScope;
|
|
96
|
+
};
|
|
97
|
+
type MemoryCompactionReplacePrefixOptions = {
|
|
98
|
+
scope: MemoryScope;
|
|
99
|
+
revision: string;
|
|
100
|
+
messageCount: number;
|
|
101
|
+
replacement: MemoryCompactionMessage;
|
|
102
|
+
runId: string;
|
|
103
|
+
};
|
|
104
|
+
type MemoryCompactionReplacePrefixResult = {
|
|
105
|
+
status: "committed" | "conflict";
|
|
106
|
+
};
|
|
107
|
+
/** Optional atomic prefix-replacement capability used by automatic memory compaction. */
|
|
108
|
+
interface MemoryCompactionCapability {
|
|
109
|
+
snapshot(options: MemoryCompactionSnapshotOptions): Promise<MemoryCompactionSnapshot>;
|
|
110
|
+
replacePrefix(options: MemoryCompactionReplacePrefixOptions): Promise<MemoryCompactionReplacePrefixResult>;
|
|
111
|
+
}
|
|
112
|
+
type MemoryCompactorInput = {
|
|
113
|
+
scope: MemoryScope;
|
|
114
|
+
messages: Message[];
|
|
115
|
+
abortSignal?: AbortSignal | undefined;
|
|
116
|
+
};
|
|
117
|
+
type MemoryCompactorResult = {
|
|
118
|
+
summary: string;
|
|
119
|
+
usage?: Usage | undefined;
|
|
120
|
+
};
|
|
121
|
+
type MemoryCompactor = (input: MemoryCompactorInput) => Promise<MemoryCompactorResult>;
|
|
122
|
+
type CreateSummaryMemoryCompactorOptions = {
|
|
123
|
+
model: CompletionModel;
|
|
124
|
+
instructions?: string | undefined;
|
|
125
|
+
maxTokens?: number | undefined;
|
|
126
|
+
temperature?: number | undefined;
|
|
127
|
+
providerOptions?: JsonObject | undefined;
|
|
128
|
+
retries?: RetrySetting | undefined;
|
|
129
|
+
};
|
|
130
|
+
type MemoryCompactionConflictRetryOptions = {
|
|
131
|
+
maxAttempts: number;
|
|
132
|
+
};
|
|
133
|
+
type MemoryCompactionOptions = {
|
|
134
|
+
trigger: {
|
|
135
|
+
afterMessages: number;
|
|
136
|
+
};
|
|
137
|
+
retention?: {
|
|
138
|
+
recentUserTurns?: number | undefined;
|
|
139
|
+
};
|
|
140
|
+
compactor: MemoryCompactor;
|
|
141
|
+
conflictRetries?: false | MemoryCompactionConflictRetryOptions | undefined;
|
|
142
|
+
};
|
|
143
|
+
type MemoryOptions = {
|
|
144
|
+
savePolicy?: MemorySavePolicy | undefined;
|
|
145
|
+
compaction?: MemoryCompactionOptions | undefined;
|
|
146
|
+
};
|
|
147
|
+
type MemoryCompactionInfo = {
|
|
148
|
+
originalMessageCount: number;
|
|
149
|
+
compactedMessageCount: number;
|
|
150
|
+
retainedMessageCount: number;
|
|
151
|
+
attempts: number;
|
|
152
|
+
usage: Usage;
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
export type { MemoryScopeKeyOptions as A, MemoryScopeKeyResolver as B, CreateMemoryScopeKeyOptions as C, MemoryStore as D, MemoryAppendOptions as M, CreateSummaryMemoryCompactorOptions as a, MemoryClearOptions as b, MemoryCompactionCapability as c, MemoryCompactionConflictRetryOptions as d, MemoryCompactionInfo as e, MemoryCompactionMessage as f, MemoryCompactionMetadata as g, MemoryCompactionOptions as h, MemoryCompactionReplacePrefixOptions as i, MemoryCompactionReplacePrefixResult as j, MemoryCompactionSnapshot as k, MemoryCompactionSnapshotOptions as l, MemoryCompactor as m, MemoryCompactorInput as n, MemoryCompactorResult as o, MemoryConversation as p, MemoryConversationGetOptions as q, MemoryConversationListOptions as r, MemoryConversationMessage as s, MemoryConversationSummary as t, MemoryErrorOptions as u, MemoryInspector as v, MemoryLoadOptions as w, MemoryOptions as x, MemorySavePolicy as y, MemoryScope as z };
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { b as VectorMetadataValue, V as VectorMetadata,
|
|
2
|
-
import { T as Tool } from '../tool-
|
|
3
|
-
import {
|
|
4
|
-
export { L as LshOptions,
|
|
5
|
-
import '../
|
|
1
|
+
import { b as VectorMetadataValue, V as VectorMetadata, a as EmbeddedDocument } from '../types-Cr4uiYo5.js';
|
|
2
|
+
import { T as Tool } from '../tool-r62gf3QY.js';
|
|
3
|
+
import { V as VectorFilter, R as RetrieveDocumentsOptions, a as VectorSearchResult, f as RetrieveHybridDocumentsOptions, d as VectorStore, I as IndexStrategy, g as VectorStoreUpsertOptions, h as VectorSearchRequest, b as VectorInspectRequest, c as VectorInspectPage, i as VectorSearchToolOptions } from '../types-C3gv9EX6.js';
|
|
4
|
+
export { D as DenseVectorSearchToolOptions, j as HybridVectorSearchRequest, k as HybridVectorSearchToolOptions, H as HybridVectorStore, L as LshOptions, l as RetrieveDocumentsBaseOptions, e as VectorFusion, m as VectorInspectItem, n as VectorMetric, o as VectorSearchToolBaseOptions } from '../types-C3gv9EX6.js';
|
|
5
|
+
import '../model-call-options-CZkSw_xN.js';
|
|
6
|
+
import '../retry-CjvSlKGW.js';
|
|
7
|
+
import '../types-D9rKQ_as.js';
|
|
6
8
|
|
|
7
9
|
declare const vectorFilter: {
|
|
8
10
|
eq(key: string, value: VectorMetadataValue): VectorFilter;
|
|
@@ -12,47 +14,44 @@ declare const vectorFilter: {
|
|
|
12
14
|
or(left: VectorFilter, right: VectorFilter): VectorFilter;
|
|
13
15
|
};
|
|
14
16
|
|
|
17
|
+
declare function retrieveDocuments<T, Metadata extends VectorMetadata = VectorMetadata>(options: RetrieveDocumentsOptions<T, Metadata>): Promise<Array<VectorSearchResult<T, Metadata>>>;
|
|
18
|
+
declare function retrieveDocuments<T, Metadata extends VectorMetadata = VectorMetadata>(options: RetrieveHybridDocumentsOptions<T, Metadata>): Promise<Array<VectorSearchResult<T, Metadata>>>;
|
|
19
|
+
|
|
15
20
|
type StoredDocument<T, Metadata extends VectorMetadata> = EmbeddedDocument<T, Metadata>;
|
|
16
|
-
|
|
21
|
+
type InMemoryVectorStoreOptions = {
|
|
22
|
+
dimensions?: number | undefined;
|
|
23
|
+
index?: IndexStrategy | undefined;
|
|
24
|
+
};
|
|
25
|
+
type InMemoryVectorStoreFromDocumentsOptions<T, Metadata extends VectorMetadata = VectorMetadata> = InMemoryVectorStoreOptions & {
|
|
26
|
+
documents: Array<EmbeddedDocument<T, Metadata>>;
|
|
27
|
+
};
|
|
28
|
+
declare class InMemoryVectorStore<T, Metadata extends VectorMetadata = VectorMetadata> implements VectorStore<T, Metadata> {
|
|
17
29
|
private readonly documents;
|
|
18
|
-
private indexStrategy;
|
|
30
|
+
private readonly indexStrategy;
|
|
19
31
|
private lshIndex;
|
|
20
32
|
private embeddingDimension;
|
|
21
|
-
constructor(options?:
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
33
|
+
constructor(options?: InMemoryVectorStoreOptions);
|
|
34
|
+
static fromDocuments<T, Metadata extends VectorMetadata = VectorMetadata>(options: InMemoryVectorStoreFromDocumentsOptions<T, Metadata>): InMemoryVectorStore<T, Metadata>;
|
|
35
|
+
ensure(): Promise<void>;
|
|
36
|
+
validate(): Promise<void>;
|
|
37
|
+
upsert(options: VectorStoreUpsertOptions<T, Metadata>): Promise<void>;
|
|
38
|
+
get(options: {
|
|
39
|
+
id: string;
|
|
40
|
+
}): StoredDocument<T, Metadata> | undefined;
|
|
29
41
|
values(): Array<StoredDocument<T, Metadata>>;
|
|
30
42
|
len(): number;
|
|
31
43
|
isEmpty(): boolean;
|
|
32
|
-
|
|
33
|
-
|
|
44
|
+
search(request: VectorSearchRequest): Promise<Array<VectorSearchResult<T, Metadata>>>;
|
|
45
|
+
inspect(request: VectorInspectRequest): Promise<VectorInspectPage<T, Metadata>>;
|
|
46
|
+
private replaceDocuments;
|
|
47
|
+
private candidates;
|
|
34
48
|
private rebuildLshIndex;
|
|
35
49
|
private validateDocumentDimensions;
|
|
36
50
|
private validateQueryDimension;
|
|
37
51
|
}
|
|
38
|
-
declare
|
|
39
|
-
private readonly model;
|
|
40
|
-
private readonly store;
|
|
41
|
-
constructor(model: EmbeddingModel, store: InMemoryVectorStore<T, Metadata>);
|
|
42
|
-
search(request: VectorSearchRequest): Promise<Array<VectorSearchResult<T, Metadata>>>;
|
|
43
|
-
searchIds(request: VectorSearchRequest): Promise<Array<{
|
|
44
|
-
score: number;
|
|
45
|
-
id: string;
|
|
46
|
-
}>>;
|
|
47
|
-
inspect(request: VectorInspectRequest): Promise<VectorInspectPage<T, Metadata>>;
|
|
48
|
-
asTool(options: VectorSearchToolOptions): Tool<{
|
|
49
|
-
query: string;
|
|
50
|
-
topK?: number;
|
|
51
|
-
}, unknown>;
|
|
52
|
-
}
|
|
53
|
-
declare function createVectorSearchTool<T, Metadata extends VectorMetadata>(index: VectorSearchIndex<T, Metadata>, options: VectorSearchToolOptions): Tool<{
|
|
52
|
+
declare function createVectorSearchTool<T, Metadata extends VectorMetadata>(options: VectorSearchToolOptions<T, Metadata>): Tool<{
|
|
54
53
|
query: string;
|
|
55
54
|
topK?: number;
|
|
56
55
|
}, Array<VectorSearchResult<T, Metadata>>>;
|
|
57
56
|
|
|
58
|
-
export {
|
|
57
|
+
export { InMemoryVectorStore, type InMemoryVectorStoreFromDocumentsOptions, type InMemoryVectorStoreOptions, IndexStrategy, RetrieveDocumentsOptions, RetrieveHybridDocumentsOptions, VectorFilter, VectorInspectPage, VectorInspectRequest, VectorSearchRequest, VectorSearchResult, VectorSearchToolOptions, VectorStore, VectorStoreUpsertOptions, createVectorSearchTool, retrieveDocuments, vectorFilter };
|