@codilore/llm 1.15.13
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/AGENTS.md +321 -0
- package/README.md +131 -0
- package/example/call-sites.md +591 -0
- package/example/tutorial.ts +255 -0
- package/package.json +50 -0
- package/script/recording-cost-report.ts +250 -0
- package/script/setup-recording-env.ts +542 -0
- package/src/cache-policy.ts +111 -0
- package/src/index.ts +32 -0
- package/src/llm.ts +186 -0
- package/src/protocols/anthropic-messages.ts +841 -0
- package/src/protocols/bedrock-converse.ts +649 -0
- package/src/protocols/bedrock-event-stream.ts +87 -0
- package/src/protocols/gemini.ts +465 -0
- package/src/protocols/index.ts +6 -0
- package/src/protocols/openai-chat.ts +431 -0
- package/src/protocols/openai-compatible-chat.ts +24 -0
- package/src/protocols/openai-responses.ts +987 -0
- package/src/protocols/shared.ts +283 -0
- package/src/protocols/utils/bedrock-auth.ts +70 -0
- package/src/protocols/utils/bedrock-cache.ts +37 -0
- package/src/protocols/utils/bedrock-media.ts +80 -0
- package/src/protocols/utils/cache.ts +16 -0
- package/src/protocols/utils/gemini-tool-schema.ts +101 -0
- package/src/protocols/utils/lifecycle.ts +102 -0
- package/src/protocols/utils/openai-options.ts +84 -0
- package/src/protocols/utils/tool-stream.ts +218 -0
- package/src/provider.ts +37 -0
- package/src/providers/amazon-bedrock.ts +43 -0
- package/src/providers/anthropic.ts +35 -0
- package/src/providers/azure.ts +110 -0
- package/src/providers/cloudflare.ts +127 -0
- package/src/providers/github-copilot.ts +66 -0
- package/src/providers/google.ts +35 -0
- package/src/providers/index.ts +11 -0
- package/src/providers/openai-compatible-profile.ts +20 -0
- package/src/providers/openai-compatible.ts +65 -0
- package/src/providers/openai-options.ts +81 -0
- package/src/providers/openai.ts +63 -0
- package/src/providers/openrouter.ts +98 -0
- package/src/providers/xai.ts +56 -0
- package/src/route/auth-options.ts +57 -0
- package/src/route/auth.ts +156 -0
- package/src/route/client.ts +434 -0
- package/src/route/endpoint.ts +53 -0
- package/src/route/executor.ts +374 -0
- package/src/route/framing.ts +27 -0
- package/src/route/index.ts +25 -0
- package/src/route/protocol.ts +84 -0
- package/src/route/transport/http.ts +108 -0
- package/src/route/transport/index.ts +33 -0
- package/src/route/transport/websocket.ts +280 -0
- package/src/schema/errors.ts +203 -0
- package/src/schema/events.ts +370 -0
- package/src/schema/ids.ts +43 -0
- package/src/schema/index.ts +5 -0
- package/src/schema/messages.ts +404 -0
- package/src/schema/options.ts +221 -0
- package/src/tool-runtime.ts +78 -0
- package/src/tool.ts +241 -0
- package/src/utils/record.ts +3 -0
- package/sst-env.d.ts +10 -0
- package/test/adapter.test.ts +164 -0
- package/test/auth-options.types.ts +168 -0
- package/test/auth.test.ts +103 -0
- package/test/cache-policy.test.ts +262 -0
- package/test/continuation-scenarios.ts +104 -0
- package/test/endpoint.test.ts +58 -0
- package/test/executor.test.ts +418 -0
- package/test/exports.test.ts +62 -0
- package/test/fixtures/media/restroom.png +0 -0
- package/test/fixtures/recordings/anthropic-messages/accepts-malformed-assistant-tool-order-with-default-patch.json +29 -0
- package/test/fixtures/recordings/anthropic-messages/anthropic-opus-4-7-image-tool-result.json +43 -0
- package/test/fixtures/recordings/anthropic-messages/claude-opus-4-7-drives-a-tool-loop.json +56 -0
- package/test/fixtures/recordings/anthropic-messages/rejects-malformed-assistant-tool-order-without-patch.json +29 -0
- package/test/fixtures/recordings/anthropic-messages/streams-text.json +29 -0
- package/test/fixtures/recordings/anthropic-messages/streams-tool-call.json +29 -0
- package/test/fixtures/recordings/anthropic-messages-cache/writes-then-reads-cache-control-on-identical-second-call.json +48 -0
- package/test/fixtures/recordings/bedrock-converse/drives-a-tool-loop.json +55 -0
- package/test/fixtures/recordings/bedrock-converse/streams-a-tool-call.json +29 -0
- package/test/fixtures/recordings/bedrock-converse/streams-text.json +29 -0
- package/test/fixtures/recordings/cloudflare-ai-gateway/cloudflare-ai-gateway-workers-ai-gpt-oss-20b-tools-tool-call.json +32 -0
- package/test/fixtures/recordings/cloudflare-ai-gateway/cloudflare-ai-gateway-workers-ai-llama-3-1-8b-text.json +32 -0
- package/test/fixtures/recordings/cloudflare-workers-ai/cloudflare-workers-ai-gpt-oss-20b-tools-tool-call.json +32 -0
- package/test/fixtures/recordings/cloudflare-workers-ai/cloudflare-workers-ai-llama-3-1-8b-text.json +32 -0
- package/test/fixtures/recordings/gemini/gemini-2-5-flash-image.json +32 -0
- package/test/fixtures/recordings/gemini/streams-text.json +28 -0
- package/test/fixtures/recordings/gemini/streams-tool-call.json +28 -0
- package/test/fixtures/recordings/gemini-cache/reports-cachedcontenttokencount-on-identical-second-call.json +46 -0
- package/test/fixtures/recordings/openai-chat/continues-after-tool-result.json +28 -0
- package/test/fixtures/recordings/openai-chat/drives-a-tool-loop-end-to-end.json +46 -0
- package/test/fixtures/recordings/openai-chat/streams-text.json +28 -0
- package/test/fixtures/recordings/openai-chat/streams-tool-call.json +28 -0
- package/test/fixtures/recordings/openai-compatible-chat/deepseek-streams-text.json +28 -0
- package/test/fixtures/recordings/openai-compatible-chat/groq-llama-3-3-70b-drives-a-tool-loop.json +53 -0
- package/test/fixtures/recordings/openai-compatible-chat/groq-streams-text.json +28 -0
- package/test/fixtures/recordings/openai-compatible-chat/groq-streams-tool-call.json +28 -0
- package/test/fixtures/recordings/openai-compatible-chat/openrouter-claude-opus-4-7-drives-a-tool-loop.json +54 -0
- package/test/fixtures/recordings/openai-compatible-chat/openrouter-gpt-4o-mini-drives-a-tool-loop.json +53 -0
- package/test/fixtures/recordings/openai-compatible-chat/openrouter-gpt-5-5-drives-a-tool-loop.json +54 -0
- package/test/fixtures/recordings/openai-compatible-chat/openrouter-streams-text.json +28 -0
- package/test/fixtures/recordings/openai-compatible-chat/openrouter-streams-tool-call.json +28 -0
- package/test/fixtures/recordings/openai-compatible-chat/togetherai-streams-text.json +28 -0
- package/test/fixtures/recordings/openai-compatible-chat/togetherai-streams-tool-call.json +28 -0
- package/test/fixtures/recordings/openai-responses/gpt-5-5-drives-a-tool-loop.json +54 -0
- package/test/fixtures/recordings/openai-responses/gpt-5-5-streams-text.json +28 -0
- package/test/fixtures/recordings/openai-responses/gpt-5-5-streams-tool-call.json +28 -0
- package/test/fixtures/recordings/openai-responses/openai-responses-gpt-5-5-image-tool-result.json +42 -0
- package/test/fixtures/recordings/openai-responses/openai-responses-gpt-5-5-reasoning-continuation.json +58 -0
- package/test/fixtures/recordings/openai-responses/openai-responses-gpt-5-5-reasoning.json +32 -0
- package/test/fixtures/recordings/openai-responses-cache/reports-cached-tokens-on-identical-second-call.json +46 -0
- package/test/generate-object.test.ts +184 -0
- package/test/lib/effect.ts +50 -0
- package/test/lib/http.ts +98 -0
- package/test/lib/openai-chunks.ts +27 -0
- package/test/lib/sse.ts +17 -0
- package/test/lib/tool-runtime.ts +146 -0
- package/test/llm.test.ts +167 -0
- package/test/provider/anthropic-messages-cache.recorded.test.ts +54 -0
- package/test/provider/anthropic-messages.recorded.test.ts +46 -0
- package/test/provider/anthropic-messages.test.ts +829 -0
- package/test/provider/bedrock-converse-cache.recorded.test.ts +54 -0
- package/test/provider/bedrock-converse.test.ts +707 -0
- package/test/provider/cloudflare.test.ts +230 -0
- package/test/provider/gemini-cache.recorded.test.ts +48 -0
- package/test/provider/gemini.test.ts +476 -0
- package/test/provider/golden.recorded.test.ts +219 -0
- package/test/provider/openai-chat.test.ts +446 -0
- package/test/provider/openai-compatible-chat.test.ts +238 -0
- package/test/provider/openai-responses-cache.recorded.test.ts +46 -0
- package/test/provider/openai-responses.test.ts +1322 -0
- package/test/provider/openrouter.test.ts +56 -0
- package/test/provider.types.ts +41 -0
- package/test/recorded-golden.ts +97 -0
- package/test/recorded-runner.ts +100 -0
- package/test/recorded-scenarios.ts +531 -0
- package/test/recorded-test.ts +74 -0
- package/test/recorded-utils.ts +56 -0
- package/test/recorded-websocket.ts +26 -0
- package/test/route.test.ts +43 -0
- package/test/schema.test.ts +97 -0
- package/test/tool-runtime.test.ts +802 -0
- package/test/tool-stream.test.ts +99 -0
- package/test/tool.types.ts +40 -0
- package/tsconfig.json +15 -0
|
@@ -0,0 +1,476 @@
|
|
|
1
|
+
import { describe, expect } from "bun:test"
|
|
2
|
+
import { Effect } from "effect"
|
|
3
|
+
import { LLM, LLMError, Message, ToolCallPart, Usage } from "../../src"
|
|
4
|
+
import { Auth, LLMClient } from "../../src/route"
|
|
5
|
+
import * as Gemini from "../../src/protocols/gemini"
|
|
6
|
+
import { it } from "../lib/effect"
|
|
7
|
+
import { fixedResponse } from "../lib/http"
|
|
8
|
+
import { sseEvents, sseRaw } from "../lib/sse"
|
|
9
|
+
|
|
10
|
+
const model = Gemini.route
|
|
11
|
+
.with({
|
|
12
|
+
endpoint: { baseURL: "https://generativelanguage.test/v1beta/" },
|
|
13
|
+
auth: Auth.header("x-goog-api-key", "test"),
|
|
14
|
+
})
|
|
15
|
+
.model({ id: "gemini-2.5-flash" })
|
|
16
|
+
|
|
17
|
+
const request = LLM.request({
|
|
18
|
+
id: "req_1",
|
|
19
|
+
model,
|
|
20
|
+
system: "You are concise.",
|
|
21
|
+
prompt: "Say hello.",
|
|
22
|
+
generation: { maxTokens: 20, temperature: 0 },
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
describe("Gemini route", () => {
|
|
26
|
+
it.effect("prepares Gemini target", () =>
|
|
27
|
+
Effect.gen(function* () {
|
|
28
|
+
const prepared = yield* LLMClient.prepare(request)
|
|
29
|
+
|
|
30
|
+
expect(prepared.body).toEqual({
|
|
31
|
+
contents: [{ role: "user", parts: [{ text: "Say hello." }] }],
|
|
32
|
+
systemInstruction: { parts: [{ text: "You are concise." }] },
|
|
33
|
+
generationConfig: { maxOutputTokens: 20, temperature: 0 },
|
|
34
|
+
})
|
|
35
|
+
}),
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
it.effect("lowers chronological system updates to wrapped user text in order", () =>
|
|
39
|
+
Effect.gen(function* () {
|
|
40
|
+
const prepared = yield* LLMClient.prepare<Gemini.GeminiBody>(
|
|
41
|
+
LLM.request({
|
|
42
|
+
model,
|
|
43
|
+
messages: [Message.user("Before."), Message.system("Update."), Message.assistant("After.")],
|
|
44
|
+
}),
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
expect(prepared.body.contents).toEqual([
|
|
48
|
+
{ role: "user", parts: [{ text: "Before." }, { text: "<system-update>\nUpdate.\n</system-update>" }] },
|
|
49
|
+
{ role: "model", parts: [{ text: "After." }] },
|
|
50
|
+
])
|
|
51
|
+
}),
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
it.effect("prepares multimodal user input and tool history", () =>
|
|
55
|
+
Effect.gen(function* () {
|
|
56
|
+
const prepared = yield* LLMClient.prepare(
|
|
57
|
+
LLM.request({
|
|
58
|
+
id: "req_tool_result",
|
|
59
|
+
model,
|
|
60
|
+
tools: [
|
|
61
|
+
{
|
|
62
|
+
name: "lookup",
|
|
63
|
+
description: "Lookup data",
|
|
64
|
+
inputSchema: { type: "object", properties: { query: { type: "string" } } },
|
|
65
|
+
},
|
|
66
|
+
],
|
|
67
|
+
toolChoice: { type: "tool", name: "lookup" },
|
|
68
|
+
messages: [
|
|
69
|
+
Message.user([
|
|
70
|
+
{ type: "text", text: "What is in this image?" },
|
|
71
|
+
{ type: "media", mediaType: "image/png", data: "AAECAw==" },
|
|
72
|
+
]),
|
|
73
|
+
Message.assistant([ToolCallPart.make({ id: "call_1", name: "lookup", input: { query: "weather" } })]),
|
|
74
|
+
Message.tool({ id: "call_1", name: "lookup", result: { forecast: "sunny" } }),
|
|
75
|
+
],
|
|
76
|
+
}),
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
expect(prepared.body).toEqual({
|
|
80
|
+
contents: [
|
|
81
|
+
{
|
|
82
|
+
role: "user",
|
|
83
|
+
parts: [{ text: "What is in this image?" }, { inlineData: { mimeType: "image/png", data: "AAECAw==" } }],
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
role: "model",
|
|
87
|
+
parts: [{ functionCall: { name: "lookup", args: { query: "weather" } } }],
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
role: "user",
|
|
91
|
+
parts: [
|
|
92
|
+
{ functionResponse: { name: "lookup", response: { name: "lookup", content: '{"forecast":"sunny"}' } } },
|
|
93
|
+
],
|
|
94
|
+
},
|
|
95
|
+
],
|
|
96
|
+
tools: [
|
|
97
|
+
{
|
|
98
|
+
functionDeclarations: [
|
|
99
|
+
{
|
|
100
|
+
name: "lookup",
|
|
101
|
+
description: "Lookup data",
|
|
102
|
+
parameters: { type: "object", properties: { query: { type: "string" } } },
|
|
103
|
+
},
|
|
104
|
+
],
|
|
105
|
+
},
|
|
106
|
+
],
|
|
107
|
+
toolConfig: { functionCallingConfig: { mode: "ANY", allowedFunctionNames: ["lookup"] } },
|
|
108
|
+
})
|
|
109
|
+
}),
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
it.effect("omits tools when tool choice is none", () =>
|
|
113
|
+
Effect.gen(function* () {
|
|
114
|
+
const prepared = yield* LLMClient.prepare(
|
|
115
|
+
LLM.request({
|
|
116
|
+
id: "req_no_tools",
|
|
117
|
+
model,
|
|
118
|
+
prompt: "Say hello.",
|
|
119
|
+
tools: [{ name: "lookup", description: "Lookup data", inputSchema: { type: "object" } }],
|
|
120
|
+
toolChoice: { type: "none" },
|
|
121
|
+
}),
|
|
122
|
+
)
|
|
123
|
+
|
|
124
|
+
expect(prepared.body).toEqual({
|
|
125
|
+
contents: [{ role: "user", parts: [{ text: "Say hello." }] }],
|
|
126
|
+
})
|
|
127
|
+
}),
|
|
128
|
+
)
|
|
129
|
+
|
|
130
|
+
it.effect("sanitizes integer enums, dangling required, untyped arrays, and scalar object keys", () =>
|
|
131
|
+
Effect.gen(function* () {
|
|
132
|
+
const prepared = yield* LLMClient.prepare(
|
|
133
|
+
LLM.request({
|
|
134
|
+
id: "req_schema_patch",
|
|
135
|
+
model,
|
|
136
|
+
prompt: "Use the tool.",
|
|
137
|
+
tools: [
|
|
138
|
+
{
|
|
139
|
+
name: "lookup",
|
|
140
|
+
description: "Lookup data",
|
|
141
|
+
inputSchema: {
|
|
142
|
+
type: "object",
|
|
143
|
+
required: ["status", "missing"],
|
|
144
|
+
properties: {
|
|
145
|
+
status: { type: "integer", enum: [1, 2] },
|
|
146
|
+
tags: { type: "array" },
|
|
147
|
+
name: { type: "string", properties: { ignored: { type: "string" } }, required: ["ignored"] },
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
],
|
|
152
|
+
}),
|
|
153
|
+
)
|
|
154
|
+
|
|
155
|
+
expect(prepared.body).toMatchObject({
|
|
156
|
+
tools: [
|
|
157
|
+
{
|
|
158
|
+
functionDeclarations: [
|
|
159
|
+
{
|
|
160
|
+
parameters: {
|
|
161
|
+
type: "object",
|
|
162
|
+
required: ["status"],
|
|
163
|
+
properties: {
|
|
164
|
+
status: { type: "string", enum: ["1", "2"] },
|
|
165
|
+
tags: { type: "array", items: { type: "string" } },
|
|
166
|
+
name: { type: "string" },
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
],
|
|
171
|
+
},
|
|
172
|
+
],
|
|
173
|
+
})
|
|
174
|
+
}),
|
|
175
|
+
)
|
|
176
|
+
|
|
177
|
+
it.effect("parses text, reasoning, and usage stream fixtures", () =>
|
|
178
|
+
Effect.gen(function* () {
|
|
179
|
+
const body = sseEvents(
|
|
180
|
+
{
|
|
181
|
+
candidates: [
|
|
182
|
+
{
|
|
183
|
+
content: { role: "model", parts: [{ text: "thinking", thought: true }] },
|
|
184
|
+
},
|
|
185
|
+
],
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
candidates: [
|
|
189
|
+
{
|
|
190
|
+
content: { role: "model", parts: [{ text: "Hello" }] },
|
|
191
|
+
},
|
|
192
|
+
],
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
candidates: [
|
|
196
|
+
{
|
|
197
|
+
content: { role: "model", parts: [{ text: "!" }] },
|
|
198
|
+
finishReason: "STOP",
|
|
199
|
+
},
|
|
200
|
+
],
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
usageMetadata: {
|
|
204
|
+
promptTokenCount: 5,
|
|
205
|
+
candidatesTokenCount: 2,
|
|
206
|
+
totalTokenCount: 7,
|
|
207
|
+
thoughtsTokenCount: 1,
|
|
208
|
+
cachedContentTokenCount: 1,
|
|
209
|
+
},
|
|
210
|
+
},
|
|
211
|
+
)
|
|
212
|
+
const response = yield* LLMClient.generate(request).pipe(Effect.provide(fixedResponse(body)))
|
|
213
|
+
|
|
214
|
+
expect(response.text).toBe("Hello!")
|
|
215
|
+
expect(response.reasoning).toBe("thinking")
|
|
216
|
+
expect(response.usage).toMatchObject({
|
|
217
|
+
inputTokens: 5,
|
|
218
|
+
outputTokens: 3,
|
|
219
|
+
nonCachedInputTokens: 4,
|
|
220
|
+
cacheReadInputTokens: 1,
|
|
221
|
+
reasoningTokens: 1,
|
|
222
|
+
totalTokens: 7,
|
|
223
|
+
})
|
|
224
|
+
const usage = new Usage({
|
|
225
|
+
inputTokens: 5,
|
|
226
|
+
outputTokens: 3,
|
|
227
|
+
nonCachedInputTokens: 4,
|
|
228
|
+
cacheReadInputTokens: 1,
|
|
229
|
+
reasoningTokens: 1,
|
|
230
|
+
totalTokens: 7,
|
|
231
|
+
providerMetadata: {
|
|
232
|
+
google: {
|
|
233
|
+
promptTokenCount: 5,
|
|
234
|
+
candidatesTokenCount: 2,
|
|
235
|
+
totalTokenCount: 7,
|
|
236
|
+
thoughtsTokenCount: 1,
|
|
237
|
+
cachedContentTokenCount: 1,
|
|
238
|
+
},
|
|
239
|
+
},
|
|
240
|
+
})
|
|
241
|
+
expect(response.events).toEqual([
|
|
242
|
+
{ type: "step-start", index: 0 },
|
|
243
|
+
{ type: "reasoning-start", id: "reasoning-0" },
|
|
244
|
+
{ type: "reasoning-delta", id: "reasoning-0", text: "thinking" },
|
|
245
|
+
{ type: "text-start", id: "text-0" },
|
|
246
|
+
{ type: "text-delta", id: "text-0", text: "Hello" },
|
|
247
|
+
{ type: "text-delta", id: "text-0", text: "!" },
|
|
248
|
+
{ type: "reasoning-end", id: "reasoning-0" },
|
|
249
|
+
{ type: "text-end", id: "text-0" },
|
|
250
|
+
{ type: "step-finish", index: 0, reason: "stop", usage, providerMetadata: undefined },
|
|
251
|
+
{
|
|
252
|
+
type: "finish",
|
|
253
|
+
reason: "stop",
|
|
254
|
+
usage,
|
|
255
|
+
},
|
|
256
|
+
])
|
|
257
|
+
}),
|
|
258
|
+
)
|
|
259
|
+
|
|
260
|
+
it.effect("preserves thoughtSignature for reasoning and tool-call continuation", () =>
|
|
261
|
+
Effect.gen(function* () {
|
|
262
|
+
const body = sseEvents({
|
|
263
|
+
candidates: [
|
|
264
|
+
{
|
|
265
|
+
content: {
|
|
266
|
+
role: "model",
|
|
267
|
+
parts: [
|
|
268
|
+
{ text: "thinking", thought: true },
|
|
269
|
+
{ text: "", thought: true, thoughtSignature: "thought_sig" },
|
|
270
|
+
{ functionCall: { name: "lookup", args: { query: "weather" } }, thoughtSignature: "tool_sig" },
|
|
271
|
+
],
|
|
272
|
+
},
|
|
273
|
+
finishReason: "STOP",
|
|
274
|
+
},
|
|
275
|
+
],
|
|
276
|
+
})
|
|
277
|
+
const response = yield* LLMClient.generate(
|
|
278
|
+
LLM.updateRequest(request, {
|
|
279
|
+
tools: [{ name: "lookup", description: "Lookup data", inputSchema: { type: "object" } }],
|
|
280
|
+
}),
|
|
281
|
+
).pipe(Effect.provide(fixedResponse(body)))
|
|
282
|
+
const reasoning = response.events.find((event) => event.type === "reasoning-start")
|
|
283
|
+
const reasoningEnd = response.events.find((event) => event.type === "reasoning-end")
|
|
284
|
+
const toolCall = response.events.find((event) => event.type === "tool-call")
|
|
285
|
+
|
|
286
|
+
expect(reasoning).toEqual({
|
|
287
|
+
type: "reasoning-start",
|
|
288
|
+
id: "reasoning-0",
|
|
289
|
+
providerMetadata: undefined,
|
|
290
|
+
})
|
|
291
|
+
expect(reasoningEnd).toEqual({
|
|
292
|
+
type: "reasoning-end",
|
|
293
|
+
id: "reasoning-0",
|
|
294
|
+
providerMetadata: { google: { thoughtSignature: "thought_sig" } },
|
|
295
|
+
})
|
|
296
|
+
expect(toolCall).toMatchObject({ providerMetadata: { google: { thoughtSignature: "tool_sig" } } })
|
|
297
|
+
|
|
298
|
+
const prepared = yield* LLMClient.prepare<Gemini.GeminiBody>(
|
|
299
|
+
LLM.request({
|
|
300
|
+
model,
|
|
301
|
+
messages: [
|
|
302
|
+
Message.assistant([
|
|
303
|
+
{ type: "reasoning", text: "thinking", providerMetadata: reasoningEnd?.providerMetadata },
|
|
304
|
+
ToolCallPart.make({
|
|
305
|
+
id: "tool_0",
|
|
306
|
+
name: "lookup",
|
|
307
|
+
input: { query: "weather" },
|
|
308
|
+
providerMetadata: toolCall?.providerMetadata,
|
|
309
|
+
}),
|
|
310
|
+
]),
|
|
311
|
+
],
|
|
312
|
+
}),
|
|
313
|
+
)
|
|
314
|
+
expect(prepared.body.contents).toEqual([
|
|
315
|
+
{
|
|
316
|
+
role: "model",
|
|
317
|
+
parts: [
|
|
318
|
+
{ text: "thinking", thought: true, thoughtSignature: "thought_sig" },
|
|
319
|
+
{ functionCall: { name: "lookup", args: { query: "weather" } }, thoughtSignature: "tool_sig" },
|
|
320
|
+
],
|
|
321
|
+
},
|
|
322
|
+
])
|
|
323
|
+
}),
|
|
324
|
+
)
|
|
325
|
+
|
|
326
|
+
it.effect("emits streamed tool calls and maps finish reason", () =>
|
|
327
|
+
Effect.gen(function* () {
|
|
328
|
+
const body = sseEvents({
|
|
329
|
+
candidates: [
|
|
330
|
+
{
|
|
331
|
+
content: {
|
|
332
|
+
role: "model",
|
|
333
|
+
parts: [{ functionCall: { name: "lookup", args: { query: "weather" } } }],
|
|
334
|
+
},
|
|
335
|
+
finishReason: "STOP",
|
|
336
|
+
},
|
|
337
|
+
],
|
|
338
|
+
usageMetadata: { promptTokenCount: 5, candidatesTokenCount: 1 },
|
|
339
|
+
})
|
|
340
|
+
const response = yield* LLMClient.generate(
|
|
341
|
+
LLM.updateRequest(request, {
|
|
342
|
+
tools: [{ name: "lookup", description: "Lookup data", inputSchema: { type: "object" } }],
|
|
343
|
+
}),
|
|
344
|
+
).pipe(Effect.provide(fixedResponse(body)))
|
|
345
|
+
const usage = new Usage({
|
|
346
|
+
inputTokens: 5,
|
|
347
|
+
outputTokens: 1,
|
|
348
|
+
nonCachedInputTokens: 5,
|
|
349
|
+
cacheReadInputTokens: undefined,
|
|
350
|
+
reasoningTokens: undefined,
|
|
351
|
+
totalTokens: 6,
|
|
352
|
+
providerMetadata: { google: { promptTokenCount: 5, candidatesTokenCount: 1 } },
|
|
353
|
+
})
|
|
354
|
+
|
|
355
|
+
expect(response.toolCalls).toEqual([
|
|
356
|
+
{
|
|
357
|
+
type: "tool-call",
|
|
358
|
+
id: "tool_0",
|
|
359
|
+
name: "lookup",
|
|
360
|
+
input: { query: "weather" },
|
|
361
|
+
providerExecuted: undefined,
|
|
362
|
+
providerMetadata: undefined,
|
|
363
|
+
},
|
|
364
|
+
])
|
|
365
|
+
expect(response.events).toEqual([
|
|
366
|
+
{ type: "step-start", index: 0 },
|
|
367
|
+
{
|
|
368
|
+
type: "tool-call",
|
|
369
|
+
id: "tool_0",
|
|
370
|
+
name: "lookup",
|
|
371
|
+
input: { query: "weather" },
|
|
372
|
+
providerExecuted: undefined,
|
|
373
|
+
providerMetadata: undefined,
|
|
374
|
+
},
|
|
375
|
+
{ type: "step-finish", index: 0, reason: "tool-calls", usage, providerMetadata: undefined },
|
|
376
|
+
{
|
|
377
|
+
type: "finish",
|
|
378
|
+
reason: "tool-calls",
|
|
379
|
+
usage,
|
|
380
|
+
},
|
|
381
|
+
])
|
|
382
|
+
}),
|
|
383
|
+
)
|
|
384
|
+
|
|
385
|
+
it.effect("assigns unique ids to multiple streamed tool calls", () =>
|
|
386
|
+
Effect.gen(function* () {
|
|
387
|
+
const body = sseEvents({
|
|
388
|
+
candidates: [
|
|
389
|
+
{
|
|
390
|
+
content: {
|
|
391
|
+
role: "model",
|
|
392
|
+
parts: [
|
|
393
|
+
{ functionCall: { name: "lookup", args: { query: "weather" } } },
|
|
394
|
+
{ functionCall: { name: "lookup", args: { query: "news" } } },
|
|
395
|
+
],
|
|
396
|
+
},
|
|
397
|
+
finishReason: "STOP",
|
|
398
|
+
},
|
|
399
|
+
],
|
|
400
|
+
})
|
|
401
|
+
const response = yield* LLMClient.generate(
|
|
402
|
+
LLM.updateRequest(request, {
|
|
403
|
+
tools: [{ name: "lookup", description: "Lookup data", inputSchema: { type: "object" } }],
|
|
404
|
+
}),
|
|
405
|
+
).pipe(Effect.provide(fixedResponse(body)))
|
|
406
|
+
|
|
407
|
+
expect(response.toolCalls).toEqual([
|
|
408
|
+
{ type: "tool-call", id: "tool_0", name: "lookup", input: { query: "weather" } },
|
|
409
|
+
{ type: "tool-call", id: "tool_1", name: "lookup", input: { query: "news" } },
|
|
410
|
+
])
|
|
411
|
+
expect(response.events.at(-1)).toMatchObject({ type: "finish", reason: "tool-calls" })
|
|
412
|
+
}),
|
|
413
|
+
)
|
|
414
|
+
|
|
415
|
+
it.effect("maps length and content-filter finish reasons", () =>
|
|
416
|
+
Effect.gen(function* () {
|
|
417
|
+
const length = yield* LLMClient.generate(request).pipe(
|
|
418
|
+
Effect.provide(
|
|
419
|
+
fixedResponse(
|
|
420
|
+
sseEvents({ candidates: [{ content: { role: "model", parts: [] }, finishReason: "MAX_TOKENS" }] }),
|
|
421
|
+
),
|
|
422
|
+
),
|
|
423
|
+
)
|
|
424
|
+
const filtered = yield* LLMClient.generate(request).pipe(
|
|
425
|
+
Effect.provide(
|
|
426
|
+
fixedResponse(sseEvents({ candidates: [{ content: { role: "model", parts: [] }, finishReason: "SAFETY" }] })),
|
|
427
|
+
),
|
|
428
|
+
)
|
|
429
|
+
|
|
430
|
+
expect(length.events.map((event) => event.type)).toEqual(["step-start", "step-finish", "finish"])
|
|
431
|
+
expect(length.events.at(-1)).toMatchObject({ type: "finish", reason: "length" })
|
|
432
|
+
expect(filtered.events.map((event) => event.type)).toEqual(["step-start", "step-finish", "finish"])
|
|
433
|
+
expect(filtered.events.at(-1)).toMatchObject({ type: "finish", reason: "content-filter" })
|
|
434
|
+
}),
|
|
435
|
+
)
|
|
436
|
+
|
|
437
|
+
it.effect("leaves total usage undefined when component counts are missing", () =>
|
|
438
|
+
Effect.gen(function* () {
|
|
439
|
+
const response = yield* LLMClient.generate(request).pipe(
|
|
440
|
+
Effect.provide(fixedResponse(sseEvents({ usageMetadata: { thoughtsTokenCount: 1 } }))),
|
|
441
|
+
)
|
|
442
|
+
|
|
443
|
+
expect(response.usage).toMatchObject({ reasoningTokens: 1 })
|
|
444
|
+
expect(response.usage?.totalTokens).toBeUndefined()
|
|
445
|
+
}),
|
|
446
|
+
)
|
|
447
|
+
|
|
448
|
+
it.effect("fails invalid stream events", () =>
|
|
449
|
+
Effect.gen(function* () {
|
|
450
|
+
const error = yield* LLMClient.generate(request).pipe(
|
|
451
|
+
Effect.provide(fixedResponse(sseRaw("data: {not json}"))),
|
|
452
|
+
Effect.flip,
|
|
453
|
+
)
|
|
454
|
+
|
|
455
|
+
expect(error).toBeInstanceOf(LLMError)
|
|
456
|
+
expect(error.reason).toMatchObject({ _tag: "InvalidProviderOutput" })
|
|
457
|
+
expect(error.message).toContain("Invalid google/gemini stream event")
|
|
458
|
+
}),
|
|
459
|
+
)
|
|
460
|
+
|
|
461
|
+
it.effect("rejects unsupported assistant media content", () =>
|
|
462
|
+
Effect.gen(function* () {
|
|
463
|
+
const error = yield* LLMClient.prepare(
|
|
464
|
+
LLM.request({
|
|
465
|
+
id: "req_media",
|
|
466
|
+
model,
|
|
467
|
+
messages: [Message.assistant({ type: "media", mediaType: "image/png", data: "AAECAw==" })],
|
|
468
|
+
}),
|
|
469
|
+
).pipe(Effect.flip)
|
|
470
|
+
|
|
471
|
+
expect(error.message).toContain(
|
|
472
|
+
"Gemini assistant messages only support text, reasoning, and tool-call content for now",
|
|
473
|
+
)
|
|
474
|
+
}),
|
|
475
|
+
)
|
|
476
|
+
})
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import { Redactor } from "@codilore/http-recorder"
|
|
2
|
+
import * as Anthropic from "../../src/providers/anthropic"
|
|
3
|
+
import { CloudflareAIGateway, CloudflareWorkersAI } from "../../src/providers/cloudflare"
|
|
4
|
+
import * as Google from "../../src/providers/google"
|
|
5
|
+
import * as OpenAI from "../../src/providers/openai"
|
|
6
|
+
import * as OpenAICompatible from "../../src/providers/openai-compatible"
|
|
7
|
+
import * as OpenRouter from "../../src/providers/openrouter"
|
|
8
|
+
import * as XAI from "../../src/providers/xai"
|
|
9
|
+
import { describeRecordedGoldenScenarios } from "../recorded-golden"
|
|
10
|
+
|
|
11
|
+
const openAI = OpenAI.configure({
|
|
12
|
+
apiKey: process.env.OPENAI_API_KEY ?? "fixture",
|
|
13
|
+
})
|
|
14
|
+
const openAIChat = openAI.chat("gpt-4o-mini")
|
|
15
|
+
const openAIResponses = openAI.responses("gpt-5.5")
|
|
16
|
+
const openAIResponsesWebSocket = openAI.responsesWebSocket("gpt-4.1-mini")
|
|
17
|
+
const anthropic = Anthropic.configure({
|
|
18
|
+
apiKey: process.env.ANTHROPIC_API_KEY ?? "fixture",
|
|
19
|
+
})
|
|
20
|
+
const anthropicHaiku = anthropic.model("claude-haiku-4-5-20251001")
|
|
21
|
+
const anthropicOpus = anthropic.model("claude-opus-4-7")
|
|
22
|
+
const google = Google.configure({ apiKey: process.env.GOOGLE_GENERATIVE_AI_API_KEY ?? "fixture" })
|
|
23
|
+
const gemini = google.model("gemini-2.5-flash")
|
|
24
|
+
const xai = XAI.configure({ apiKey: process.env.XAI_API_KEY ?? "fixture" })
|
|
25
|
+
const xaiBasic = xai.model("grok-3-mini")
|
|
26
|
+
const xaiFlagship = xai.model("grok-4.3")
|
|
27
|
+
const cloudflareAIGateway = CloudflareAIGateway.configure({
|
|
28
|
+
accountId: process.env.CLOUDFLARE_ACCOUNT_ID ?? "fixture-account",
|
|
29
|
+
gatewayId:
|
|
30
|
+
process.env.CLOUDFLARE_GATEWAY_ID && process.env.CLOUDFLARE_GATEWAY_ID !== process.env.CLOUDFLARE_ACCOUNT_ID
|
|
31
|
+
? process.env.CLOUDFLARE_GATEWAY_ID
|
|
32
|
+
: undefined,
|
|
33
|
+
gatewayApiKey: process.env.CLOUDFLARE_API_TOKEN ?? "fixture",
|
|
34
|
+
})
|
|
35
|
+
const cloudflareWorkers = CloudflareWorkersAI.configure({
|
|
36
|
+
accountId: process.env.CLOUDFLARE_ACCOUNT_ID ?? "fixture-account",
|
|
37
|
+
apiKey: process.env.CLOUDFLARE_API_KEY ?? "fixture",
|
|
38
|
+
})
|
|
39
|
+
const cloudflareAIGatewayWorkers = cloudflareAIGateway.model("workers-ai/@cf/meta/llama-3.1-8b-instruct")
|
|
40
|
+
const cloudflareAIGatewayWorkersTools = cloudflareAIGateway.model("workers-ai/@cf/openai/gpt-oss-20b")
|
|
41
|
+
const cloudflareWorkersAI = cloudflareWorkers.model("@cf/meta/llama-3.1-8b-instruct")
|
|
42
|
+
const cloudflareWorkersAITools = cloudflareWorkers.model("@cf/openai/gpt-oss-20b")
|
|
43
|
+
const deepseek = OpenAICompatible.deepseek
|
|
44
|
+
.configure({ apiKey: process.env.DEEPSEEK_API_KEY ?? "fixture" })
|
|
45
|
+
.model("deepseek-chat")
|
|
46
|
+
const together = OpenAICompatible.togetherai
|
|
47
|
+
.configure({
|
|
48
|
+
apiKey: process.env.TOGETHER_AI_API_KEY ?? "fixture",
|
|
49
|
+
})
|
|
50
|
+
.model("meta-llama/Llama-3.3-70B-Instruct-Turbo")
|
|
51
|
+
const groq = OpenAICompatible.groq
|
|
52
|
+
.configure({ apiKey: process.env.GROQ_API_KEY ?? "fixture" })
|
|
53
|
+
.model("llama-3.3-70b-versatile")
|
|
54
|
+
const openRouter = OpenRouter.configure({ apiKey: process.env.OPENROUTER_API_KEY ?? "fixture" })
|
|
55
|
+
const openrouter = openRouter.model("openai/gpt-4o-mini")
|
|
56
|
+
const openrouterGpt55 = openRouter.model("openai/gpt-5.5")
|
|
57
|
+
const openrouterOpus = OpenRouter.configure({
|
|
58
|
+
apiKey: process.env.OPENROUTER_API_KEY ?? "fixture",
|
|
59
|
+
}).model("anthropic/claude-opus-4.7")
|
|
60
|
+
|
|
61
|
+
const redactCloudflareURL = (url: string) =>
|
|
62
|
+
url
|
|
63
|
+
.replace(/\/client\/v4\/accounts\/[^/]+\/ai\/v1\//, "/client/v4/accounts/{account}/ai/v1/")
|
|
64
|
+
.replace(/\/v1\/[^/]+\/[^/]+\/compat\//, "/v1/{account}/{gateway}/compat/")
|
|
65
|
+
|
|
66
|
+
const cloudflareOptions = {
|
|
67
|
+
redactor: Redactor.defaults({ url: { transform: redactCloudflareURL } }),
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
describeRecordedGoldenScenarios([
|
|
71
|
+
{
|
|
72
|
+
name: "OpenAI Chat gpt-4o-mini",
|
|
73
|
+
prefix: "openai-chat",
|
|
74
|
+
model: openAIChat,
|
|
75
|
+
requires: ["OPENAI_API_KEY"],
|
|
76
|
+
scenarios: ["text", "tool-call", "tool-loop"],
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
name: "OpenAI Responses gpt-5.5",
|
|
80
|
+
prefix: "openai-responses",
|
|
81
|
+
model: openAIResponses,
|
|
82
|
+
requires: ["OPENAI_API_KEY"],
|
|
83
|
+
tags: ["flagship"],
|
|
84
|
+
scenarios: [
|
|
85
|
+
{ id: "text", temperature: false },
|
|
86
|
+
{ id: "reasoning", temperature: false },
|
|
87
|
+
{ id: "reasoning-continuation", temperature: false },
|
|
88
|
+
{ id: "tool-call", temperature: false },
|
|
89
|
+
{ id: "tool-loop", temperature: false },
|
|
90
|
+
{ id: "image-tool-result", temperature: false, maxTokens: 40 },
|
|
91
|
+
],
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
name: "OpenAI Responses WebSocket gpt-4.1-mini",
|
|
95
|
+
prefix: "openai-responses-websocket",
|
|
96
|
+
model: openAIResponsesWebSocket,
|
|
97
|
+
transport: "websocket",
|
|
98
|
+
requires: ["OPENAI_API_KEY"],
|
|
99
|
+
scenarios: ["tool-loop"],
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
name: "Anthropic Haiku 4.5",
|
|
103
|
+
prefix: "anthropic-messages",
|
|
104
|
+
model: anthropicHaiku,
|
|
105
|
+
requires: ["ANTHROPIC_API_KEY"],
|
|
106
|
+
options: { redactor: Redactor.defaults({ requestHeaders: { allow: ["content-type", "anthropic-version"] } }) },
|
|
107
|
+
scenarios: ["text", "tool-call"],
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
name: "Anthropic Opus 4.7",
|
|
111
|
+
prefix: "anthropic-messages",
|
|
112
|
+
model: anthropicOpus,
|
|
113
|
+
requires: ["ANTHROPIC_API_KEY"],
|
|
114
|
+
tags: ["flagship"],
|
|
115
|
+
options: { redactor: Redactor.defaults({ requestHeaders: { allow: ["content-type", "anthropic-version"] } }) },
|
|
116
|
+
scenarios: [
|
|
117
|
+
{ id: "tool-loop", temperature: false },
|
|
118
|
+
{ id: "image-tool-result", temperature: false, maxTokens: 40 },
|
|
119
|
+
],
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
name: "Gemini 2.5 Flash",
|
|
123
|
+
prefix: "gemini",
|
|
124
|
+
model: gemini,
|
|
125
|
+
requires: ["GOOGLE_GENERATIVE_AI_API_KEY"],
|
|
126
|
+
scenarios: [{ id: "text", maxTokens: 80 }, "tool-call", { id: "image", maxTokens: 160 }],
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
name: "xAI Grok 3 Mini",
|
|
130
|
+
prefix: "xai",
|
|
131
|
+
model: xaiBasic,
|
|
132
|
+
requires: ["XAI_API_KEY"],
|
|
133
|
+
scenarios: ["text", "tool-call"],
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
name: "xAI Grok 4.3",
|
|
137
|
+
prefix: "xai",
|
|
138
|
+
model: xaiFlagship,
|
|
139
|
+
requires: ["XAI_API_KEY"],
|
|
140
|
+
tags: ["flagship"],
|
|
141
|
+
scenarios: [{ id: "tool-loop", timeout: 30_000 }],
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
name: "Cloudflare AI Gateway Workers AI Llama 3.1 8B",
|
|
145
|
+
prefix: "cloudflare-ai-gateway",
|
|
146
|
+
model: cloudflareAIGatewayWorkers,
|
|
147
|
+
requires: ["CLOUDFLARE_ACCOUNT_ID", "CLOUDFLARE_API_TOKEN"],
|
|
148
|
+
options: cloudflareOptions,
|
|
149
|
+
scenarios: ["text"],
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
name: "Cloudflare AI Gateway Workers AI GPT OSS 20B Tools",
|
|
153
|
+
prefix: "cloudflare-ai-gateway",
|
|
154
|
+
model: cloudflareAIGatewayWorkersTools,
|
|
155
|
+
requires: ["CLOUDFLARE_ACCOUNT_ID", "CLOUDFLARE_API_TOKEN"],
|
|
156
|
+
options: cloudflareOptions,
|
|
157
|
+
scenarios: [{ id: "tool-call", maxTokens: 120 }],
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
name: "Cloudflare Workers AI Llama 3.1 8B",
|
|
161
|
+
prefix: "cloudflare-workers-ai",
|
|
162
|
+
model: cloudflareWorkersAI,
|
|
163
|
+
requires: ["CLOUDFLARE_ACCOUNT_ID", "CLOUDFLARE_API_KEY"],
|
|
164
|
+
options: cloudflareOptions,
|
|
165
|
+
scenarios: ["text"],
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
name: "Cloudflare Workers AI GPT OSS 20B Tools",
|
|
169
|
+
prefix: "cloudflare-workers-ai",
|
|
170
|
+
model: cloudflareWorkersAITools,
|
|
171
|
+
requires: ["CLOUDFLARE_ACCOUNT_ID", "CLOUDFLARE_API_KEY"],
|
|
172
|
+
options: cloudflareOptions,
|
|
173
|
+
scenarios: [{ id: "tool-call", maxTokens: 120 }],
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
name: "DeepSeek Chat",
|
|
177
|
+
prefix: "openai-compatible-chat",
|
|
178
|
+
model: deepseek,
|
|
179
|
+
requires: ["DEEPSEEK_API_KEY"],
|
|
180
|
+
scenarios: ["text"],
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
name: "TogetherAI Llama 3.3 70B",
|
|
184
|
+
prefix: "openai-compatible-chat",
|
|
185
|
+
model: together,
|
|
186
|
+
requires: ["TOGETHER_AI_API_KEY"],
|
|
187
|
+
scenarios: ["text", "tool-call"],
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
name: "Groq Llama 3.3 70B",
|
|
191
|
+
prefix: "openai-compatible-chat",
|
|
192
|
+
model: groq,
|
|
193
|
+
requires: ["GROQ_API_KEY"],
|
|
194
|
+
scenarios: ["text", "tool-call", { id: "tool-loop", timeout: 30_000 }],
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
name: "OpenRouter gpt-4o-mini",
|
|
198
|
+
prefix: "openai-compatible-chat",
|
|
199
|
+
model: openrouter,
|
|
200
|
+
requires: ["OPENROUTER_API_KEY"],
|
|
201
|
+
scenarios: ["text", "tool-call", "tool-loop"],
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
name: "OpenRouter gpt-5.5",
|
|
205
|
+
prefix: "openai-compatible-chat",
|
|
206
|
+
model: openrouterGpt55,
|
|
207
|
+
requires: ["OPENROUTER_API_KEY"],
|
|
208
|
+
tags: ["flagship"],
|
|
209
|
+
scenarios: ["tool-loop"],
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
name: "OpenRouter Claude Opus 4.7",
|
|
213
|
+
prefix: "openai-compatible-chat",
|
|
214
|
+
model: openrouterOpus,
|
|
215
|
+
requires: ["OPENROUTER_API_KEY"],
|
|
216
|
+
tags: ["flagship"],
|
|
217
|
+
scenarios: ["tool-loop"],
|
|
218
|
+
},
|
|
219
|
+
])
|