@providerkit/core 0.30.0 → 0.32.0
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 +101 -5
- package/THIRD_PARTY_NOTICES +144 -0
- package/dist/auth/chatgpt-models.js.map +1 -1
- package/dist/auth/oauth.d.ts.map +1 -1
- package/dist/auth/oauth.js.map +1 -1
- package/dist/capability.js.map +1 -1
- package/dist/context.d.ts +4 -3
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +19 -5
- package/dist/context.js.map +1 -1
- package/dist/decisions.js.map +1 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js.map +1 -1
- package/dist/fallback.d.ts +3 -0
- package/dist/fallback.d.ts.map +1 -1
- package/dist/fallback.js +9 -5
- package/dist/fallback.js.map +1 -1
- package/dist/gate.js.map +1 -1
- package/dist/hosted/anthropic.d.ts +30 -0
- package/dist/hosted/anthropic.d.ts.map +1 -0
- package/dist/hosted/anthropic.js +465 -0
- package/dist/hosted/anthropic.js.map +1 -0
- package/dist/hosted/gemini.d.ts +22 -0
- package/dist/hosted/gemini.d.ts.map +1 -0
- package/dist/hosted/gemini.js +440 -0
- package/dist/hosted/gemini.js.map +1 -0
- package/dist/hosted/openai.d.ts +33 -0
- package/dist/hosted/openai.d.ts.map +1 -0
- package/dist/hosted/openai.js +107 -0
- package/dist/hosted/openai.js.map +1 -0
- package/dist/hosted/responses.d.ts +28 -0
- package/dist/hosted/responses.d.ts.map +1 -0
- package/dist/hosted/responses.js +358 -0
- package/dist/hosted/responses.js.map +1 -0
- package/dist/hosted/shared.d.ts +107 -0
- package/dist/hosted/shared.d.ts.map +1 -0
- package/dist/hosted/shared.js +264 -0
- package/dist/hosted/shared.js.map +1 -0
- package/dist/hosted/types.d.ts +191 -0
- package/dist/hosted/types.d.ts.map +1 -0
- package/dist/hosted/types.js +10 -0
- package/dist/hosted/types.js.map +1 -0
- package/dist/hosted.d.ts +33 -0
- package/dist/hosted.d.ts.map +1 -0
- package/dist/hosted.js +61 -0
- package/dist/hosted.js.map +1 -0
- package/dist/index.d.ts +8 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -7
- package/dist/index.js.map +1 -1
- package/dist/key-pool.d.ts.map +1 -1
- package/dist/key-pool.js.map +1 -1
- package/dist/otel.d.ts +26 -0
- package/dist/otel.d.ts.map +1 -0
- package/dist/otel.js +263 -0
- package/dist/otel.js.map +1 -0
- package/dist/presets.d.ts +2 -2
- package/dist/presets.d.ts.map +1 -1
- package/dist/providers/anthropic.d.ts +75 -1
- package/dist/providers/anthropic.d.ts.map +1 -1
- package/dist/providers/anthropic.js +207 -135
- package/dist/providers/anthropic.js.map +1 -1
- package/dist/providers/factory.d.ts +10 -0
- package/dist/providers/factory.d.ts.map +1 -1
- package/dist/providers/factory.js +31 -23
- package/dist/providers/factory.js.map +1 -1
- package/dist/providers/gemini.d.ts +123 -1
- package/dist/providers/gemini.d.ts.map +1 -1
- package/dist/providers/gemini.js +114 -54
- package/dist/providers/gemini.js.map +1 -1
- package/dist/providers/hosted-codecs.d.ts +10 -0
- package/dist/providers/hosted-codecs.d.ts.map +1 -0
- package/dist/providers/hosted-codecs.js +8 -0
- package/dist/providers/hosted-codecs.js.map +1 -0
- package/dist/providers/openai.d.ts +69 -0
- package/dist/providers/openai.d.ts.map +1 -1
- package/dist/providers/openai.js +38 -14
- package/dist/providers/openai.js.map +1 -1
- package/dist/providers/responses.d.ts +123 -0
- package/dist/providers/responses.d.ts.map +1 -1
- package/dist/providers/responses.js +57 -22
- package/dist/providers/responses.js.map +1 -1
- package/dist/providers/speech-factory.js.map +1 -1
- package/dist/registry.d.ts +3 -0
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +8 -4
- package/dist/registry.js.map +1 -1
- package/dist/retry.js.map +1 -1
- package/dist/speech-core.d.ts.map +1 -1
- package/dist/speech-core.js.map +1 -1
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js.map +1 -1
- package/dist/transcription-core.d.ts.map +1 -1
- package/dist/transcription-core.js.map +1 -1
- package/dist/transport.js.map +1 -1
- package/dist/turn.d.ts +10 -1
- package/dist/turn.d.ts.map +1 -1
- package/dist/turn.js +53 -1
- package/dist/turn.js.map +1 -1
- package/dist/types.d.ts +51 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/usage.d.ts +10 -1
- package/dist/usage.d.ts.map +1 -1
- package/dist/usage.js +40 -2
- package/dist/usage.js.map +1 -1
- package/dist/watchdog.d.ts +6 -0
- package/dist/watchdog.d.ts.map +1 -1
- package/dist/watchdog.js +10 -2
- package/dist/watchdog.js.map +1 -1
- package/package.json +19 -5
- package/src/context.ts +21 -5
- package/src/fallback.ts +21 -6
- package/src/hosted/anthropic.ts +512 -0
- package/src/hosted/gemini.ts +510 -0
- package/src/hosted/openai.ts +137 -0
- package/src/hosted/responses.ts +420 -0
- package/src/hosted/shared.ts +341 -0
- package/src/hosted/types.ts +214 -0
- package/src/hosted.ts +101 -0
- package/src/index.ts +64 -7
- package/src/otel.ts +306 -0
- package/src/providers/anthropic.ts +252 -143
- package/src/providers/factory.ts +127 -82
- package/src/providers/gemini.ts +184 -60
- package/src/providers/hosted-codecs.ts +29 -0
- package/src/providers/openai.ts +52 -15
- package/src/providers/responses.ts +93 -24
- package/src/registry.ts +14 -4
- package/src/turn.ts +55 -1
- package/src/types.ts +62 -1
- package/src/usage.ts +32 -2
- package/src/watchdog.ts +12 -2
- package/dist/jev.d.ts +0 -123
- package/dist/jev.d.ts.map +0 -1
- package/dist/jev.js +0 -278
- package/dist/jev.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"responses.d.ts","sourceRoot":"","sources":["../../src/hosted/responses.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAKV,UAAU,EAEX,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAiB,MAAM,2BAA2B,CAAC;AAChG,OAAO,KAAK,EAAa,aAAa,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAmL3E,gEAAgE;AAChE,MAAM,WAAW,mBAAmB;IAClC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AA+DD,eAAO,MAAM,eAAe;iBACb,eAAe,WAAW,MAAM,MAAM,MAAM,QAAQ,aAAa;;;;;mBAwB/D,UAAU,EAAE;QAgCtB,KAAK,QAAQ,cAAc,GAAG,SAAS,CAAC,aAAa,CAAC;QAqFvD,KAAK,QA5FkB,SAAS,CAAC,aAAa,CAAC;QA6F/C,MAAM;;CAGX,CAAC"}
|
|
@@ -0,0 +1,358 @@
|
|
|
1
|
+
// Hosted shapes and annotations follow Vercel AI SDK (Apache-2.0) and
|
|
2
|
+
// PydanticAI (MIT). See THIRD_PARTY_NOTICES.
|
|
3
|
+
import { ProviderError } from "../errors.js";
|
|
4
|
+
import { codePointIndex, hostedCounts, HostedRecorder, planHostedTools, queryInput, servedAt, } from "./shared.js";
|
|
5
|
+
/** The hosted types this wire has a shape for, and the fields it applies. No
|
|
6
|
+
* use cap on web search, and no fetch tool, on this wire. */
|
|
7
|
+
const RESPONSES_FIELDS = {
|
|
8
|
+
web_search: ["allowedDomains", "blockedDomains", "userLocation"],
|
|
9
|
+
code_execution: ["fileIds"],
|
|
10
|
+
file_search: ["storeIds", "maxResults"],
|
|
11
|
+
image_generation: ["size", "quality", "format", "background"],
|
|
12
|
+
};
|
|
13
|
+
const RESPONSES_SENDS = Object.keys(RESPONSES_FIELDS);
|
|
14
|
+
/** The output each hosted tool needs asked for by name, or it comes back
|
|
15
|
+
* without its sources, logs or results. */
|
|
16
|
+
const RESPONSES_INCLUDES = {
|
|
17
|
+
web_search: "web_search_call.action.sources",
|
|
18
|
+
code_execution: "code_interpreter_call.outputs",
|
|
19
|
+
file_search: "file_search_call.results",
|
|
20
|
+
};
|
|
21
|
+
/** One hosted tool on the wire. Shapes from Vercel's AI SDK (Apache-2.0),
|
|
22
|
+
* openai-responses-prepare-tools.ts:238-381. */
|
|
23
|
+
function responsesHostedTool(provider, tool) {
|
|
24
|
+
switch (tool.type) {
|
|
25
|
+
case "web_search":
|
|
26
|
+
return {
|
|
27
|
+
type: "web_search",
|
|
28
|
+
...(tool.allowedDomains || tool.blockedDomains
|
|
29
|
+
? {
|
|
30
|
+
filters: {
|
|
31
|
+
allowed_domains: tool.allowedDomains,
|
|
32
|
+
blocked_domains: tool.blockedDomains,
|
|
33
|
+
},
|
|
34
|
+
}
|
|
35
|
+
: {}),
|
|
36
|
+
...(tool.userLocation
|
|
37
|
+
? { user_location: { type: "approximate", ...tool.userLocation } }
|
|
38
|
+
: {}),
|
|
39
|
+
};
|
|
40
|
+
case "code_execution":
|
|
41
|
+
return { type: "code_interpreter", container: { type: "auto", file_ids: tool.fileIds } };
|
|
42
|
+
case "file_search":
|
|
43
|
+
return {
|
|
44
|
+
type: "file_search",
|
|
45
|
+
vector_store_ids: tool.storeIds,
|
|
46
|
+
max_num_results: tool.maxResults,
|
|
47
|
+
};
|
|
48
|
+
case "image_generation":
|
|
49
|
+
return {
|
|
50
|
+
type: "image_generation",
|
|
51
|
+
size: tool.size,
|
|
52
|
+
quality: tool.quality,
|
|
53
|
+
output_format: tool.format,
|
|
54
|
+
background: tool.background,
|
|
55
|
+
};
|
|
56
|
+
default:
|
|
57
|
+
// planHostedTools only passes the types in RESPONSES_FIELDS.
|
|
58
|
+
throw new ProviderError(provider, "invalid", `${provider}: no Responses shape for ${tool.type}`);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
/** The seam's type for a hosted output item, or undefined for any other item. */
|
|
62
|
+
const HOSTED_ITEMS = {
|
|
63
|
+
web_search_call: "web_search",
|
|
64
|
+
code_interpreter_call: "code_execution",
|
|
65
|
+
file_search_call: "file_search",
|
|
66
|
+
image_generation_call: "image_generation",
|
|
67
|
+
};
|
|
68
|
+
/** A generated image's media type, read off its first bytes: the format the
|
|
69
|
+
* request asked for is a wish, the bytes are the image. */
|
|
70
|
+
function imageType(base64, asked) {
|
|
71
|
+
if (base64.startsWith("iVBORw0KGgo"))
|
|
72
|
+
return "image/png";
|
|
73
|
+
if (base64.startsWith("/9j/"))
|
|
74
|
+
return "image/jpeg";
|
|
75
|
+
if (base64.startsWith("UklGR"))
|
|
76
|
+
return "image/webp";
|
|
77
|
+
if (base64.startsWith("R0lGOD"))
|
|
78
|
+
return "image/gif";
|
|
79
|
+
// ponytail: unrecognized bytes fall back to the format asked for, PNG by
|
|
80
|
+
// default, which is the API's own default. Upgrade: refuse them.
|
|
81
|
+
switch (asked?.type === "image_generation" ? asked.format : undefined) {
|
|
82
|
+
case "jpeg":
|
|
83
|
+
return "image/jpeg";
|
|
84
|
+
case "webp":
|
|
85
|
+
return "image/webp";
|
|
86
|
+
default:
|
|
87
|
+
return "image/png";
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
/** What a web search did, from its `action`: the queries it ran, or the page
|
|
91
|
+
* it opened or searched within. */
|
|
92
|
+
function webSearchInput(action) {
|
|
93
|
+
if (action?.type === "search")
|
|
94
|
+
return queryInput(action.queries ?? [action.query]);
|
|
95
|
+
return action?.url ? { url: action.url } : undefined;
|
|
96
|
+
}
|
|
97
|
+
/** What a hosted item says it did. `.added` states only its id and type;
|
|
98
|
+
* `.done` states the whole call. A status other than `completed` on `.done`
|
|
99
|
+
* is a failed call, kept as data (invariant 7). */
|
|
100
|
+
function hostedItemDelta(item, done, asked) {
|
|
101
|
+
const failed = done && item.status !== undefined && item.status !== "completed";
|
|
102
|
+
let status = "running";
|
|
103
|
+
if (failed)
|
|
104
|
+
status = "failed";
|
|
105
|
+
else if (done)
|
|
106
|
+
status = "completed";
|
|
107
|
+
const error = failed ? (item.error?.code ?? item.error?.message ?? item.status) : undefined;
|
|
108
|
+
const base = { status, ...(error ? { error } : {}) };
|
|
109
|
+
switch (item.type) {
|
|
110
|
+
case "web_search_call": {
|
|
111
|
+
const action = item.action;
|
|
112
|
+
const input = webSearchInput(action);
|
|
113
|
+
const sources = (action?.sources ?? []).flatMap((source) => source.type === "url" && source.url ? [{ type: "url", url: source.url }] : []);
|
|
114
|
+
return {
|
|
115
|
+
...base,
|
|
116
|
+
...(input && Object.keys(input).length > 0 ? { input } : {}),
|
|
117
|
+
...(done && sources.length > 0 ? { output: { sources } } : {}),
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
case "code_interpreter_call": {
|
|
121
|
+
const logs = (item.outputs ?? []).flatMap((out) => out.type === "logs" && out.logs ? [out.logs] : []);
|
|
122
|
+
const files = (item.outputs ?? []).flatMap((out) => out.type === "image" && out.url
|
|
123
|
+
? [{ url: out.url, ...(item.container_id ? { containerId: item.container_id } : {}) }]
|
|
124
|
+
: []);
|
|
125
|
+
return {
|
|
126
|
+
...base,
|
|
127
|
+
input: { ...(item.code ? { code: item.code } : {}), language: "python" },
|
|
128
|
+
...(done && (logs.length > 0 || files.length > 0)
|
|
129
|
+
? {
|
|
130
|
+
output: {
|
|
131
|
+
...(logs.length > 0 ? { stdout: logs.join("\n") } : {}),
|
|
132
|
+
...(files.length > 0 ? { files } : {}),
|
|
133
|
+
},
|
|
134
|
+
}
|
|
135
|
+
: {}),
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
case "file_search_call": {
|
|
139
|
+
const input = queryInput(item.queries ?? []);
|
|
140
|
+
const sources = (item.results ?? []).map((result) => ({
|
|
141
|
+
type: "file",
|
|
142
|
+
...(result.file_id ? { fileId: result.file_id } : {}),
|
|
143
|
+
...(result.filename ? { title: result.filename } : {}),
|
|
144
|
+
...(result.text ? { excerpt: result.text } : {}),
|
|
145
|
+
}));
|
|
146
|
+
return {
|
|
147
|
+
...base,
|
|
148
|
+
...(Object.keys(input).length > 0 ? { input } : {}),
|
|
149
|
+
...(done && sources.length > 0 ? { output: { sources } } : {}),
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
default: {
|
|
153
|
+
const image = done && item.result ? item.result : undefined;
|
|
154
|
+
return {
|
|
155
|
+
...base,
|
|
156
|
+
...(item.revised_prompt ? { input: { prompt: item.revised_prompt } } : {}),
|
|
157
|
+
...(image
|
|
158
|
+
? {
|
|
159
|
+
output: {
|
|
160
|
+
images: [{ type: "image", mimeType: imageType(image, asked), data: image }],
|
|
161
|
+
},
|
|
162
|
+
}
|
|
163
|
+
: {}),
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* One annotation as a citation, its offsets moved from the part's code points
|
|
170
|
+
* to the turn's JS indices. A URL citation selects the link the model wrote,
|
|
171
|
+
* so its span is kept only while it still contains the URL (PydanticAI, MIT,
|
|
172
|
+
* openai/_citations.py:112-118); a span that doesn't check out is dropped and
|
|
173
|
+
* the source kept. Mapping from Vercel's AI SDK (Apache-2.0),
|
|
174
|
+
* map-openai-responses-annotation.ts:11-74.
|
|
175
|
+
*/
|
|
176
|
+
function annotationCitation(annotation, text, part) {
|
|
177
|
+
const partText = part ? text.slice(part.start, part.end) : "";
|
|
178
|
+
const at = (points) => part && points !== undefined ? codePointIndex(partText, points) : undefined;
|
|
179
|
+
const span = (start, end, contains) => part &&
|
|
180
|
+
start !== undefined &&
|
|
181
|
+
end !== undefined &&
|
|
182
|
+
start < end &&
|
|
183
|
+
(contains === undefined || partText.slice(start, end).includes(contains))
|
|
184
|
+
? { start: part.start + start, end: part.start + end, anchor: "marker" }
|
|
185
|
+
: {};
|
|
186
|
+
switch (annotation.type) {
|
|
187
|
+
case "url_citation": {
|
|
188
|
+
if (!annotation.url)
|
|
189
|
+
return undefined;
|
|
190
|
+
const source = {
|
|
191
|
+
type: "url",
|
|
192
|
+
url: annotation.url,
|
|
193
|
+
...(annotation.title ? { title: annotation.title } : {}),
|
|
194
|
+
};
|
|
195
|
+
return {
|
|
196
|
+
source,
|
|
197
|
+
...span(at(annotation.start_index), at(annotation.end_index), annotation.url),
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
case "file_citation":
|
|
201
|
+
case "container_file_citation": {
|
|
202
|
+
if (!annotation.file_id && !annotation.filename)
|
|
203
|
+
return undefined;
|
|
204
|
+
const source = {
|
|
205
|
+
type: "file",
|
|
206
|
+
...(annotation.file_id ? { fileId: annotation.file_id } : {}),
|
|
207
|
+
...(annotation.filename ? { title: annotation.filename } : {}),
|
|
208
|
+
...(annotation.container_id ? { containerId: annotation.container_id } : {}),
|
|
209
|
+
};
|
|
210
|
+
// A file citation marks one point, where the model referred to the file.
|
|
211
|
+
const point = at(annotation.index);
|
|
212
|
+
if (annotation.type === "file_citation") {
|
|
213
|
+
return point === undefined || !part
|
|
214
|
+
? { source }
|
|
215
|
+
: { source, start: part.start + point, end: part.start + point, anchor: "marker" };
|
|
216
|
+
}
|
|
217
|
+
return { source, ...span(at(annotation.start_index), at(annotation.end_index)) };
|
|
218
|
+
}
|
|
219
|
+
default:
|
|
220
|
+
// `file_path` names a file code wrote, not a source of the answer.
|
|
221
|
+
return undefined;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
export const responsesHosted = {
|
|
225
|
+
plan(config, baseUrl, id, opts) {
|
|
226
|
+
const hosted = planHostedTools(id, {
|
|
227
|
+
name: "Responses",
|
|
228
|
+
serves: (config.servesHostedTools ??
|
|
229
|
+
servedAt(baseUrl, "api.openai.com", [
|
|
230
|
+
"web_search",
|
|
231
|
+
"code_execution",
|
|
232
|
+
"file_search",
|
|
233
|
+
"image_generation",
|
|
234
|
+
])).filter((type) => RESPONSES_SENDS.includes(type)),
|
|
235
|
+
fields: RESPONSES_FIELDS,
|
|
236
|
+
}, opts);
|
|
237
|
+
return {
|
|
238
|
+
hosted,
|
|
239
|
+
tools: hosted.map((tool) => responsesHostedTool(id, tool)),
|
|
240
|
+
include: hosted.flatMap((tool) => RESPONSES_INCLUDES[tool.type] ?? []),
|
|
241
|
+
};
|
|
242
|
+
},
|
|
243
|
+
stream(hosted) {
|
|
244
|
+
// Hosted calls, by item id. The answer so far, and where each part of it
|
|
245
|
+
// starts, so an annotation's offsets can be placed and checked.
|
|
246
|
+
const recorder = new HostedRecorder();
|
|
247
|
+
let text = "";
|
|
248
|
+
const parts = new Map();
|
|
249
|
+
// Waiting annotations, by the message item they belong to.
|
|
250
|
+
const annotations = new Map();
|
|
251
|
+
const partKey = (event) => `${event.item_id ?? ""}:${event.content_index ?? 0}`;
|
|
252
|
+
const asked = (type) => hosted.find((tool) => tool.type === type);
|
|
253
|
+
// An annotation is placed once its part is whole: when its message item
|
|
254
|
+
// ends, or, for every item still waiting, when the turn does.
|
|
255
|
+
function* cite(item) {
|
|
256
|
+
const due = item === undefined ? [...annotations.values()].flat() : (annotations.get(item) ?? []);
|
|
257
|
+
if (item === undefined)
|
|
258
|
+
annotations.clear();
|
|
259
|
+
else
|
|
260
|
+
annotations.delete(item);
|
|
261
|
+
const citations = due.flatMap(({ part, annotation }) => {
|
|
262
|
+
const citation = annotationCitation(annotation, text, parts.get(part));
|
|
263
|
+
return citation ? [citation] : [];
|
|
264
|
+
});
|
|
265
|
+
if (citations.length > 0)
|
|
266
|
+
yield { type: "delta", citations };
|
|
267
|
+
}
|
|
268
|
+
// The end of the turn: a hosted call the backend never finished fails,
|
|
269
|
+
// and every annotation still waiting is placed.
|
|
270
|
+
function* closeHosted() {
|
|
271
|
+
const failed = recorder.settle();
|
|
272
|
+
if (failed.length > 0)
|
|
273
|
+
yield { type: "delta", hosted: failed };
|
|
274
|
+
yield* cite();
|
|
275
|
+
}
|
|
276
|
+
return {
|
|
277
|
+
*event(event) {
|
|
278
|
+
// Every step a hosted call reports (in progress, searching,
|
|
279
|
+
// interpreting, generating) goes out as a status delta: progress the
|
|
280
|
+
// watchdog's progress clock can see while the vendor's tool works.
|
|
281
|
+
if (/^response\.(web_search|file_search|code_interpreter|image_generation)_call\.\w+$/.test(event.type ?? "")) {
|
|
282
|
+
const index = recorder.indexOf(event.item_id);
|
|
283
|
+
if (index !== undefined)
|
|
284
|
+
yield { type: "delta", hosted: [{ index, status: "running" }] };
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
switch (event.type) {
|
|
288
|
+
case "response.output_text.delta":
|
|
289
|
+
if (event.delta) {
|
|
290
|
+
const key = partKey(event);
|
|
291
|
+
const part = parts.get(key) ?? { start: text.length, end: text.length };
|
|
292
|
+
text += event.delta;
|
|
293
|
+
part.end = text.length;
|
|
294
|
+
parts.set(key, part);
|
|
295
|
+
}
|
|
296
|
+
break;
|
|
297
|
+
case "response.output_text.annotation.added":
|
|
298
|
+
if (event.annotation) {
|
|
299
|
+
const item = event.item_id ?? "";
|
|
300
|
+
const waiting = annotations.get(item) ?? [];
|
|
301
|
+
waiting.push({ part: partKey(event), annotation: event.annotation });
|
|
302
|
+
annotations.set(item, waiting);
|
|
303
|
+
}
|
|
304
|
+
break;
|
|
305
|
+
case "response.code_interpreter_call_code.delta": {
|
|
306
|
+
const index = recorder.indexOf(event.item_id);
|
|
307
|
+
if (index !== undefined && event.delta) {
|
|
308
|
+
yield { type: "delta", hosted: [{ index, codeDelta: event.delta }] };
|
|
309
|
+
}
|
|
310
|
+
break;
|
|
311
|
+
}
|
|
312
|
+
// The whole program, which wins over the deltas it repeats.
|
|
313
|
+
case "response.code_interpreter_call_code.done": {
|
|
314
|
+
const index = recorder.indexOf(event.item_id);
|
|
315
|
+
if (index !== undefined && event.code !== undefined) {
|
|
316
|
+
yield { type: "delta", hosted: [{ index, input: { code: event.code } }] };
|
|
317
|
+
}
|
|
318
|
+
break;
|
|
319
|
+
}
|
|
320
|
+
case "response.output_item.added": {
|
|
321
|
+
const item = event.item;
|
|
322
|
+
const type = item?.type ? HOSTED_ITEMS[item.type] : undefined;
|
|
323
|
+
if (item && type) {
|
|
324
|
+
// A hosted call, never a function call: no tool for the loop to
|
|
325
|
+
// run, and no part in the finish reason.
|
|
326
|
+
const started = recorder.start(item.id, type, text.length);
|
|
327
|
+
yield {
|
|
328
|
+
type: "delta",
|
|
329
|
+
hosted: [{ ...started, ...hostedItemDelta(item, false, asked(type)) }],
|
|
330
|
+
};
|
|
331
|
+
break;
|
|
332
|
+
}
|
|
333
|
+
break;
|
|
334
|
+
}
|
|
335
|
+
case "response.output_item.done": {
|
|
336
|
+
const item = event.item;
|
|
337
|
+
const type = item?.type ? HOSTED_ITEMS[item.type] : undefined;
|
|
338
|
+
if (item && type) {
|
|
339
|
+
const delta = hostedItemDelta(item, true, asked(type));
|
|
340
|
+
// A backend that sends only the finished item still ran it.
|
|
341
|
+
const done = recorder.end(item.id, delta) ?? recorder.whole(item.id, type, text.length, delta);
|
|
342
|
+
yield { type: "delta", hosted: [done] };
|
|
343
|
+
break;
|
|
344
|
+
}
|
|
345
|
+
if (item?.type === "message") {
|
|
346
|
+
yield* cite(item.id);
|
|
347
|
+
break;
|
|
348
|
+
}
|
|
349
|
+
break;
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
},
|
|
353
|
+
close: closeHosted,
|
|
354
|
+
counts: () => hostedCounts(recorder.shown()),
|
|
355
|
+
};
|
|
356
|
+
},
|
|
357
|
+
};
|
|
358
|
+
//# sourceMappingURL=responses.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"responses.js","sourceRoot":"","sources":["../../src/hosted/responses.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,6CAA6C;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EACL,cAAc,EACd,YAAY,EACZ,cAAc,EACd,eAAe,EACf,UAAU,EACV,QAAQ,GACT,MAAM,aAAa,CAAC;A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AM,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;SAC7C,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import type { HostedToolType, HostedTool, HostedWire, HostedInput, HostedCallDelta } from "./types.ts";
|
|
2
|
+
export * from "./types.ts";
|
|
3
|
+
import { ProviderError } from "../errors.ts";
|
|
4
|
+
import type { ChatMessage, StreamOptions, ToolCall } from "../types.ts";
|
|
5
|
+
/**
|
|
6
|
+
* A hosted tool the wire can't send. Refused, never dropped: see the module
|
|
7
|
+
* comment. `wire` names the adapter, because `provider` is often a gateway's id.
|
|
8
|
+
*/
|
|
9
|
+
export declare function hostedRefused(provider: string, wire: string, tool: HostedToolType, why: string): ProviderError;
|
|
10
|
+
/**
|
|
11
|
+
* The hosted tools one request sends: each tool the caller asked for that this
|
|
12
|
+
* wire can send with every field it set. One it can't is refused with an
|
|
13
|
+
* `invalid` error before any request, unless it is `optional`, which drops it.
|
|
14
|
+
*
|
|
15
|
+
* `toolChoice: "none"` sends none, on every wire. A forced choice (`required`
|
|
16
|
+
* or a named tool) with hosted tools is refused: Anthropic's `any` and
|
|
17
|
+
* Responses' `required` can be met by a vendor tool, Gemini's `ANY` cannot, so
|
|
18
|
+
* the pair has no one meaning. A type listed twice is refused everywhere.
|
|
19
|
+
*
|
|
20
|
+
* Ported from PydanticAI (MIT, Pydantic Services Inc.): the refusal rule and
|
|
21
|
+
* `optional`, models/__init__.py:4080-4130 and native_tools/__init__.py:155-207.
|
|
22
|
+
*/
|
|
23
|
+
export declare function planHostedTools(provider: string, wire: HostedWire, opts: Pick<StreamOptions, "hostedTools" | "toolChoice">): HostedTool[];
|
|
24
|
+
/** The types an endpoint runs when its config doesn't say: the vendor's own API
|
|
25
|
+
* host runs its documented set, and every other host none. A gateway that
|
|
26
|
+
* ignores an unknown tool answers unsearched and says nothing, so a host runs
|
|
27
|
+
* hosted tools only once someone has measured it (`servesHostedTools`). */
|
|
28
|
+
export declare function servedAt(baseUrl: string, host: string, types: readonly HostedToolType[]): readonly HostedToolType[];
|
|
29
|
+
/** A search's input: one query as `query`, several as `queries`, so a reader
|
|
30
|
+
* that shows one string finds it in the same place on every wire. */
|
|
31
|
+
export declare function queryInput(queries: readonly (string | undefined | null)[]): HostedInput;
|
|
32
|
+
/**
|
|
33
|
+
* The hosted calls one stream opened, keyed by the vendor's id, so a result
|
|
34
|
+
* finds its call and the end of the turn can settle the ones that never got
|
|
35
|
+
* one. It also counts what the stream showed, per type, for
|
|
36
|
+
* `TokenUsage.hostedCalls` on a wire that does not state its own counts.
|
|
37
|
+
*/
|
|
38
|
+
export declare class HostedRecorder {
|
|
39
|
+
private next;
|
|
40
|
+
private readonly open;
|
|
41
|
+
private readonly counts;
|
|
42
|
+
/** A call the vendor started. One with no id of its own gets `hosted_{index}`,
|
|
43
|
+
* which depends on nothing but its position (invariant 14). */
|
|
44
|
+
start(id: string | undefined, type: HostedToolType, at: number, input?: HostedInput): HostedCallDelta & {
|
|
45
|
+
id: string;
|
|
46
|
+
};
|
|
47
|
+
/** A call the vendor reports only once it is over (Gemini's grounding, a
|
|
48
|
+
* backend that sends only the finished item), in one delta. */
|
|
49
|
+
whole(id: string | undefined, type: HostedToolType, at: number, delta: Omit<HostedCallDelta, "index" | "id" | "type" | "at">): HostedCallDelta;
|
|
50
|
+
/** The seam index of a call still open, by the vendor's id. */
|
|
51
|
+
indexOf(id: string | undefined): number | undefined;
|
|
52
|
+
/** A call the vendor finished, or undefined for an id it never opened. */
|
|
53
|
+
end(id: string | undefined, delta: Omit<HostedCallDelta, "index">): HostedCallDelta | undefined;
|
|
54
|
+
/** The ids still open. */
|
|
55
|
+
unsettled(): ReadonlySet<string>;
|
|
56
|
+
/** Every call still open at the end of the turn, failed: the vendor never
|
|
57
|
+
* said how it went, so nothing it returned can be shown or replayed. */
|
|
58
|
+
settle(): HostedCallDelta[];
|
|
59
|
+
/** The calls the stream showed, by type, or undefined when it showed none. */
|
|
60
|
+
shown(): Partial<Record<HostedToolType, number>> | undefined;
|
|
61
|
+
}
|
|
62
|
+
/** The counts a usage record carries, with the types at zero left out, or
|
|
63
|
+
* undefined when every type is. A turn that ran nothing keeps its usage
|
|
64
|
+
* exactly as it was before hosted tools existed. */
|
|
65
|
+
export declare function hostedCounts(...counts: (Partial<Record<HostedToolType, number>> | undefined)[]): Partial<Record<HostedToolType, number>> | undefined;
|
|
66
|
+
type AssistantMessage = Extract<ChatMessage, {
|
|
67
|
+
role: "assistant";
|
|
68
|
+
}>;
|
|
69
|
+
/** One recorded item with its placeholder filled back in. */
|
|
70
|
+
export type ReplayedItem = {
|
|
71
|
+
text: string;
|
|
72
|
+
slot: Record<string, unknown>;
|
|
73
|
+
} | {
|
|
74
|
+
call: ToolCall;
|
|
75
|
+
} | {
|
|
76
|
+
item: unknown;
|
|
77
|
+
};
|
|
78
|
+
/** A JSON object off the wire, as opposed to an array, a scalar or null. */
|
|
79
|
+
export declare function isRecord(value: unknown): value is Record<string, unknown>;
|
|
80
|
+
/**
|
|
81
|
+
* The hosted items a message replays to `provider`, placeholders filled back
|
|
82
|
+
* in, or undefined when it replays none: another provider made them, or the
|
|
83
|
+
* message no longer matches them. Matching means the recorded text lengths sum
|
|
84
|
+
* to `content.length` and every call placeholder names a distinct call the
|
|
85
|
+
* message still has. An edited answer fails that and goes back as plain text,
|
|
86
|
+
* because a citation replayed over edited text vouches for words its source
|
|
87
|
+
* never backed.
|
|
88
|
+
*
|
|
89
|
+
* ponytail: an edit that keeps the length passes. PydanticAI and TanStack use
|
|
90
|
+
* the same length test (anthropic/_citations.py:202-211, responses-text.ts:172-212);
|
|
91
|
+
* the upgrade is a hash of the text in each placeholder.
|
|
92
|
+
*/
|
|
93
|
+
export declare function hostedReplay(message: AssistantMessage, provider: string): ReplayedItem[] | undefined;
|
|
94
|
+
/**
|
|
95
|
+
* A UTF-8 byte offset into `text` as a JS string index, or undefined when it
|
|
96
|
+
* falls inside a character or past the end. Gemini counts its grounding
|
|
97
|
+
* segments in bytes; a JS string counts UTF-16 units, so the two part at the
|
|
98
|
+
* first character outside ASCII.
|
|
99
|
+
*
|
|
100
|
+
* Ported from PydanticAI (MIT, Pydantic Services Inc.), models/google.py:2347-2405.
|
|
101
|
+
*/
|
|
102
|
+
export declare function utf8Index(text: string, bytes: number): number | undefined;
|
|
103
|
+
/** A code point offset into `text` as a JS string index, or undefined past the
|
|
104
|
+
* end. OpenAI's annotation offsets count code points, which differ from JS
|
|
105
|
+
* indices at the first emoji or other character outside the BMP. */
|
|
106
|
+
export declare function codePointIndex(text: string, points: number): number | undefined;
|
|
107
|
+
//# sourceMappingURL=shared.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/hosted/shared.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EACV,cAAc,EACd,UAAU,EACV,UAAU,EACV,WAAW,EACX,eAAe,EAChB,MAAM,YAAY,CAAC;AACpB,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAExE;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,cAAc,EACpB,GAAG,EAAE,MAAM,GACV,aAAa,CAMf;AAKD;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,IAAI,CAAC,aAAa,EAAE,aAAa,GAAG,YAAY,CAAC,GACtD,UAAU,EAAE,CAsBd;AAwBD;;;4EAG4E;AAC5E,wBAAgB,QAAQ,CACtB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,SAA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