@anvia/core 1.0.0-rc.1 → 1.0.0-rc.2
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 +283 -84
- package/dist/agent/index.d.ts +26 -18
- package/dist/agent/index.js +19 -15
- package/dist/agent-yBG8e9Jj.d.ts +153 -0
- package/dist/chunk-4WI3VGZK.js +127 -0
- package/dist/chunk-4WI3VGZK.js.map +1 -0
- package/dist/{chunk-R2LJSQUW.js → chunk-77AIYARB.js} +251 -104
- package/dist/chunk-77AIYARB.js.map +1 -0
- package/dist/chunk-AI5JMUW7.js +45 -0
- package/dist/chunk-AI5JMUW7.js.map +1 -0
- package/dist/chunk-BEYBU7VJ.js +53 -0
- package/dist/chunk-BEYBU7VJ.js.map +1 -0
- package/dist/chunk-CWM7B2OO.js +315 -0
- package/dist/chunk-CWM7B2OO.js.map +1 -0
- package/dist/{chunk-6WGGTJE6.js → chunk-D37WMSP6.js} +52 -60
- package/dist/chunk-D37WMSP6.js.map +1 -0
- package/dist/{chunk-IL3ZSNJI.js → chunk-DBSCKTUL.js} +845 -800
- package/dist/chunk-DBSCKTUL.js.map +1 -0
- package/dist/chunk-EINTGEGY.js +629 -0
- package/dist/chunk-EINTGEGY.js.map +1 -0
- package/dist/chunk-FMHLROPQ.js +351 -0
- package/dist/chunk-FMHLROPQ.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-FNQB2JEH.js → chunk-KIDGIJM7.js} +26 -5
- package/dist/chunk-KIDGIJM7.js.map +1 -0
- package/dist/chunk-KR3RCCHJ.js +500 -0
- package/dist/chunk-KR3RCCHJ.js.map +1 -0
- package/dist/{chunk-I6G7BC42.js → chunk-MGNTXGTX.js} +2 -6
- package/dist/chunk-MGNTXGTX.js.map +1 -0
- package/dist/{chunk-5XKDW36Z.js → chunk-OJH6HWHX.js} +64 -75
- package/dist/chunk-OJH6HWHX.js.map +1 -0
- package/dist/chunk-QOUPWOGW.js +29 -0
- package/dist/chunk-QOUPWOGW.js.map +1 -0
- package/dist/chunk-TIZYTPJO.js +208 -0
- package/dist/chunk-TIZYTPJO.js.map +1 -0
- package/dist/{chunk-DMPUP4R3.js → chunk-XKYYBABH.js} +5 -5
- package/dist/client-B8DT1vUG.d.ts +83 -0
- package/dist/completion/index.d.ts +5 -4
- package/dist/completion/index.js +25 -28
- package/dist/{dynamic-tools-i9woysFa.d.ts → dynamic-tools-KwEGRbHp.d.ts} +21 -9
- package/dist/embeddings/index.d.ts +11 -9
- package/dist/embeddings/index.js +2 -3
- package/dist/evals/index.d.ts +44 -24
- package/dist/evals/index.js +86 -69
- 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 +2 -1
- 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 +24 -22
- package/dist/index.js +50 -48
- package/dist/internal/agent.d.ts +30 -19
- package/dist/internal/agent.js +13 -11
- package/dist/loaders/index.d.ts +2 -1
- package/dist/mcp/index.d.ts +19 -13
- package/dist/mcp/index.js +13 -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-Cn7ezRfJ.d.ts +52 -0
- package/dist/{middleware-KynLg_RW.d.ts → middleware-C7PdmKF7.d.ts} +4 -4
- 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 +19 -5
- package/dist/observability/index.js +8 -5
- package/dist/observability/index.js.map +1 -1
- package/dist/pipeline/index.d.ts +105 -56
- package/dist/pipeline/index.js +422 -230
- 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 +7 -7
- package/dist/speech-generation/index.d.ts +37 -0
- package/dist/speech-generation/index.js +8 -0
- package/dist/{think-tool-DZqZj2LV.d.ts → think-tool-6H2QNQzQ.d.ts} +1 -1
- package/dist/tool/index.d.ts +9 -7
- package/dist/tool/index.js +7 -10
- package/dist/{tool-C_8GudXn.d.ts → tool--Mz4v1eL.d.ts} +15 -7
- package/dist/transcription/index.d.ts +23 -14
- package/dist/transcription/index.js +2 -2
- package/dist/{index-DxB74ybJ.d.ts → types-3x3mOLHU.d.ts} +94 -64
- package/dist/types-BVzM4RsC.d.ts +155 -0
- package/dist/types-CQ_ioXWK.d.ts +319 -0
- package/dist/types-Cr4uiYo5.d.ts +99 -0
- package/dist/{types-DhQfwiZn.d.ts → types-DiJqJejp.d.ts} +1 -1
- package/dist/types-Dld1TpWj.d.ts +130 -0
- package/dist/vector-store/index.d.ts +33 -34
- package/dist/vector-store/index.js +6 -6
- package/package.json +6 -10
- 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.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.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/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-XKYYBABH.js.map} +0 -0
- /package/dist/{audio-generation → speech-generation}/index.js.map +0 -0
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
// src/completion/json.ts
|
|
2
|
+
function isJsonValue(value) {
|
|
3
|
+
return isJsonValueWithAncestors(value, /* @__PURE__ */ new WeakSet());
|
|
4
|
+
}
|
|
5
|
+
function isJsonValueWithAncestors(value, ancestors) {
|
|
6
|
+
if (value === null || typeof value === "string" || typeof value === "boolean") {
|
|
7
|
+
return true;
|
|
8
|
+
}
|
|
9
|
+
if (typeof value === "number") {
|
|
10
|
+
return Number.isFinite(value);
|
|
11
|
+
}
|
|
12
|
+
if (typeof value !== "object" || ancestors.has(value)) {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
ancestors.add(value);
|
|
16
|
+
try {
|
|
17
|
+
if (Array.isArray(value)) {
|
|
18
|
+
if (!hasOnlyDenseArrayProperties(value)) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
22
|
+
if (!isJsonValueWithAncestors(value[index], ancestors)) {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
const prototype = Object.getPrototypeOf(value);
|
|
29
|
+
if (prototype !== Object.prototype && prototype !== null) {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
for (const key of Reflect.ownKeys(value)) {
|
|
33
|
+
if (typeof key !== "string") {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, key);
|
|
37
|
+
if (descriptor === void 0 || !descriptor.enumerable || !("value" in descriptor) || !isJsonValueWithAncestors(descriptor.value, ancestors)) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return true;
|
|
42
|
+
} catch {
|
|
43
|
+
return false;
|
|
44
|
+
} finally {
|
|
45
|
+
ancestors.delete(value);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function hasOnlyDenseArrayProperties(value) {
|
|
49
|
+
const keys = Reflect.ownKeys(value);
|
|
50
|
+
if (keys.length !== value.length + 1 || keys.at(-1) !== "length") {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
54
|
+
const key = String(index);
|
|
55
|
+
if (keys[index] !== key) {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, key);
|
|
59
|
+
if (descriptor === void 0 || !descriptor.enumerable || !("value" in descriptor)) {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// src/completion/message-schema.ts
|
|
67
|
+
import { z } from "zod";
|
|
68
|
+
var jsonValueSchema = z.custom(isJsonValue, {
|
|
69
|
+
message: "Expected a strict JSON value"
|
|
70
|
+
});
|
|
71
|
+
var jsonObjectSchema = z.custom(
|
|
72
|
+
(value) => typeof value === "object" && value !== null && !Array.isArray(value) && isJsonValue(value),
|
|
73
|
+
{ message: "Expected a strict JSON object" }
|
|
74
|
+
);
|
|
75
|
+
var textPartSchema = z.object({
|
|
76
|
+
type: z.literal("text"),
|
|
77
|
+
text: z.string(),
|
|
78
|
+
signature: z.string().optional()
|
|
79
|
+
}).strict();
|
|
80
|
+
var urlDataSchema = z.object({ type: z.literal("url"), url: z.url() }).strict();
|
|
81
|
+
var binaryDataSchema = z.object({
|
|
82
|
+
type: z.literal("data"),
|
|
83
|
+
data: z.string().refine(isBase64, { message: "Expected base64 data" })
|
|
84
|
+
}).strict();
|
|
85
|
+
var textDataSchema = z.object({ type: z.literal("text"), text: z.string() }).strict();
|
|
86
|
+
var fileDataSchema = z.union([urlDataSchema, binaryDataSchema, textDataSchema]);
|
|
87
|
+
var mediaTypeSchema = z.string().regex(/^[^\s/]+\/[^\s/]+(?:\s*;.*)?$/, "Expected a media type");
|
|
88
|
+
var imagePartSchema = z.object({
|
|
89
|
+
type: z.literal("image"),
|
|
90
|
+
image: z.union([urlDataSchema, binaryDataSchema]),
|
|
91
|
+
mediaType: mediaTypeSchema.optional(),
|
|
92
|
+
detail: z.enum(["auto", "low", "high"]).optional()
|
|
93
|
+
}).strict();
|
|
94
|
+
var filePartSchema = z.object({
|
|
95
|
+
type: z.literal("file"),
|
|
96
|
+
data: fileDataSchema,
|
|
97
|
+
mediaType: mediaTypeSchema,
|
|
98
|
+
filename: z.string().optional()
|
|
99
|
+
}).strict();
|
|
100
|
+
var reasoningDetailSchema = z.union([
|
|
101
|
+
z.object({ type: z.literal("text"), text: z.string(), signature: z.string().optional() }).strict(),
|
|
102
|
+
z.object({ type: z.literal("summary"), text: z.string() }).strict(),
|
|
103
|
+
z.object({ type: z.literal("encrypted"), data: z.string() }).strict(),
|
|
104
|
+
z.object({ type: z.literal("redacted"), data: z.string() }).strict()
|
|
105
|
+
]);
|
|
106
|
+
var reasoningPartSchema = z.object({
|
|
107
|
+
type: z.literal("reasoning"),
|
|
108
|
+
text: z.string(),
|
|
109
|
+
id: z.string().optional(),
|
|
110
|
+
details: z.array(reasoningDetailSchema).optional()
|
|
111
|
+
}).strict();
|
|
112
|
+
var toolCallPartSchema = z.object({
|
|
113
|
+
type: z.literal("tool-call"),
|
|
114
|
+
toolCallId: z.string().min(1),
|
|
115
|
+
callId: z.string().optional(),
|
|
116
|
+
toolName: z.string().min(1),
|
|
117
|
+
input: jsonValueSchema,
|
|
118
|
+
signature: z.string().optional()
|
|
119
|
+
}).strict();
|
|
120
|
+
var toolResultOutputSchema = z.union([
|
|
121
|
+
z.object({ type: z.literal("text"), value: z.string() }).strict(),
|
|
122
|
+
z.object({ type: z.literal("json"), value: jsonValueSchema }).strict(),
|
|
123
|
+
z.object({
|
|
124
|
+
type: z.literal("content"),
|
|
125
|
+
value: z.array(z.union([textPartSchema, filePartSchema]))
|
|
126
|
+
}).strict(),
|
|
127
|
+
z.object({ type: z.literal("execution-denied"), reason: z.string().optional() }).strict(),
|
|
128
|
+
z.object({ type: z.literal("error-text"), value: z.string() }).strict(),
|
|
129
|
+
z.object({ type: z.literal("error-json"), value: jsonValueSchema }).strict()
|
|
130
|
+
]);
|
|
131
|
+
var toolResultPartSchema = z.object({
|
|
132
|
+
type: z.literal("tool-result"),
|
|
133
|
+
toolCallId: z.string().min(1),
|
|
134
|
+
callId: z.string().optional(),
|
|
135
|
+
toolName: z.string().min(1),
|
|
136
|
+
output: toolResultOutputSchema
|
|
137
|
+
}).strict();
|
|
138
|
+
function createMessageSchema(options) {
|
|
139
|
+
const metadata = options.metadataSchema.optional();
|
|
140
|
+
const system = z.object({ role: z.literal("system"), content: z.string(), metadata }).strict();
|
|
141
|
+
const user = z.object({
|
|
142
|
+
role: z.literal("user"),
|
|
143
|
+
content: z.union([
|
|
144
|
+
z.string(),
|
|
145
|
+
z.array(z.union([textPartSchema, imagePartSchema, filePartSchema]))
|
|
146
|
+
]),
|
|
147
|
+
metadata
|
|
148
|
+
}).strict();
|
|
149
|
+
const assistant = z.object({
|
|
150
|
+
role: z.literal("assistant"),
|
|
151
|
+
id: z.string().optional(),
|
|
152
|
+
content: z.union([
|
|
153
|
+
z.string(),
|
|
154
|
+
z.array(
|
|
155
|
+
z.union([
|
|
156
|
+
textPartSchema,
|
|
157
|
+
imagePartSchema,
|
|
158
|
+
filePartSchema,
|
|
159
|
+
reasoningPartSchema,
|
|
160
|
+
toolCallPartSchema
|
|
161
|
+
])
|
|
162
|
+
)
|
|
163
|
+
]),
|
|
164
|
+
metadata
|
|
165
|
+
}).strict();
|
|
166
|
+
const tool = z.object({ role: z.literal("tool"), content: z.array(toolResultPartSchema), metadata }).strict();
|
|
167
|
+
const message = z.union([system, user, assistant, tool]);
|
|
168
|
+
return z.custom(isJsonValue, { message: "Expected a strict JSON message" }).pipe(message).refine(isJsonValue, { message: "Expected a strict JSON message" });
|
|
169
|
+
}
|
|
170
|
+
var messageSchema = createMessageSchema({ metadataSchema: jsonObjectSchema });
|
|
171
|
+
var messagesSchema = z.array(messageSchema);
|
|
172
|
+
function parseMessage(value) {
|
|
173
|
+
return messageSchema.parse(value);
|
|
174
|
+
}
|
|
175
|
+
function parseMessages(value) {
|
|
176
|
+
return messagesSchema.parse(value);
|
|
177
|
+
}
|
|
178
|
+
function isMessage(value) {
|
|
179
|
+
return messageSchema.safeParse(value).success;
|
|
180
|
+
}
|
|
181
|
+
function isBase64(value) {
|
|
182
|
+
if (!/^[A-Za-z0-9+/]*={0,2}$/.test(value)) return false;
|
|
183
|
+
const firstPadding = value.indexOf("=");
|
|
184
|
+
if (firstPadding !== -1 && firstPadding < value.length - 2) return false;
|
|
185
|
+
const rawLength = value.replace(/=+$/, "").length;
|
|
186
|
+
if (rawLength % 4 === 1) return false;
|
|
187
|
+
return firstPadding === -1 || value.length % 4 === 0;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// src/schema/zod-schema.ts
|
|
191
|
+
import { z as z2 } from "zod";
|
|
192
|
+
function toProviderJsonSchema(schema, options = {}) {
|
|
193
|
+
const jsonSchema = z2.toJSONSchema(schema, options);
|
|
194
|
+
const { $schema: _schema, ...providerSchema } = jsonSchema;
|
|
195
|
+
return providerSchema;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
export {
|
|
199
|
+
isJsonValue,
|
|
200
|
+
createMessageSchema,
|
|
201
|
+
messageSchema,
|
|
202
|
+
messagesSchema,
|
|
203
|
+
parseMessage,
|
|
204
|
+
parseMessages,
|
|
205
|
+
isMessage,
|
|
206
|
+
toProviderJsonSchema
|
|
207
|
+
};
|
|
208
|
+
//# sourceMappingURL=chunk-TIZYTPJO.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/completion/json.ts","../src/completion/message-schema.ts","../src/schema/zod-schema.ts"],"sourcesContent":["import type { JsonValue } from \"./types\";\n\nexport function isJsonValue(value: unknown): value is JsonValue {\n return isJsonValueWithAncestors(value, new WeakSet<object>());\n}\n\nfunction isJsonValueWithAncestors(value: unknown, ancestors: WeakSet<object>): value is JsonValue {\n if (value === null || typeof value === \"string\" || typeof value === \"boolean\") {\n return true;\n }\n if (typeof value === \"number\") {\n return Number.isFinite(value);\n }\n if (typeof value !== \"object\" || ancestors.has(value)) {\n return false;\n }\n\n ancestors.add(value);\n try {\n if (Array.isArray(value)) {\n if (!hasOnlyDenseArrayProperties(value)) {\n return false;\n }\n for (let index = 0; index < value.length; index += 1) {\n if (!isJsonValueWithAncestors(value[index], ancestors)) {\n return false;\n }\n }\n return true;\n }\n\n const prototype = Object.getPrototypeOf(value);\n if (prototype !== Object.prototype && prototype !== null) {\n return false;\n }\n for (const key of Reflect.ownKeys(value)) {\n if (typeof key !== \"string\") {\n return false;\n }\n const descriptor = Object.getOwnPropertyDescriptor(value, key);\n if (\n descriptor === undefined ||\n !descriptor.enumerable ||\n !(\"value\" in descriptor) ||\n !isJsonValueWithAncestors(descriptor.value, ancestors)\n ) {\n return false;\n }\n }\n return true;\n } catch {\n return false;\n } finally {\n ancestors.delete(value);\n }\n}\n\nfunction hasOnlyDenseArrayProperties(value: unknown[]): boolean {\n const keys = Reflect.ownKeys(value);\n if (keys.length !== value.length + 1 || keys.at(-1) !== \"length\") {\n return false;\n }\n for (let index = 0; index < value.length; index += 1) {\n const key = String(index);\n if (keys[index] !== key) {\n return false;\n }\n const descriptor = Object.getOwnPropertyDescriptor(value, key);\n if (descriptor === undefined || !descriptor.enumerable || !(\"value\" in descriptor)) {\n return false;\n }\n }\n return true;\n}\n","import { z } from \"zod\";\nimport { isJsonValue } from \"./json\";\nimport type { JsonObject, JsonValue, Message } from \"./types\";\n\nconst jsonValueSchema = z.custom<JsonValue>(isJsonValue, {\n message: \"Expected a strict JSON value\",\n});\n\nconst jsonObjectSchema = z.custom<JsonObject>(\n (value) =>\n typeof value === \"object\" && value !== null && !Array.isArray(value) && isJsonValue(value),\n { message: \"Expected a strict JSON object\" },\n);\n\nconst textPartSchema = z\n .object({\n type: z.literal(\"text\"),\n text: z.string(),\n signature: z.string().optional(),\n })\n .strict();\n\nconst urlDataSchema = z.object({ type: z.literal(\"url\"), url: z.url() }).strict();\nconst binaryDataSchema = z\n .object({\n type: z.literal(\"data\"),\n data: z.string().refine(isBase64, { message: \"Expected base64 data\" }),\n })\n .strict();\nconst textDataSchema = z.object({ type: z.literal(\"text\"), text: z.string() }).strict();\nconst fileDataSchema = z.union([urlDataSchema, binaryDataSchema, textDataSchema]);\nconst mediaTypeSchema = z.string().regex(/^[^\\s/]+\\/[^\\s/]+(?:\\s*;.*)?$/, \"Expected a media type\");\n\nconst imagePartSchema = z\n .object({\n type: z.literal(\"image\"),\n image: z.union([urlDataSchema, binaryDataSchema]),\n mediaType: mediaTypeSchema.optional(),\n detail: z.enum([\"auto\", \"low\", \"high\"]).optional(),\n })\n .strict();\n\nconst filePartSchema = z\n .object({\n type: z.literal(\"file\"),\n data: fileDataSchema,\n mediaType: mediaTypeSchema,\n filename: z.string().optional(),\n })\n .strict();\n\nconst reasoningDetailSchema = z.union([\n z\n .object({ type: z.literal(\"text\"), text: z.string(), signature: z.string().optional() })\n .strict(),\n z.object({ type: z.literal(\"summary\"), text: z.string() }).strict(),\n z.object({ type: z.literal(\"encrypted\"), data: z.string() }).strict(),\n z.object({ type: z.literal(\"redacted\"), data: z.string() }).strict(),\n]);\n\nconst reasoningPartSchema = z\n .object({\n type: z.literal(\"reasoning\"),\n text: z.string(),\n id: z.string().optional(),\n details: z.array(reasoningDetailSchema).optional(),\n })\n .strict();\n\nconst toolCallPartSchema = z\n .object({\n type: z.literal(\"tool-call\"),\n toolCallId: z.string().min(1),\n callId: z.string().optional(),\n toolName: z.string().min(1),\n input: jsonValueSchema,\n signature: z.string().optional(),\n })\n .strict();\n\nconst toolResultOutputSchema = z.union([\n z.object({ type: z.literal(\"text\"), value: z.string() }).strict(),\n z.object({ type: z.literal(\"json\"), value: jsonValueSchema }).strict(),\n z\n .object({\n type: z.literal(\"content\"),\n value: z.array(z.union([textPartSchema, filePartSchema])),\n })\n .strict(),\n z.object({ type: z.literal(\"execution-denied\"), reason: z.string().optional() }).strict(),\n z.object({ type: z.literal(\"error-text\"), value: z.string() }).strict(),\n z.object({ type: z.literal(\"error-json\"), value: jsonValueSchema }).strict(),\n]);\n\nconst toolResultPartSchema = z\n .object({\n type: z.literal(\"tool-result\"),\n toolCallId: z.string().min(1),\n callId: z.string().optional(),\n toolName: z.string().min(1),\n output: toolResultOutputSchema,\n })\n .strict();\n\nexport type MessageMetadataSchema<Metadata extends JsonObject> = z.ZodType<Metadata>;\n\nexport function createMessageSchema<Metadata extends JsonObject>(options: {\n metadataSchema: MessageMetadataSchema<Metadata>;\n}): z.ZodType<Message<Metadata>> {\n const metadata = options.metadataSchema.optional();\n const system = z.object({ role: z.literal(\"system\"), content: z.string(), metadata }).strict();\n const user = z\n .object({\n role: z.literal(\"user\"),\n content: z.union([\n z.string(),\n z.array(z.union([textPartSchema, imagePartSchema, filePartSchema])),\n ]),\n metadata,\n })\n .strict();\n const assistant = z\n .object({\n role: z.literal(\"assistant\"),\n id: z.string().optional(),\n content: z.union([\n z.string(),\n z.array(\n z.union([\n textPartSchema,\n imagePartSchema,\n filePartSchema,\n reasoningPartSchema,\n toolCallPartSchema,\n ]),\n ),\n ]),\n metadata,\n })\n .strict();\n const tool = z\n .object({ role: z.literal(\"tool\"), content: z.array(toolResultPartSchema), metadata })\n .strict();\n\n const message = z.union([system, user, assistant, tool]);\n return z\n .custom<z.input<typeof message>>(isJsonValue, { message: \"Expected a strict JSON message\" })\n .pipe(message)\n .refine(isJsonValue, { message: \"Expected a strict JSON message\" }) as unknown as z.ZodType<\n Message<Metadata>\n >;\n}\n\nexport const messageSchema = createMessageSchema({ metadataSchema: jsonObjectSchema });\nexport const messagesSchema = z.array(messageSchema);\n\nexport function parseMessage(value: unknown): Message {\n return messageSchema.parse(value);\n}\n\nexport function parseMessages(value: unknown): Message[] {\n return messagesSchema.parse(value);\n}\n\nexport function isMessage(value: unknown): value is Message {\n return messageSchema.safeParse(value).success;\n}\n\nfunction isBase64(value: string): boolean {\n if (!/^[A-Za-z0-9+/]*={0,2}$/.test(value)) return false;\n const firstPadding = value.indexOf(\"=\");\n if (firstPadding !== -1 && firstPadding < value.length - 2) return false;\n const rawLength = value.replace(/=+$/, \"\").length;\n if (rawLength % 4 === 1) return false;\n return firstPadding === -1 || value.length % 4 === 0;\n}\n","import { z } from \"zod\";\nimport type { JsonObject } from \"../completion/index\";\n\nexport type ZodSchema<T = unknown> = z.ZodType<T>;\n\nexport function toProviderJsonSchema(\n schema: z.ZodType,\n options: { io?: \"input\" | \"output\" } = {},\n): JsonObject {\n const jsonSchema = z.toJSONSchema(schema, options) as JsonObject;\n const { $schema: _schema, ...providerSchema } = jsonSchema;\n return providerSchema;\n}\n"],"mappings":";AAEO,SAAS,YAAY,OAAoC;AAC9D,SAAO,yBAAyB,OAAO,oBAAI,QAAgB,CAAC;AAC9D;AAEA,SAAS,yBAAyB,OAAgB,WAAgD;AAChG,MAAI,UAAU,QAAQ,OAAO,UAAU,YAAY,OAAO,UAAU,WAAW;AAC7E,WAAO;AAAA,EACT;AACA,MAAI,OAAO,UAAU,UAAU;AAC7B,WAAO,OAAO,SAAS,KAAK;AAAA,EAC9B;AACA,MAAI,OAAO,UAAU,YAAY,UAAU,IAAI,KAAK,GAAG;AACrD,WAAO;AAAA,EACT;AAEA,YAAU,IAAI,KAAK;AACnB,MAAI;AACF,QAAI,MAAM,QAAQ,KAAK,GAAG;AACxB,UAAI,CAAC,4BAA4B,KAAK,GAAG;AACvC,eAAO;AAAA,MACT;AACA,eAAS,QAAQ,GAAG,QAAQ,MAAM,QAAQ,SAAS,GAAG;AACpD,YAAI,CAAC,yBAAyB,MAAM,KAAK,GAAG,SAAS,GAAG;AACtD,iBAAO;AAAA,QACT;AAAA,MACF;AACA,aAAO;AAAA,IACT;AAEA,UAAM,YAAY,OAAO,eAAe,KAAK;AAC7C,QAAI,cAAc,OAAO,aAAa,cAAc,MAAM;AACxD,aAAO;AAAA,IACT;AACA,eAAW,OAAO,QAAQ,QAAQ,KAAK,GAAG;AACxC,UAAI,OAAO,QAAQ,UAAU;AAC3B,eAAO;AAAA,MACT;AACA,YAAM,aAAa,OAAO,yBAAyB,OAAO,GAAG;AAC7D,UACE,eAAe,UACf,CAAC,WAAW,cACZ,EAAE,WAAW,eACb,CAAC,yBAAyB,WAAW,OAAO,SAAS,GACrD;AACA,eAAO;AAAA,MACT;AAAA,IACF;AACA,WAAO;AAAA,EACT,QAAQ;AACN,WAAO;AAAA,EACT,UAAE;AACA,cAAU,OAAO,KAAK;AAAA,EACxB;AACF;AAEA,SAAS,4BAA4B,OAA2B;AAC9D,Q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AE,MAAM,aAAa;AAE5C,SAAS,aAAa,OAAyB;AACpD,SAAO,cAAc,MAAM,KAAK;AAClC;AAEO,SAAS,cAAc,OAA2B;AACvD,SAAO,eAAe,MAAM,KAAK;AACnC;AAEO,SAAS,UAAU,OAAkC;AAC1D,SAAO,cAAc,UAAU,KAAK,EAAE;AACxC;AAEA,SAAS,SAAS,OAAwB;AACxC,MAAI,CAAC,yBAAyB,KAAK,KAAK,EAAG,QAAO;AAClD,QAAM,eAAe,MAAM,QAAQ,GAAG;AACtC,MAAI,iBAAiB,MAAM,eAAe,MAAM,SAAS,EAAG,QAAO;AACnE,QAAM,YAAY,MAAM,QAAQ,OAAO,EAAE,EAAE;AAC3C,MAAI,YAAY,MAAM,EAAG,QAAO;AAChC,SAAO,iBAAiB,MAAM,MAAM,SAAS,MAAM;AACrD;;;AC/KA,SAAS,KAAAA,UAAS;AAKX,SAAS,qBACd,QACA,UAAuC,CAAC,GAC5B;AACZ,QAAM,aAAaA,GAAE,aAAa,QAAQ,OAAO;AACjD,QAAM,EAAE,SAAS,SAAS,GAAG,eAAe,IAAI;AAChD,SAAO;AACT;","names":["z"]}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
isRecord
|
|
3
|
-
} from "./chunk-CQNNSZPG.js";
|
|
4
1
|
import {
|
|
5
2
|
markSkillTool
|
|
6
3
|
} from "./chunk-YK4WAAS4.js";
|
|
4
|
+
import {
|
|
5
|
+
isRecord
|
|
6
|
+
} from "./chunk-CQNNSZPG.js";
|
|
7
7
|
import {
|
|
8
8
|
createTool
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-77AIYARB.js";
|
|
10
10
|
|
|
11
11
|
// src/skills/instructions.ts
|
|
12
12
|
function skillInstructions(skills) {
|
|
@@ -395,4 +395,4 @@ export {
|
|
|
395
395
|
SkillValidationError,
|
|
396
396
|
skill
|
|
397
397
|
};
|
|
398
|
-
//# sourceMappingURL=chunk-
|
|
398
|
+
//# sourceMappingURL=chunk-XKYYBABH.js.map
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { IOType } from 'node:child_process';
|
|
2
|
+
import { Stream } from 'node:stream';
|
|
3
|
+
import { OAuthClientProvider } from '@modelcontextprotocol/sdk/client/auth.js';
|
|
4
|
+
import { StreamableHTTPReconnectionOptions } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
|
|
5
|
+
import { Transport } from '@modelcontextprotocol/sdk/shared/transport.js';
|
|
6
|
+
import { J as JsonObject } from './types-CQ_ioXWK.js';
|
|
7
|
+
import { A as AnyTool } from './tool--Mz4v1eL.js';
|
|
8
|
+
|
|
9
|
+
type McpStdioTransport = {
|
|
10
|
+
readonly type: "stdio";
|
|
11
|
+
readonly command: string;
|
|
12
|
+
readonly args?: string[] | undefined;
|
|
13
|
+
readonly env?: Record<string, string> | undefined;
|
|
14
|
+
readonly cwd?: string | undefined;
|
|
15
|
+
readonly stderr?: IOType | Stream | number | undefined;
|
|
16
|
+
readonly maxBufferSize?: number | undefined;
|
|
17
|
+
};
|
|
18
|
+
type McpStreamableHttpTransport = {
|
|
19
|
+
readonly type: "streamableHttp";
|
|
20
|
+
readonly url: string | URL;
|
|
21
|
+
readonly requestInit?: RequestInit | undefined;
|
|
22
|
+
readonly authProvider?: OAuthClientProvider | undefined;
|
|
23
|
+
readonly reconnectionOptions?: StreamableHTTPReconnectionOptions | undefined;
|
|
24
|
+
readonly sessionId?: string | undefined;
|
|
25
|
+
};
|
|
26
|
+
type McpTransport = Transport;
|
|
27
|
+
type McpCustomTransport = {
|
|
28
|
+
readonly type: "custom";
|
|
29
|
+
readonly create: (options: {
|
|
30
|
+
abortSignal?: AbortSignal | undefined;
|
|
31
|
+
}) => McpTransport | Promise<McpTransport>;
|
|
32
|
+
};
|
|
33
|
+
type McpClientTransport = McpStdioTransport | McpStreamableHttpTransport | McpCustomTransport;
|
|
34
|
+
type McpClientOptions = {
|
|
35
|
+
readonly name: string;
|
|
36
|
+
readonly transport: McpClientTransport;
|
|
37
|
+
readonly tools?: {
|
|
38
|
+
readonly prefix?: string | undefined;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
type McpConnectOptions = {
|
|
42
|
+
readonly abortSignal?: AbortSignal | undefined;
|
|
43
|
+
};
|
|
44
|
+
type McpServerInfo = {
|
|
45
|
+
readonly name: string;
|
|
46
|
+
readonly version: string;
|
|
47
|
+
readonly title?: string | undefined;
|
|
48
|
+
readonly description?: string | undefined;
|
|
49
|
+
readonly websiteUrl?: string | undefined;
|
|
50
|
+
readonly icons?: readonly {
|
|
51
|
+
readonly src: string;
|
|
52
|
+
readonly mimeType?: string | undefined;
|
|
53
|
+
readonly sizes?: readonly string[] | undefined;
|
|
54
|
+
readonly theme?: "light" | "dark" | undefined;
|
|
55
|
+
}[];
|
|
56
|
+
};
|
|
57
|
+
type McpTool = AnyTool & {
|
|
58
|
+
readonly mcp: {
|
|
59
|
+
readonly serverName: string;
|
|
60
|
+
readonly remoteName: string;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
type McpServer = {
|
|
64
|
+
readonly name: string;
|
|
65
|
+
readonly tools: readonly McpTool[];
|
|
66
|
+
readonly serverInfo?: McpServerInfo | undefined;
|
|
67
|
+
readonly capabilities?: JsonObject | undefined;
|
|
68
|
+
readonly instructions?: string | undefined;
|
|
69
|
+
};
|
|
70
|
+
type McpClientGroupConnectOptions = {
|
|
71
|
+
readonly clients: readonly McpClient[];
|
|
72
|
+
readonly abortSignal?: AbortSignal | undefined;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
declare class McpClient {
|
|
76
|
+
#private;
|
|
77
|
+
readonly name: string;
|
|
78
|
+
constructor(options: McpClientOptions);
|
|
79
|
+
connect(options?: McpConnectOptions): Promise<McpServer>;
|
|
80
|
+
close(): Promise<void>;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export { McpClient as M, type McpServer as a, type McpClientGroupConnectOptions as b, type McpTool as c, type McpClientOptions as d, type McpClientTransport as e, type McpConnectOptions as f, type McpCustomTransport as g, type McpServerInfo as h, type McpStdioTransport as i, type McpStreamableHttpTransport as j, type McpTransport as k };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
import { D as Document, M as Message } from '../types-
|
|
4
|
-
export { A as
|
|
1
|
+
export { M as ModelCallOptions } from '../model-call-options-CZkSw_xN.js';
|
|
2
|
+
export { R as RetryContext, a as RetryOptions, b as RetrySetting } from '../retry-CjvSlKGW.js';
|
|
3
|
+
import { D as Document, M as Message } from '../types-CQ_ioXWK.js';
|
|
4
|
+
export { A as AssistantContentPart, a as AssistantGenerationMetadata, b as AssistantMessage, O as CompletionCapabilityError, C as CompletionModel, Q as CompletionModelCapabilities, c as CompletionModelInfo, d as CompletionModelStreamEvent, e as CompletionRequest, f as CompletionResponse, g as CompletionResult, h as CompletionSource, i as CompletionStreamEvent, V as CompletionStreamPart, j as CompletionTool, k as ContextUsage, F as FileData, l as FilePart, I as ImageDetail, m as ImagePart, J as JsonObject, n as JsonPrimitive, o as JsonValue, p as ModelContextLimits, P as ProviderTool, q as ProviderToolCall, R as ReasoningContentType, r as ReasoningDetail, s as ReasoningPart, W as StreamingCompletionModel, S as SystemMessage, T as TextPart, X as ToolCallArgumentsMode, t as ToolCallPart, u as ToolChoice, v as ToolDefinition, w as ToolMessage, x as ToolResultContentPart, y as ToolResultOutput, z as ToolResultPart, U as Usage, Y as UsageDetails, B as UserContentPart, E as UserMessage, Z as assertCompletionRequestSupported, G as calculateContextUsage, H as getAssistantGenerationMetadata, K as isProviderTool, _ as reasoningDisplayText, L as resolveModelContextLimits, $ as textFromAssistantContent, N as withContextUsage } from '../types-CQ_ioXWK.js';
|
|
5
|
+
export { C as CompletionBaseOptions, a as CompletionInput, G as GenerateCompletionOptions, b as GenerateStructuredCompletionOptions, M as MessageMetadataSchema, S as StreamCompletionOptions, c as StreamStructuredCompletionOptions, d as createMessageSchema, g as generateCompletion, i as isJsonValue, e as isMessage, j as isStreamingCompletionModel, m as messageSchema, f as messagesSchema, p as parseMessage, h as parseMessages, s as streamCompletion } from '../message-schema-Cn7ezRfJ.js';
|
|
5
6
|
import '../zod-schema-C7F4clpm.js';
|
|
6
7
|
import 'zod';
|
|
7
8
|
|
package/dist/completion/index.js
CHANGED
|
@@ -1,56 +1,53 @@
|
|
|
1
1
|
import {
|
|
2
2
|
formatDocument,
|
|
3
3
|
normalizeDocuments
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-MGNTXGTX.js";
|
|
5
5
|
import {
|
|
6
|
-
createCompletion,
|
|
7
|
-
createCompletionStream,
|
|
8
|
-
createParsedCompletion,
|
|
9
|
-
isStreamingCompletionModel
|
|
10
|
-
} from "../chunk-M3IOWB4Y.js";
|
|
11
|
-
import "../chunk-RFDVKCIE.js";
|
|
12
|
-
import {
|
|
13
|
-
AssistantContent,
|
|
14
6
|
CompletionCapabilityError,
|
|
15
|
-
Message,
|
|
16
|
-
ToolContent,
|
|
17
7
|
Usage,
|
|
18
|
-
UserContent,
|
|
19
8
|
assertCompletionRequestSupported,
|
|
20
9
|
calculateContextUsage,
|
|
10
|
+
generateCompletion,
|
|
21
11
|
getAssistantGenerationMetadata,
|
|
22
|
-
isJsonValue,
|
|
23
12
|
isProviderTool,
|
|
24
|
-
|
|
13
|
+
isStreamingCompletionModel,
|
|
25
14
|
reasoningDisplayText,
|
|
26
|
-
|
|
27
|
-
|
|
15
|
+
resolveModelContextLimits,
|
|
16
|
+
streamCompletion,
|
|
28
17
|
textFromAssistantContent,
|
|
29
18
|
withContextUsage
|
|
30
|
-
} from "../chunk-
|
|
31
|
-
import
|
|
19
|
+
} from "../chunk-KR3RCCHJ.js";
|
|
20
|
+
import {
|
|
21
|
+
createMessageSchema,
|
|
22
|
+
isJsonValue,
|
|
23
|
+
isMessage,
|
|
24
|
+
messageSchema,
|
|
25
|
+
messagesSchema,
|
|
26
|
+
parseMessage,
|
|
27
|
+
parseMessages
|
|
28
|
+
} from "../chunk-TIZYTPJO.js";
|
|
29
|
+
import "../chunk-FN7HLLAZ.js";
|
|
32
30
|
export {
|
|
33
|
-
AssistantContent,
|
|
34
31
|
CompletionCapabilityError,
|
|
35
|
-
Message,
|
|
36
|
-
ToolContent,
|
|
37
32
|
Usage,
|
|
38
|
-
UserContent,
|
|
39
33
|
assertCompletionRequestSupported,
|
|
40
34
|
calculateContextUsage,
|
|
41
|
-
|
|
42
|
-
createCompletionStream,
|
|
43
|
-
createParsedCompletion,
|
|
35
|
+
createMessageSchema,
|
|
44
36
|
formatDocument,
|
|
37
|
+
generateCompletion,
|
|
45
38
|
getAssistantGenerationMetadata,
|
|
46
39
|
isJsonValue,
|
|
40
|
+
isMessage,
|
|
47
41
|
isProviderTool,
|
|
48
42
|
isStreamingCompletionModel,
|
|
49
|
-
|
|
43
|
+
messageSchema,
|
|
44
|
+
messagesSchema,
|
|
50
45
|
normalizeDocuments,
|
|
46
|
+
parseMessage,
|
|
47
|
+
parseMessages,
|
|
51
48
|
reasoningDisplayText,
|
|
52
|
-
|
|
53
|
-
|
|
49
|
+
resolveModelContextLimits,
|
|
50
|
+
streamCompletion,
|
|
54
51
|
textFromAssistantContent,
|
|
55
52
|
withContextUsage
|
|
56
53
|
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { b as RetrySetting } from './retry-CjvSlKGW.js';
|
|
2
|
+
import { v as ToolDefinition } from './types-CQ_ioXWK.js';
|
|
3
|
+
import { V as VectorMetadata, E as EmbeddingModel, a as EmbeddedDocument } from './types-Cr4uiYo5.js';
|
|
4
|
+
import { A as AnyTool } from './tool--Mz4v1eL.js';
|
|
5
|
+
import { V as VectorFilter, a as VectorSearchResult, b as VectorInspectRequest, c as VectorInspectPage } from './types-Dld1TpWj.js';
|
|
5
6
|
|
|
6
7
|
type ToolSearchDocument<Metadata extends VectorMetadata = VectorMetadata> = {
|
|
7
8
|
toolName: string;
|
|
@@ -10,24 +11,35 @@ type ToolSearchDocument<Metadata extends VectorMetadata = VectorMetadata> = {
|
|
|
10
11
|
metadata?: Metadata | undefined;
|
|
11
12
|
};
|
|
12
13
|
type EmbedToolsOptions<Metadata extends VectorMetadata = VectorMetadata> = {
|
|
14
|
+
model: EmbeddingModel;
|
|
15
|
+
tools: readonly AnyTool[];
|
|
13
16
|
content?: ((tool: AnyTool, definition: ToolDefinition) => string | string[]) | undefined;
|
|
14
17
|
metadata?: ((tool: AnyTool, definition: ToolDefinition) => Metadata | undefined) | undefined;
|
|
15
18
|
concurrency?: number | undefined;
|
|
19
|
+
retries?: RetrySetting | undefined;
|
|
20
|
+
abortSignal?: AbortSignal | undefined;
|
|
16
21
|
};
|
|
17
22
|
type CreateToolIndexOptions<Metadata extends VectorMetadata = VectorMetadata> = EmbedToolsOptions<Metadata> & {
|
|
18
23
|
topK: number;
|
|
19
|
-
|
|
24
|
+
minScore?: number | undefined;
|
|
20
25
|
filter?: VectorFilter | undefined;
|
|
21
26
|
};
|
|
22
|
-
interface ToolIndex<Metadata extends VectorMetadata = VectorMetadata>
|
|
27
|
+
interface ToolIndex<Metadata extends VectorMetadata = VectorMetadata> {
|
|
23
28
|
readonly kind: "tool-index";
|
|
24
29
|
readonly tools: readonly AnyTool[];
|
|
25
30
|
readonly topK: number;
|
|
26
|
-
readonly
|
|
31
|
+
readonly minScore?: number | undefined;
|
|
27
32
|
readonly filter?: VectorFilter | undefined;
|
|
33
|
+
search(options: {
|
|
34
|
+
query: string;
|
|
35
|
+
abortSignal?: AbortSignal | undefined;
|
|
36
|
+
}): Promise<Array<VectorSearchResult<ToolSearchDocument<Metadata>, Metadata>>>;
|
|
37
|
+
inspect?(request: VectorInspectRequest): Promise<VectorInspectPage<ToolSearchDocument<Metadata>, Metadata>>;
|
|
28
38
|
}
|
|
29
|
-
declare function embedTools<Metadata extends VectorMetadata = VectorMetadata>(
|
|
30
|
-
|
|
39
|
+
declare function embedTools<Metadata extends VectorMetadata = VectorMetadata>(options: EmbedToolsOptions<Metadata>): Promise<{
|
|
40
|
+
documents: Array<EmbeddedDocument<ToolSearchDocument<Metadata>, Metadata>>;
|
|
41
|
+
}>;
|
|
42
|
+
declare function createToolIndex<Metadata extends VectorMetadata = VectorMetadata>(options: CreateToolIndexOptions<Metadata>): Promise<ToolIndex<Metadata>>;
|
|
31
43
|
declare function isToolIndex(value: unknown): value is ToolIndex;
|
|
32
44
|
|
|
33
45
|
export { type CreateToolIndexOptions as C, type EmbedToolsOptions as E, type ToolIndex as T, type ToolSearchDocument as a, createToolIndex as c, embedTools as e, isToolIndex as i };
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
export {
|
|
1
|
+
export { M as ModelCallOptions } from '../model-call-options-CZkSw_xN.js';
|
|
2
|
+
export { R as RetryContext, a as RetryOptions, b as RetrySetting } from '../retry-CjvSlKGW.js';
|
|
3
|
+
import { V as VectorMetadata, d as EmbedDocumentsOptions, e as EmbedDocumentsResult, f as EmbedHybridDocumentsOptions, g as EmbedSparseQueryOptions, h as EmbedSparseQueryResult, i as EmbedSparseTextsOptions, j as EmbedSparseTextsResult, k as EmbedTextOptions, l as EmbedTextResult, m as EmbedTextsOptions, n as EmbedTextsResult } from '../types-Cr4uiYo5.js';
|
|
4
|
+
export { o as EmbedDocumentsBaseOptions, a as EmbeddedDocument, p as Embedding, E as EmbeddingModel, q as EmbeddingOperationOptions, r as SparseEmbedding, c as SparseEmbeddingModel, S as SparseVector, b as VectorMetadataValue } from '../types-Cr4uiYo5.js';
|
|
3
5
|
|
|
4
6
|
declare function dotProduct(left: number[], right: number[]): number;
|
|
5
7
|
declare function cosineSimilarity(left: number[], right: number[]): number;
|
|
@@ -8,11 +10,11 @@ declare function euclideanDistance(left: number[], right: number[]): number;
|
|
|
8
10
|
declare function manhattanDistance(left: number[], right: number[]): number;
|
|
9
11
|
declare function chebyshevDistance(left: number[], right: number[]): number;
|
|
10
12
|
|
|
11
|
-
declare function embedText(
|
|
12
|
-
declare function embedTexts(
|
|
13
|
-
declare function embedSparseTexts(
|
|
14
|
-
declare function embedSparseQuery(
|
|
15
|
-
declare function embedDocuments<T, Metadata extends VectorMetadata = VectorMetadata>(
|
|
16
|
-
declare function
|
|
13
|
+
declare function embedText(options: EmbedTextOptions): Promise<EmbedTextResult>;
|
|
14
|
+
declare function embedTexts(options: EmbedTextsOptions): Promise<EmbedTextsResult>;
|
|
15
|
+
declare function embedSparseTexts(options: EmbedSparseTextsOptions): Promise<EmbedSparseTextsResult>;
|
|
16
|
+
declare function embedSparseQuery(options: EmbedSparseQueryOptions): Promise<EmbedSparseQueryResult>;
|
|
17
|
+
declare function embedDocuments<T, Metadata extends VectorMetadata = VectorMetadata>(options: EmbedDocumentsOptions<T, Metadata>): Promise<EmbedDocumentsResult<T, Metadata>>;
|
|
18
|
+
declare function embedDocuments<T, Metadata extends VectorMetadata = VectorMetadata>(options: EmbedHybridDocumentsOptions<T, Metadata>): Promise<EmbedDocumentsResult<T, Metadata>>;
|
|
17
19
|
|
|
18
|
-
export { EmbedDocumentsOptions, EmbedHybridDocumentsOptions,
|
|
20
|
+
export { EmbedDocumentsOptions, EmbedDocumentsResult, EmbedHybridDocumentsOptions, EmbedSparseQueryOptions, EmbedSparseQueryResult, EmbedSparseTextsOptions, EmbedSparseTextsResult, EmbedTextOptions, EmbedTextResult, EmbedTextsOptions, EmbedTextsResult, VectorMetadata, angularDistance, chebyshevDistance, cosineSimilarity, dotProduct, embedDocuments, embedSparseQuery, embedSparseTexts, embedText, embedTexts, euclideanDistance, manhattanDistance };
|
package/dist/embeddings/index.js
CHANGED
|
@@ -4,21 +4,20 @@ import {
|
|
|
4
4
|
cosineSimilarity,
|
|
5
5
|
dotProduct,
|
|
6
6
|
embedDocuments,
|
|
7
|
-
embedHybridDocuments,
|
|
8
7
|
embedSparseQuery,
|
|
9
8
|
embedSparseTexts,
|
|
10
9
|
embedText,
|
|
11
10
|
embedTexts,
|
|
12
11
|
euclideanDistance,
|
|
13
12
|
manhattanDistance
|
|
14
|
-
} from "../chunk-
|
|
13
|
+
} from "../chunk-FMHLROPQ.js";
|
|
14
|
+
import "../chunk-FN7HLLAZ.js";
|
|
15
15
|
export {
|
|
16
16
|
angularDistance,
|
|
17
17
|
chebyshevDistance,
|
|
18
18
|
cosineSimilarity,
|
|
19
19
|
dotProduct,
|
|
20
20
|
embedDocuments,
|
|
21
|
-
embedHybridDocuments,
|
|
22
21
|
embedSparseQuery,
|
|
23
22
|
embedSparseTexts,
|
|
24
23
|
embedText,
|