@ank1015/providers 0.0.1
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 +453 -0
- package/biome.json +43 -0
- package/dist/agent/agent-loop.d.ts +5 -0
- package/dist/agent/agent-loop.d.ts.map +1 -0
- package/dist/agent/agent-loop.js +219 -0
- package/dist/agent/agent-loop.js.map +1 -0
- package/dist/agent/types.d.ts +67 -0
- package/dist/agent/types.d.ts.map +1 -0
- package/dist/agent/types.js +3 -0
- package/dist/agent/types.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +29 -0
- package/dist/index.js.map +1 -0
- package/dist/models.d.ts +3 -0
- package/dist/models.d.ts.map +1 -0
- package/dist/models.generated.d.ts +247 -0
- package/dist/models.generated.d.ts.map +1 -0
- package/dist/models.generated.js +315 -0
- package/dist/models.generated.js.map +1 -0
- package/dist/models.js +41 -0
- package/dist/models.js.map +1 -0
- package/dist/providers/convert.d.ts +6 -0
- package/dist/providers/convert.d.ts.map +1 -0
- package/dist/providers/convert.js +207 -0
- package/dist/providers/convert.js.map +1 -0
- package/dist/providers/google.d.ts +26 -0
- package/dist/providers/google.d.ts.map +1 -0
- package/dist/providers/google.js +434 -0
- package/dist/providers/google.js.map +1 -0
- package/dist/providers/openai.d.ts +17 -0
- package/dist/providers/openai.d.ts.map +1 -0
- package/dist/providers/openai.js +396 -0
- package/dist/providers/openai.js.map +1 -0
- package/dist/stream.d.ts +4 -0
- package/dist/stream.d.ts.map +1 -0
- package/dist/stream.js +40 -0
- package/dist/stream.js.map +1 -0
- package/dist/test-google-agent-loop.d.ts +2 -0
- package/dist/test-google-agent-loop.d.ts.map +1 -0
- package/dist/test-google-agent-loop.js +186 -0
- package/dist/test-google-agent-loop.js.map +1 -0
- package/dist/test-google.d.ts +2 -0
- package/dist/test-google.d.ts.map +1 -0
- package/dist/test-google.js +41 -0
- package/dist/test-google.js.map +1 -0
- package/dist/types.d.ts +187 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +10 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/event-stream.d.ts +16 -0
- package/dist/utils/event-stream.d.ts.map +1 -0
- package/dist/utils/event-stream.js +61 -0
- package/dist/utils/event-stream.js.map +1 -0
- package/dist/utils/json-parse.d.ts +9 -0
- package/dist/utils/json-parse.d.ts.map +1 -0
- package/dist/utils/json-parse.js +32 -0
- package/dist/utils/json-parse.js.map +1 -0
- package/dist/utils/sanitize-unicode.d.ts +22 -0
- package/dist/utils/sanitize-unicode.d.ts.map +1 -0
- package/dist/utils/sanitize-unicode.js +29 -0
- package/dist/utils/sanitize-unicode.js.map +1 -0
- package/dist/utils/validation.d.ts +11 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/dist/utils/validation.js +61 -0
- package/dist/utils/validation.js.map +1 -0
- package/package.json +33 -0
- package/src/agent/agent-loop.ts +275 -0
- package/src/agent/types.ts +80 -0
- package/src/index.ts +72 -0
- package/src/models.generated.ts +314 -0
- package/src/models.ts +45 -0
- package/src/providers/convert.ts +222 -0
- package/src/providers/google.ts +496 -0
- package/src/providers/openai.ts +437 -0
- package/src/stream.ts +60 -0
- package/src/types.ts +198 -0
- package/src/utils/event-stream.ts +60 -0
- package/src/utils/json-parse.ts +28 -0
- package/src/utils/sanitize-unicode.ts +25 -0
- package/src/utils/validation.ts +69 -0
- package/test/core/agent-loop.test.ts +958 -0
- package/test/core/stream.test.ts +409 -0
- package/test/data/red-circle.png +0 -0
- package/test/data/superintelligentwill.pdf +0 -0
- package/test/edge-cases/general.test.ts +565 -0
- package/test/integration/e2e.test.ts +530 -0
- package/test/models/cost.test.ts +499 -0
- package/test/models/registry.test.ts +298 -0
- package/test/providers/convert.test.ts +846 -0
- package/test/providers/google-schema.test.ts +666 -0
- package/test/providers/google-stream.test.ts +369 -0
- package/test/providers/openai-stream.test.ts +251 -0
- package/test/utils/event-stream.test.ts +289 -0
- package/test/utils/json-parse.test.ts +344 -0
- package/test/utils/sanitize-unicode.test.ts +329 -0
- package/test/utils/validation.test.ts +614 -0
- package/tsconfig.json +21 -0
- package/vitest.config.ts +9 -0
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.streamOpenAI = void 0;
|
|
7
|
+
// Return a abstracted event stream
|
|
8
|
+
// Return the final response as it is.
|
|
9
|
+
const openai_1 = __importDefault(require("openai"));
|
|
10
|
+
const event_stream_1 = require("../utils/event-stream");
|
|
11
|
+
const convert_1 = require("./convert");
|
|
12
|
+
const json_parse_1 = require("../utils/json-parse");
|
|
13
|
+
const validation_1 = require("../utils/validation");
|
|
14
|
+
const models_1 = require("../models");
|
|
15
|
+
// takes in model, built in message
|
|
16
|
+
const streamOpenAI = (model, context, options) => {
|
|
17
|
+
const stream = new event_stream_1.AssistantMessageEventStream();
|
|
18
|
+
// Start async processing
|
|
19
|
+
(async () => {
|
|
20
|
+
const output = {
|
|
21
|
+
role: "assistant",
|
|
22
|
+
content: [],
|
|
23
|
+
api: "openai",
|
|
24
|
+
model: model.id,
|
|
25
|
+
usage: {
|
|
26
|
+
input: 0,
|
|
27
|
+
output: 0,
|
|
28
|
+
cacheRead: 0,
|
|
29
|
+
cacheWrite: 0,
|
|
30
|
+
totalTokens: 0,
|
|
31
|
+
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 },
|
|
32
|
+
},
|
|
33
|
+
stopReason: "stop",
|
|
34
|
+
timestamp: Date.now(),
|
|
35
|
+
};
|
|
36
|
+
let finalResponse = {
|
|
37
|
+
id: "resp_123",
|
|
38
|
+
object: "response",
|
|
39
|
+
created_at: 1740855869,
|
|
40
|
+
output_text: '',
|
|
41
|
+
status: "completed",
|
|
42
|
+
incomplete_details: null,
|
|
43
|
+
parallel_tool_calls: false,
|
|
44
|
+
error: null,
|
|
45
|
+
instructions: null,
|
|
46
|
+
max_output_tokens: null,
|
|
47
|
+
model: "gpt-4o-mini-2024-07-18",
|
|
48
|
+
output: [],
|
|
49
|
+
previous_response_id: null,
|
|
50
|
+
temperature: 1,
|
|
51
|
+
text: {},
|
|
52
|
+
tool_choice: "auto",
|
|
53
|
+
tools: [],
|
|
54
|
+
top_p: 1,
|
|
55
|
+
truncation: "disabled",
|
|
56
|
+
usage: {
|
|
57
|
+
input_tokens: 0,
|
|
58
|
+
output_tokens: 0,
|
|
59
|
+
output_tokens_details: {
|
|
60
|
+
reasoning_tokens: 0
|
|
61
|
+
},
|
|
62
|
+
input_tokens_details: {
|
|
63
|
+
cached_tokens: 0
|
|
64
|
+
},
|
|
65
|
+
total_tokens: 0
|
|
66
|
+
},
|
|
67
|
+
user: undefined,
|
|
68
|
+
metadata: {}
|
|
69
|
+
};
|
|
70
|
+
try {
|
|
71
|
+
const client = createClient(model, options?.apiKey);
|
|
72
|
+
const params = buildParams(model, context, options);
|
|
73
|
+
const openaiStream = await client.responses.create(params, { signal: options?.signal });
|
|
74
|
+
stream.push({ type: "start", partial: output });
|
|
75
|
+
let currentItem = null;
|
|
76
|
+
let currentBlock = null;
|
|
77
|
+
const blocks = output.content;
|
|
78
|
+
const blockIndex = () => blocks.length - 1;
|
|
79
|
+
for await (const event of openaiStream) {
|
|
80
|
+
// Handle output item start
|
|
81
|
+
if (event.type === "response.output_item.added") {
|
|
82
|
+
const item = event.item;
|
|
83
|
+
if (item.type === "reasoning") {
|
|
84
|
+
currentItem = item;
|
|
85
|
+
currentBlock = { type: "thinking", thinking: "" };
|
|
86
|
+
output.content.push(currentBlock);
|
|
87
|
+
stream.push({ type: "thinking_start", contentIndex: blockIndex(), partial: output });
|
|
88
|
+
}
|
|
89
|
+
else if (item.type === "message") {
|
|
90
|
+
currentItem = item;
|
|
91
|
+
currentBlock = { type: "text", text: "" };
|
|
92
|
+
output.content.push(currentBlock);
|
|
93
|
+
stream.push({ type: "text_start", contentIndex: blockIndex(), partial: output });
|
|
94
|
+
}
|
|
95
|
+
else if (item.type === "function_call") {
|
|
96
|
+
currentItem = item;
|
|
97
|
+
currentBlock = {
|
|
98
|
+
type: "toolCall",
|
|
99
|
+
id: item.call_id,
|
|
100
|
+
name: item.name,
|
|
101
|
+
arguments: {},
|
|
102
|
+
partialJson: item.arguments || "",
|
|
103
|
+
};
|
|
104
|
+
output.content.push(currentBlock);
|
|
105
|
+
stream.push({ type: "toolcall_start", contentIndex: blockIndex(), partial: output });
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
// Handle reasoning summary deltas
|
|
109
|
+
else if (event.type === "response.reasoning_summary_part.added") {
|
|
110
|
+
if (currentItem && currentItem.type === "reasoning") {
|
|
111
|
+
currentItem.summary = currentItem.summary || [];
|
|
112
|
+
currentItem.summary.push(event.part);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
else if (event.type === "response.reasoning_summary_text.delta") {
|
|
116
|
+
if (currentItem &&
|
|
117
|
+
currentItem.type === "reasoning" &&
|
|
118
|
+
currentBlock &&
|
|
119
|
+
currentBlock.type === "thinking") {
|
|
120
|
+
currentItem.summary = currentItem.summary || [];
|
|
121
|
+
const lastPart = currentItem.summary[currentItem.summary.length - 1];
|
|
122
|
+
if (lastPart) {
|
|
123
|
+
currentBlock.thinking += event.delta;
|
|
124
|
+
lastPart.text += event.delta;
|
|
125
|
+
stream.push({
|
|
126
|
+
type: "thinking_delta",
|
|
127
|
+
contentIndex: blockIndex(),
|
|
128
|
+
delta: event.delta,
|
|
129
|
+
partial: output,
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
// Add a new line between summary parts (hack...)
|
|
135
|
+
else if (event.type === "response.reasoning_summary_part.done") {
|
|
136
|
+
if (currentItem &&
|
|
137
|
+
currentItem.type === "reasoning" &&
|
|
138
|
+
currentBlock &&
|
|
139
|
+
currentBlock.type === "thinking") {
|
|
140
|
+
currentItem.summary = currentItem.summary || [];
|
|
141
|
+
const lastPart = currentItem.summary[currentItem.summary.length - 1];
|
|
142
|
+
if (lastPart) {
|
|
143
|
+
currentBlock.thinking += "\n\n";
|
|
144
|
+
lastPart.text += "\n\n";
|
|
145
|
+
stream.push({
|
|
146
|
+
type: "thinking_delta",
|
|
147
|
+
contentIndex: blockIndex(),
|
|
148
|
+
delta: "\n\n",
|
|
149
|
+
partial: output,
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
// Handle text output deltas
|
|
155
|
+
else if (event.type === "response.content_part.added") {
|
|
156
|
+
if (currentItem && currentItem.type === "message") {
|
|
157
|
+
currentItem.content = currentItem.content || [];
|
|
158
|
+
currentItem.content.push(event.part);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
else if (event.type === "response.output_text.delta") {
|
|
162
|
+
if (currentItem && currentItem.type === "message" && currentBlock && currentBlock.type === "text") {
|
|
163
|
+
const lastPart = currentItem.content[currentItem.content.length - 1];
|
|
164
|
+
if (lastPart && lastPart.type === "output_text") {
|
|
165
|
+
currentBlock.text += event.delta;
|
|
166
|
+
lastPart.text += event.delta;
|
|
167
|
+
stream.push({
|
|
168
|
+
type: "text_delta",
|
|
169
|
+
contentIndex: blockIndex(),
|
|
170
|
+
delta: event.delta,
|
|
171
|
+
partial: output,
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
else if (event.type === "response.refusal.delta") {
|
|
177
|
+
if (currentItem && currentItem.type === "message" && currentBlock && currentBlock.type === "text") {
|
|
178
|
+
const lastPart = currentItem.content[currentItem.content.length - 1];
|
|
179
|
+
if (lastPart && lastPart.type === "refusal") {
|
|
180
|
+
currentBlock.text += event.delta;
|
|
181
|
+
lastPart.refusal += event.delta;
|
|
182
|
+
stream.push({
|
|
183
|
+
type: "text_delta",
|
|
184
|
+
contentIndex: blockIndex(),
|
|
185
|
+
delta: event.delta,
|
|
186
|
+
partial: output,
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
// Handle function call argument deltas
|
|
192
|
+
else if (event.type === "response.function_call_arguments.delta") {
|
|
193
|
+
if (currentItem &&
|
|
194
|
+
currentItem.type === "function_call" &&
|
|
195
|
+
currentBlock &&
|
|
196
|
+
currentBlock.type === "toolCall") {
|
|
197
|
+
currentBlock.partialJson += event.delta;
|
|
198
|
+
currentBlock.arguments = (0, json_parse_1.parseStreamingJson)(currentBlock.partialJson);
|
|
199
|
+
stream.push({
|
|
200
|
+
type: "toolcall_delta",
|
|
201
|
+
contentIndex: blockIndex(),
|
|
202
|
+
delta: event.delta,
|
|
203
|
+
partial: output,
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
// Handle output item completion
|
|
208
|
+
else if (event.type === "response.output_item.done") {
|
|
209
|
+
const item = event.item;
|
|
210
|
+
if (item.type === "reasoning" && currentBlock && currentBlock.type === "thinking") {
|
|
211
|
+
currentBlock.thinking = item.summary?.map((s) => s.text).join("\n\n") || "";
|
|
212
|
+
stream.push({
|
|
213
|
+
type: "thinking_end",
|
|
214
|
+
contentIndex: blockIndex(),
|
|
215
|
+
content: currentBlock.thinking,
|
|
216
|
+
partial: output,
|
|
217
|
+
});
|
|
218
|
+
currentBlock = null;
|
|
219
|
+
}
|
|
220
|
+
else if (item.type === "message" && currentBlock && currentBlock.type === "text") {
|
|
221
|
+
currentBlock.text = item.content.map((c) => (c.type === "output_text" ? c.text : c.refusal)).join("");
|
|
222
|
+
stream.push({
|
|
223
|
+
type: "text_end",
|
|
224
|
+
contentIndex: blockIndex(),
|
|
225
|
+
content: currentBlock.text,
|
|
226
|
+
partial: output,
|
|
227
|
+
});
|
|
228
|
+
currentBlock = null;
|
|
229
|
+
}
|
|
230
|
+
else if (item.type === "function_call") {
|
|
231
|
+
const toolCall = {
|
|
232
|
+
type: "toolCall",
|
|
233
|
+
id: item.call_id,
|
|
234
|
+
name: item.name,
|
|
235
|
+
arguments: JSON.parse(item.arguments),
|
|
236
|
+
};
|
|
237
|
+
// Validate tool arguments if tool definition is available
|
|
238
|
+
if (context.tools) {
|
|
239
|
+
const tool = context.tools.find((t) => t.name === toolCall.name);
|
|
240
|
+
if (tool) {
|
|
241
|
+
toolCall.arguments = (0, validation_1.validateToolArguments)(tool, toolCall);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
stream.push({ type: "toolcall_end", contentIndex: blockIndex(), toolCall, partial: output });
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
// Handle completion
|
|
248
|
+
else if (event.type === "response.completed") {
|
|
249
|
+
const response = event.response;
|
|
250
|
+
// Update the final Response
|
|
251
|
+
finalResponse = response;
|
|
252
|
+
if (response?.usage) {
|
|
253
|
+
const cachedTokens = response.usage.input_tokens_details?.cached_tokens || 0;
|
|
254
|
+
output.usage = {
|
|
255
|
+
// OpenAI includes cached tokens in input_tokens, so subtract to get non-cached input
|
|
256
|
+
input: (response.usage.input_tokens || 0) - cachedTokens,
|
|
257
|
+
output: response.usage.output_tokens || 0,
|
|
258
|
+
cacheRead: cachedTokens,
|
|
259
|
+
cacheWrite: 0,
|
|
260
|
+
totalTokens: response.usage.total_tokens || 0,
|
|
261
|
+
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 },
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
(0, models_1.calculateCost)(model, output.usage);
|
|
265
|
+
// Map status to stop reason
|
|
266
|
+
output.stopReason = mapStopReason(response?.status);
|
|
267
|
+
if (output.content.some((b) => b.type === "toolCall") && output.stopReason === "stop") {
|
|
268
|
+
output.stopReason = "toolUse";
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
// Handle errors
|
|
272
|
+
else if (event.type === "error") {
|
|
273
|
+
throw new Error(`OpenAI API Error (${event.code}): ${event.message}` || "Unknown OpenAI error");
|
|
274
|
+
}
|
|
275
|
+
else if (event.type === "response.failed") {
|
|
276
|
+
throw new Error("OpenAI response failed without error details");
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
if (options?.signal?.aborted) {
|
|
280
|
+
throw new Error("Request was aborted");
|
|
281
|
+
}
|
|
282
|
+
if (output.stopReason === "aborted" || output.stopReason === "error") {
|
|
283
|
+
throw new Error(`Stream ended with status: ${output.stopReason}${output.errorMessage ? ` - ${output.errorMessage}` : ""}`);
|
|
284
|
+
}
|
|
285
|
+
stream.push({ type: "done", reason: output.stopReason, message: output });
|
|
286
|
+
stream.end({
|
|
287
|
+
_provider: 'openai',
|
|
288
|
+
role: 'assistant',
|
|
289
|
+
message: finalResponse
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
catch (error) {
|
|
293
|
+
for (const block of output.content)
|
|
294
|
+
delete block.index;
|
|
295
|
+
output.stopReason = options?.signal?.aborted ? "aborted" : "error";
|
|
296
|
+
output.errorMessage = error instanceof Error ? error.message : JSON.stringify(error);
|
|
297
|
+
stream.push({ type: "error", reason: output.stopReason, error: output });
|
|
298
|
+
// Update finalResponse to reflect the error state
|
|
299
|
+
finalResponse.status = options?.signal?.aborted ? "cancelled" : "failed";
|
|
300
|
+
finalResponse.error = error instanceof Error ? {
|
|
301
|
+
message: error.message,
|
|
302
|
+
code: error.code || "unknown_error",
|
|
303
|
+
type: error.name || "Error"
|
|
304
|
+
} : { message: String(error) };
|
|
305
|
+
stream.end({
|
|
306
|
+
_provider: 'openai',
|
|
307
|
+
role: 'assistant',
|
|
308
|
+
message: finalResponse
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
})();
|
|
312
|
+
return stream;
|
|
313
|
+
};
|
|
314
|
+
exports.streamOpenAI = streamOpenAI;
|
|
315
|
+
function createClient(model, apiKey) {
|
|
316
|
+
if (!apiKey) {
|
|
317
|
+
if (!process.env.OPENAI_API_KEY) {
|
|
318
|
+
throw new Error("OpenAI API key is required. Set OPENAI_API_KEY environment variable or pass it as an argument.");
|
|
319
|
+
}
|
|
320
|
+
apiKey = process.env.OPENAI_API_KEY;
|
|
321
|
+
}
|
|
322
|
+
return new openai_1.default({
|
|
323
|
+
apiKey,
|
|
324
|
+
baseURL: model.baseUrl,
|
|
325
|
+
dangerouslyAllowBrowser: true,
|
|
326
|
+
defaultHeaders: model.headers,
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
function buildParams(model, context, options) {
|
|
330
|
+
const messages = (0, convert_1.buildOpenAIMessages)(model, context);
|
|
331
|
+
const params = {
|
|
332
|
+
include: ['reasoning.encrypted_content'],
|
|
333
|
+
input: messages,
|
|
334
|
+
model: model.id,
|
|
335
|
+
stream: true
|
|
336
|
+
};
|
|
337
|
+
if (options?.maxOutputTokens) {
|
|
338
|
+
params.max_output_tokens = options.maxOutputTokens;
|
|
339
|
+
}
|
|
340
|
+
if (options?.parallelToolCalls) {
|
|
341
|
+
params.parallel_tool_calls = options.parallelToolCalls;
|
|
342
|
+
}
|
|
343
|
+
if (options?.prompt_cache_key) {
|
|
344
|
+
params.prompt_cache_key = options.prompt_cache_key;
|
|
345
|
+
}
|
|
346
|
+
if (options?.promptCacheRetention) {
|
|
347
|
+
params.prompt_cache_retention = options.promptCacheRetention;
|
|
348
|
+
}
|
|
349
|
+
if (options?.reasoning) {
|
|
350
|
+
params.reasoning = {
|
|
351
|
+
effort: options.reasoning.effort || "medium",
|
|
352
|
+
summary: options.reasoning.summary || "auto"
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
if (options?.temperature) {
|
|
356
|
+
params.temperature = options.temperature;
|
|
357
|
+
}
|
|
358
|
+
if (context.tools) {
|
|
359
|
+
params.tools = convertTools(context.tools);
|
|
360
|
+
}
|
|
361
|
+
if (options?.truncation) {
|
|
362
|
+
params.truncation = options.truncation;
|
|
363
|
+
}
|
|
364
|
+
return params;
|
|
365
|
+
}
|
|
366
|
+
function convertTools(tools) {
|
|
367
|
+
return tools.map((tool) => ({
|
|
368
|
+
type: "function",
|
|
369
|
+
name: tool.name,
|
|
370
|
+
description: tool.description,
|
|
371
|
+
parameters: tool.parameters, // TypeBox already generates JSON Schema
|
|
372
|
+
strict: null,
|
|
373
|
+
}));
|
|
374
|
+
}
|
|
375
|
+
function mapStopReason(status) {
|
|
376
|
+
if (!status)
|
|
377
|
+
return "stop";
|
|
378
|
+
switch (status) {
|
|
379
|
+
case "completed":
|
|
380
|
+
return "stop";
|
|
381
|
+
case "incomplete":
|
|
382
|
+
return "length";
|
|
383
|
+
case "failed":
|
|
384
|
+
case "cancelled":
|
|
385
|
+
return "error";
|
|
386
|
+
// These two are wonky ...
|
|
387
|
+
case "in_progress":
|
|
388
|
+
case "queued":
|
|
389
|
+
return "stop";
|
|
390
|
+
default: {
|
|
391
|
+
const _exhaustive = status;
|
|
392
|
+
throw new Error(`Unhandled stop reason: ${_exhaustive}`);
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
//# sourceMappingURL=openai.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openai.js","sourceRoot":"","sources":["../../src/providers/openai.ts"],"names":[],"mappings":";;;;;;AAAA,mCAAmC;AACnC,sCAAsC;AACtC,oDAA4B;AAC5B,wDAAoE;AAEpE,uCAAgD;AAGhD,oDAAyD;AACzD,oDAA4D;AAC5D,sCAA0C;AAiB1C,mCAAmC;AAC5B,MAAM,YAAY,GAA6B,CAClD,KAAsB,EACtB,OAAgB,EAChB,OAA8B,EAChC,EAAE;IAEA,MAAM,MAAM,GAAG,IAAI,0CAA2B,EAAE,CAAC;IAEpD,yBAAyB;IACzB,CAAC,KAAK,IAAI,EAAE;QACX,MAAM,MAAM,GAAqB;YAChC,IAAI,EAAE,WAAW;YACjB,OAAO,EAAE,EAAE;YACX,GAAG,EAAE,QAAe;YACpB,KAAK,EAAE,KAAK,CAAC,EAAE;YACf,KAAK,EAAE;gBACN,KAAK,EAAE,C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B,WAAW,EAAE,CAAC,CAAC;QAC1D,CAAC;IACF,CAAC;AACF,CAAC"}
|
package/dist/stream.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Model, Context, Api, OptionsForApi } from "./types";
|
|
2
|
+
import { AssistantMessageEventStream } from "./utils/event-stream";
|
|
3
|
+
export declare function stream<TApi extends Api>(model: Model<TApi>, context: Context, options?: OptionsForApi<TApi>): AssistantMessageEventStream;
|
|
4
|
+
//# sourceMappingURL=stream.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../src/stream.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAClE,OAAO,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAC;AAqBnE,wBAAgB,MAAM,CAAC,IAAI,SAAS,GAAG,EACtC,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,EAClB,OAAO,EAAE,OAAO,EAChB,OAAO,CAAC,EAAE,aAAa,CAAC,IAAI,CAAC,GAC3B,2BAA2B,CAiC7B"}
|
package/dist/stream.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.stream = stream;
|
|
4
|
+
const openai_1 = require("./providers/openai");
|
|
5
|
+
const google_1 = require("./providers/google");
|
|
6
|
+
const envMap = {
|
|
7
|
+
openai: "OPENAI_API_KEY",
|
|
8
|
+
// anthropic: "ANTHROPIC_API_KEY",
|
|
9
|
+
google: "GEMINI_API_KEY",
|
|
10
|
+
// groq: "GROQ_API_KEY",
|
|
11
|
+
// cerebras: "CEREBRAS_API_KEY",
|
|
12
|
+
// xai: "XAI_API_KEY",
|
|
13
|
+
// openrouter: "OPENROUTER_API_KEY",
|
|
14
|
+
// zai: "ZAI_API_KEY",
|
|
15
|
+
};
|
|
16
|
+
function getApiKeyFromEnv(api) {
|
|
17
|
+
const envVar = envMap[api];
|
|
18
|
+
return process.env[envVar];
|
|
19
|
+
}
|
|
20
|
+
function stream(model, context, options) {
|
|
21
|
+
const apiKey = options?.apiKey !== undefined ? options.apiKey : getApiKeyFromEnv(model.api);
|
|
22
|
+
if (!apiKey) {
|
|
23
|
+
throw new Error(`No API key for provider: ${model.api}`);
|
|
24
|
+
}
|
|
25
|
+
const providerOptions = { ...options, apiKey };
|
|
26
|
+
// Switch directly on model.api and use type assertions for each provider
|
|
27
|
+
switch (model.api) {
|
|
28
|
+
case 'openai':
|
|
29
|
+
// TypeScript knows this branch only runs when model.api === 'openai'
|
|
30
|
+
return (0, openai_1.streamOpenAI)(model, context, providerOptions);
|
|
31
|
+
case 'google':
|
|
32
|
+
// TypeScript knows this branch only runs when model.api === 'google'
|
|
33
|
+
return (0, google_1.streamGoogle)(model, context, providerOptions);
|
|
34
|
+
default: {
|
|
35
|
+
const _exhaustive = model.api;
|
|
36
|
+
throw new Error(`Unhandled API: ${_exhaustive}`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=stream.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stream.js","sourceRoot":"","sources":["../src/stream.ts"],"names":[],"mappings":";;AAsBA,wBAqCC;AAzDD,+CAAyE;AACzE,+CAAyE;AAEzE,MAAM,MAAM,GAAwB;IACnC,MAAM,EAAE,gBAAgB;IACxB,kCAAkC;IAClC,MAAM,EAAE,gBAAgB;IACxB,wBAAwB;IACxB,gCAAgC;IAChC,sBAAsB;IACtB,oCAAoC;IACpC,sBAAsB;CACtB,CAAC;AAGF,SAAS,gBAAgB,CAAC,GAAQ;IAC9B,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,CAAA;IAC1B,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;AAC9B,CAAC;AAED,SAAgB,MAAM,CACrB,KAAkB,EAClB,OAAgB,EAChB,OAA6B;IAG1B,MAAM,MAAM,GAAG,OAAO,EAAE,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,gBAAgB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IAC3F,IAAG,CAAC,MAAM,EAAC,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,4BAA4B,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC;IACvD,CAAC;IAEJ,MAAM,eAAe,GAAG,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,CAAC;IAE/C,yEAAyE;IACzE,QAAQ,KAAK,CAAC,GAAG,EAAE,CAAC;QACb,KAAK,QAAQ;YACT,qEAAqE;YACrE,OAAO,IAAA,qBAAY,EAC3B,KAAwB,EACxB,OAAO,EACP,eAAwC,CACxC,CAAC;QAEH,KAAK,QAAQ;YACH,qEAAqE;YAC9E,OAAO,IAAA,qBAAY,EAClB,KAAwB,EACxB,OAAO,EACP,eAAwC,CACxC,CAAC;QAEG,OAAO,CAAC,CAAC,CAAC;YACf,MAAM,WAAW,GAAU,KAAK,CAAC,GAAG,CAAC;YACrC,MAAM,IAAI,KAAK,CAAC,kBAAkB,WAAW,EAAE,CAAC,CAAC;QAC5C,CAAC;IACL,CAAC;AAEL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-google-agent-loop.d.ts","sourceRoot":"","sources":["../src/test-google-agent-loop.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const agent_loop_1 = require("./agent/agent-loop");
|
|
4
|
+
const models_generated_1 = require("./models.generated");
|
|
5
|
+
const typebox_1 = require("@sinclair/typebox");
|
|
6
|
+
const fs_1 = require("fs");
|
|
7
|
+
const path_1 = require("path");
|
|
8
|
+
const genai_1 = require("@google/genai");
|
|
9
|
+
// Create logs directory
|
|
10
|
+
const logsDir = (0, path_1.join)(process.cwd(), "logs");
|
|
11
|
+
try {
|
|
12
|
+
(0, fs_1.mkdirSync)(logsDir, { recursive: true });
|
|
13
|
+
}
|
|
14
|
+
catch (e) {
|
|
15
|
+
// Directory might already exist
|
|
16
|
+
}
|
|
17
|
+
const eventsFile = (0, path_1.join)(logsDir, "agent-events.txt");
|
|
18
|
+
const resultFile = (0, path_1.join)(logsDir, "agent-result.json");
|
|
19
|
+
// Clear previous logs
|
|
20
|
+
(0, fs_1.writeFileSync)(eventsFile, "=== Agent Loop Events Log ===\n", "utf-8");
|
|
21
|
+
(0, fs_1.writeFileSync)(resultFile, "", "utf-8");
|
|
22
|
+
console.log("š§Ŗ Testing Agent Loop...\n");
|
|
23
|
+
// Define calculator parameter schema
|
|
24
|
+
const CalculatorParams = typebox_1.Type.Object({
|
|
25
|
+
operation: typebox_1.Type.Union([
|
|
26
|
+
typebox_1.Type.Literal("addition"),
|
|
27
|
+
typebox_1.Type.Literal("add"),
|
|
28
|
+
typebox_1.Type.Literal("divide"),
|
|
29
|
+
typebox_1.Type.Literal("multiply"),
|
|
30
|
+
typebox_1.Type.Literal("subtraction"),
|
|
31
|
+
typebox_1.Type.Literal("multiplication"),
|
|
32
|
+
typebox_1.Type.Literal("division"),
|
|
33
|
+
]),
|
|
34
|
+
a: typebox_1.Type.Number({ description: "First number" }),
|
|
35
|
+
b: typebox_1.Type.Number({ description: "Second number" }),
|
|
36
|
+
});
|
|
37
|
+
// Define a calculator tool with execution logic
|
|
38
|
+
const calculatorTool = {
|
|
39
|
+
name: "calculator",
|
|
40
|
+
label: "Calculator",
|
|
41
|
+
description: "Performs basic arithmetic operations",
|
|
42
|
+
parameters: CalculatorParams,
|
|
43
|
+
async execute(toolCallId, params, signal) {
|
|
44
|
+
// Simulate some work
|
|
45
|
+
await new Promise(resolve => setTimeout(resolve, 100));
|
|
46
|
+
let result;
|
|
47
|
+
switch (params.operation) {
|
|
48
|
+
case "addition":
|
|
49
|
+
result = params.a + params.b;
|
|
50
|
+
break;
|
|
51
|
+
case "add":
|
|
52
|
+
result = params.a + params.b;
|
|
53
|
+
break;
|
|
54
|
+
case "subtraction":
|
|
55
|
+
result = params.a - params.b;
|
|
56
|
+
break;
|
|
57
|
+
case "multiplication":
|
|
58
|
+
result = params.a * params.b;
|
|
59
|
+
break;
|
|
60
|
+
case "multiply":
|
|
61
|
+
result = params.a * params.b;
|
|
62
|
+
break;
|
|
63
|
+
case "division":
|
|
64
|
+
if (params.b === 0) {
|
|
65
|
+
throw new Error("Division by zero is not allowed");
|
|
66
|
+
}
|
|
67
|
+
result = params.a / params.b;
|
|
68
|
+
break;
|
|
69
|
+
case "divide":
|
|
70
|
+
if (params.b === 0) {
|
|
71
|
+
throw new Error("Division by zero is not allowed");
|
|
72
|
+
}
|
|
73
|
+
result = params.a / params.b;
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
return {
|
|
77
|
+
content: [
|
|
78
|
+
{
|
|
79
|
+
type: "text",
|
|
80
|
+
content: `The result of ${params.operation} of ${params.a} and ${params.b} is ${result}`,
|
|
81
|
+
},
|
|
82
|
+
],
|
|
83
|
+
details: {
|
|
84
|
+
operation: params.operation,
|
|
85
|
+
operands: [params.a, params.b],
|
|
86
|
+
result,
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
// Create a user message
|
|
92
|
+
const userMessage = {
|
|
93
|
+
role: "user",
|
|
94
|
+
timestamp: Date.now(),
|
|
95
|
+
content: [
|
|
96
|
+
{
|
|
97
|
+
type: "text",
|
|
98
|
+
content: "Can you calculate 1005 + 27032 for me? Then multiply the result by 2.",
|
|
99
|
+
},
|
|
100
|
+
],
|
|
101
|
+
};
|
|
102
|
+
// Create agent context
|
|
103
|
+
const agentContext = {
|
|
104
|
+
systemPrompt: "You are a helpful assistant with access to a calculator tool. Always use the calculator tool for math operations.",
|
|
105
|
+
messages: [],
|
|
106
|
+
tools: [calculatorTool],
|
|
107
|
+
};
|
|
108
|
+
// Get a model
|
|
109
|
+
const model = models_generated_1.MODELS.google["gemini-3-pro-preview"];
|
|
110
|
+
// Create config
|
|
111
|
+
const config = {
|
|
112
|
+
model,
|
|
113
|
+
providerOptions: {
|
|
114
|
+
thinkingConfig: {
|
|
115
|
+
thinkingLevel: genai_1.ThinkingLevel.LOW
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
};
|
|
119
|
+
console.log(`š¦ Model: ${model.name}`);
|
|
120
|
+
console.log(`š§ Tools: ${calculatorTool.name}`);
|
|
121
|
+
const firstContent = userMessage.content[0];
|
|
122
|
+
const messageText = firstContent.type === "text" ? firstContent.content : `[${firstContent.type}]`;
|
|
123
|
+
console.log(`š¬ User: ${messageText}\n`);
|
|
124
|
+
console.log("š Streaming events to:", eventsFile);
|
|
125
|
+
console.log("š¾ Final result to:", resultFile);
|
|
126
|
+
console.log("\n--- Starting Agent Loop ---\n");
|
|
127
|
+
// Helper to log events
|
|
128
|
+
function logEvent(event) {
|
|
129
|
+
const timestamp = new Date().toISOString();
|
|
130
|
+
const eventLog = `[${timestamp}] ${event.type}\n${JSON.stringify(event, null, 2)}\n${"=".repeat(80)}\n`;
|
|
131
|
+
(0, fs_1.appendFileSync)(eventsFile, eventLog, "utf-8");
|
|
132
|
+
console.log(`šØ Event: ${event.type}`);
|
|
133
|
+
}
|
|
134
|
+
// Run the agent loop
|
|
135
|
+
(async () => {
|
|
136
|
+
try {
|
|
137
|
+
const eventStream = (0, agent_loop_1.agentLoop)(userMessage, agentContext, config);
|
|
138
|
+
// Iterate through events
|
|
139
|
+
for await (const event of eventStream) {
|
|
140
|
+
logEvent(event);
|
|
141
|
+
// Show some key events in console
|
|
142
|
+
if (event.type === "message_update" && event.assistantMessageEvent.type === "text_delta") {
|
|
143
|
+
process.stdout.write(event.assistantMessageEvent.delta);
|
|
144
|
+
}
|
|
145
|
+
else if (event.type === "tool_execution_start") {
|
|
146
|
+
console.log(`\nš§ Executing tool: ${event.toolName}(${JSON.stringify(event.args)})`);
|
|
147
|
+
}
|
|
148
|
+
else if (event.type === "tool_execution_end") {
|
|
149
|
+
if (event.isError) {
|
|
150
|
+
console.log(`ā Tool failed: ${typeof event.result === "string" ? event.result : "See details"}`);
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
console.log(`ā
Tool succeeded`);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
else if (event.type === "turn_end") {
|
|
157
|
+
console.log(`\n--- Turn Complete (${event.toolResults.length} tool results) ---\n`);
|
|
158
|
+
}
|
|
159
|
+
else if (event.type === "agent_end") {
|
|
160
|
+
console.log(`\nš Agent completed with status: ${event.status}\n`);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
// Get the final result
|
|
164
|
+
console.log("\n--- Agent Loop Complete ---\n");
|
|
165
|
+
console.log("ā³ Getting final messages...");
|
|
166
|
+
const finalMessages = await eventStream.result();
|
|
167
|
+
console.log(`ā
Received ${finalMessages.length} messages!`);
|
|
168
|
+
// Save final result
|
|
169
|
+
const resultData = {
|
|
170
|
+
timestamp: new Date().toISOString(),
|
|
171
|
+
messageCount: finalMessages.length,
|
|
172
|
+
messages: finalMessages,
|
|
173
|
+
};
|
|
174
|
+
(0, fs_1.writeFileSync)(resultFile, JSON.stringify(resultData, null, 2), "utf-8");
|
|
175
|
+
console.log("\n⨠Test complete!");
|
|
176
|
+
console.log(`š Events logged to: ${eventsFile}`);
|
|
177
|
+
console.log(`š¾ Final result saved to: ${resultFile}`);
|
|
178
|
+
console.log(`š Total messages: ${finalMessages.length}`);
|
|
179
|
+
}
|
|
180
|
+
catch (error) {
|
|
181
|
+
console.error("\nā Error during agent loop:", error);
|
|
182
|
+
(0, fs_1.appendFileSync)(eventsFile, `\n\nERROR: ${error}\n`, "utf-8");
|
|
183
|
+
process.exit(1);
|
|
184
|
+
}
|
|
185
|
+
})();
|
|
186
|
+
//# sourceMappingURL=test-google-agent-loop.js.map
|