@hebo-ai/gateway 0.6.0 → 0.6.1-rc0
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/dist/endpoints/chat-completions/converters.js +2 -2
- package/dist/endpoints/chat-completions/otel.js +1 -1
- package/dist/endpoints/chat-completions/schema.d.ts +9 -9
- package/dist/endpoints/chat-completions/schema.js +2 -2
- package/dist/models/anthropic/presets.d.ts +47 -47
- package/package.json +1 -1
- package/src/endpoints/chat-completions/converters.test.ts +2 -2
- package/src/endpoints/chat-completions/converters.ts +2 -2
- package/src/endpoints/chat-completions/otel.test.ts +49 -0
- package/src/endpoints/chat-completions/otel.ts +3 -1
- package/src/endpoints/chat-completions/schema.ts +2 -2
|
@@ -436,7 +436,7 @@ export class ChatCompletionsStream extends TransformStream {
|
|
|
436
436
|
reasoningIdToIndex.set(part.id, index);
|
|
437
437
|
}
|
|
438
438
|
controller.enqueue(createChunk({
|
|
439
|
-
|
|
439
|
+
reasoning: part.text,
|
|
440
440
|
reasoning_details: [
|
|
441
441
|
toReasoningDetail({
|
|
442
442
|
type: "reasoning",
|
|
@@ -507,7 +507,7 @@ export const toChatCompletionsAssistantMessage = (result) => {
|
|
|
507
507
|
}
|
|
508
508
|
}
|
|
509
509
|
if (result.reasoningText) {
|
|
510
|
-
message.
|
|
510
|
+
message.reasoning = result.reasoningText;
|
|
511
511
|
if (reasoningDetails.length === 0) {
|
|
512
512
|
reasoningDetails.push(toReasoningDetail({ type: "reasoning", text: result.reasoningText }, `reasoning-${crypto.randomUUID()}`, 0));
|
|
513
513
|
}
|
|
@@ -101,7 +101,7 @@ export const getChatRequestAttributes = (inputs, signalLevel) => {
|
|
|
101
101
|
"gen_ai.input.messages": inputs.messages
|
|
102
102
|
//.filter((m) => m.role !== "system")
|
|
103
103
|
.map((m) => JSON.stringify({ role: m.role, parts: toMessageParts(m) })),
|
|
104
|
-
"gen_ai.tool.definitions": JSON.stringify(
|
|
104
|
+
"gen_ai.tool.definitions": inputs.tools?.map((toolDefinition) => JSON.stringify(toolDefinition)),
|
|
105
105
|
});
|
|
106
106
|
}
|
|
107
107
|
return attrs;
|
|
@@ -234,7 +234,7 @@ export declare const ChatCompletionsAssistantMessageSchema: z.ZodObject<{
|
|
|
234
234
|
}, z.core.$strip>;
|
|
235
235
|
extra_content: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
236
236
|
}, z.core.$strip>>>;
|
|
237
|
-
|
|
237
|
+
reasoning: z.ZodOptional<z.ZodString>;
|
|
238
238
|
reasoning_details: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
239
239
|
id: z.ZodOptional<z.ZodString>;
|
|
240
240
|
index: z.ZodInt;
|
|
@@ -355,7 +355,7 @@ export declare const ChatCompletionsMessageSchema: z.ZodDiscriminatedUnion<[z.Zo
|
|
|
355
355
|
}, z.core.$strip>;
|
|
356
356
|
extra_content: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
357
357
|
}, z.core.$strip>>>;
|
|
358
|
-
|
|
358
|
+
reasoning: z.ZodOptional<z.ZodString>;
|
|
359
359
|
reasoning_details: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
360
360
|
id: z.ZodOptional<z.ZodString>;
|
|
361
361
|
index: z.ZodInt;
|
|
@@ -560,7 +560,7 @@ declare const ChatCompletionsInputsSchema: z.ZodObject<{
|
|
|
560
560
|
}, z.core.$strip>;
|
|
561
561
|
extra_content: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
562
562
|
}, z.core.$strip>>>;
|
|
563
|
-
|
|
563
|
+
reasoning: z.ZodOptional<z.ZodString>;
|
|
564
564
|
reasoning_details: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
565
565
|
id: z.ZodOptional<z.ZodString>;
|
|
566
566
|
index: z.ZodInt;
|
|
@@ -767,7 +767,7 @@ export declare const ChatCompletionsBodySchema: z.ZodObject<{
|
|
|
767
767
|
}, z.core.$strip>;
|
|
768
768
|
extra_content: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
769
769
|
}, z.core.$strip>>>;
|
|
770
|
-
|
|
770
|
+
reasoning: z.ZodOptional<z.ZodString>;
|
|
771
771
|
reasoning_details: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
772
772
|
id: z.ZodOptional<z.ZodString>;
|
|
773
773
|
index: z.ZodInt;
|
|
@@ -914,7 +914,7 @@ export declare const ChatCompletionsChoiceSchema: z.ZodObject<{
|
|
|
914
914
|
}, z.core.$strip>;
|
|
915
915
|
extra_content: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
916
916
|
}, z.core.$strip>>>;
|
|
917
|
-
|
|
917
|
+
reasoning: z.ZodOptional<z.ZodString>;
|
|
918
918
|
reasoning_details: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
919
919
|
id: z.ZodOptional<z.ZodString>;
|
|
920
920
|
index: z.ZodInt;
|
|
@@ -980,7 +980,7 @@ export declare const ChatCompletionsSchema: z.ZodObject<{
|
|
|
980
980
|
}, z.core.$strip>;
|
|
981
981
|
extra_content: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
982
982
|
}, z.core.$strip>>>;
|
|
983
|
-
|
|
983
|
+
reasoning: z.ZodOptional<z.ZodString>;
|
|
984
984
|
reasoning_details: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
985
985
|
id: z.ZodOptional<z.ZodString>;
|
|
986
986
|
index: z.ZodInt;
|
|
@@ -1042,7 +1042,7 @@ export declare const ChatCompletionsAssistantMessageDeltaSchema: z.ZodObject<{
|
|
|
1042
1042
|
}, z.core.$strip>>;
|
|
1043
1043
|
}, z.core.$strip>>]>>>;
|
|
1044
1044
|
name: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
1045
|
-
|
|
1045
|
+
reasoning: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
1046
1046
|
reasoning_details: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1047
1047
|
id: z.ZodOptional<z.ZodString>;
|
|
1048
1048
|
index: z.ZodInt;
|
|
@@ -1083,7 +1083,7 @@ export declare const ChatCompletionsChoiceDeltaSchema: z.ZodObject<{
|
|
|
1083
1083
|
}, z.core.$strip>>;
|
|
1084
1084
|
}, z.core.$strip>>]>>>;
|
|
1085
1085
|
name: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
1086
|
-
|
|
1086
|
+
reasoning: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
1087
1087
|
reasoning_details: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1088
1088
|
id: z.ZodOptional<z.ZodString>;
|
|
1089
1089
|
index: z.ZodInt;
|
|
@@ -1137,7 +1137,7 @@ export declare const ChatCompletionsChunkSchema: z.ZodObject<{
|
|
|
1137
1137
|
}, z.core.$strip>>;
|
|
1138
1138
|
}, z.core.$strip>>]>>>;
|
|
1139
1139
|
name: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
1140
|
-
|
|
1140
|
+
reasoning: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
1141
1141
|
reasoning_details: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1142
1142
|
id: z.ZodOptional<z.ZodString>;
|
|
1143
1143
|
index: z.ZodInt;
|
|
@@ -102,8 +102,8 @@ export const ChatCompletionsAssistantMessageSchema = z.object({
|
|
|
102
102
|
name: z.string().optional(),
|
|
103
103
|
// FUTURE: This should also support Custom Tool Calls
|
|
104
104
|
tool_calls: z.array(ChatCompletionsToolCallSchema).optional(),
|
|
105
|
-
// Extension origin: OpenRouter/Vercel
|
|
106
|
-
|
|
105
|
+
// Extension origin: OpenRouter/Vercel
|
|
106
|
+
reasoning: z.string().optional().meta({ extension: true }),
|
|
107
107
|
// Extension origin: OpenRouter/Vercel
|
|
108
108
|
reasoning_details: z
|
|
109
109
|
.array(ChatCompletionsReasoningDetailSchema)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { CatalogModel } from "../types";
|
|
2
2
|
export declare const claudeHaiku45: import("../../utils/preset").Preset<"anthropic/claude-haiku-4.5", CatalogModel, {
|
|
3
3
|
name: string;
|
|
4
|
-
capabilities: ("
|
|
4
|
+
capabilities: ("reasoning" | "temperature" | "attachments" | "tool_call" | "structured_output")[];
|
|
5
5
|
created: string;
|
|
6
6
|
knowledge: string;
|
|
7
7
|
modalities: {
|
|
@@ -37,7 +37,7 @@ export declare const claudeHaiku3: import("../../utils/preset").Preset<"anthropi
|
|
|
37
37
|
}>;
|
|
38
38
|
export declare const claudeSonnet45: import("../../utils/preset").Preset<"anthropic/claude-sonnet-4.5", CatalogModel, {
|
|
39
39
|
name: string;
|
|
40
|
-
capabilities: ("
|
|
40
|
+
capabilities: ("reasoning" | "temperature" | "attachments" | "tool_call" | "structured_output")[];
|
|
41
41
|
created: string;
|
|
42
42
|
knowledge: string;
|
|
43
43
|
modalities: {
|
|
@@ -49,7 +49,7 @@ export declare const claudeSonnet45: import("../../utils/preset").Preset<"anthro
|
|
|
49
49
|
}>;
|
|
50
50
|
export declare const claudeSonnet46: import("../../utils/preset").Preset<"anthropic/claude-sonnet-4.6", CatalogModel, {
|
|
51
51
|
name: string;
|
|
52
|
-
capabilities: ("
|
|
52
|
+
capabilities: ("reasoning" | "temperature" | "attachments" | "tool_call" | "structured_output")[];
|
|
53
53
|
created: string;
|
|
54
54
|
knowledge: string;
|
|
55
55
|
modalities: {
|
|
@@ -61,7 +61,7 @@ export declare const claudeSonnet46: import("../../utils/preset").Preset<"anthro
|
|
|
61
61
|
}>;
|
|
62
62
|
export declare const claudeSonnet4: import("../../utils/preset").Preset<"anthropic/claude-sonnet-4", CatalogModel, {
|
|
63
63
|
name: string;
|
|
64
|
-
capabilities: ("
|
|
64
|
+
capabilities: ("reasoning" | "temperature" | "attachments" | "tool_call" | "structured_output")[];
|
|
65
65
|
created: string;
|
|
66
66
|
knowledge: string;
|
|
67
67
|
modalities: {
|
|
@@ -73,7 +73,7 @@ export declare const claudeSonnet4: import("../../utils/preset").Preset<"anthrop
|
|
|
73
73
|
}>;
|
|
74
74
|
export declare const claudeSonnet37: import("../../utils/preset").Preset<"anthropic/claude-sonnet-3.7", CatalogModel, {
|
|
75
75
|
name: string;
|
|
76
|
-
capabilities: ("
|
|
76
|
+
capabilities: ("reasoning" | "temperature" | "attachments" | "tool_call" | "structured_output")[];
|
|
77
77
|
created: string;
|
|
78
78
|
knowledge: string;
|
|
79
79
|
modalities: {
|
|
@@ -97,7 +97,7 @@ export declare const claudeSonnet35: import("../../utils/preset").Preset<"anthro
|
|
|
97
97
|
}>;
|
|
98
98
|
export declare const claudeOpus45: import("../../utils/preset").Preset<"anthropic/claude-opus-4.5", CatalogModel, {
|
|
99
99
|
name: string;
|
|
100
|
-
capabilities: ("
|
|
100
|
+
capabilities: ("reasoning" | "temperature" | "attachments" | "tool_call" | "structured_output")[];
|
|
101
101
|
created: string;
|
|
102
102
|
knowledge: string;
|
|
103
103
|
modalities: {
|
|
@@ -109,7 +109,7 @@ export declare const claudeOpus45: import("../../utils/preset").Preset<"anthropi
|
|
|
109
109
|
}>;
|
|
110
110
|
export declare const claudeOpus46: import("../../utils/preset").Preset<"anthropic/claude-opus-4.6", CatalogModel, {
|
|
111
111
|
name: string;
|
|
112
|
-
capabilities: ("
|
|
112
|
+
capabilities: ("reasoning" | "temperature" | "attachments" | "tool_call" | "structured_output")[];
|
|
113
113
|
created: string;
|
|
114
114
|
knowledge: string;
|
|
115
115
|
modalities: {
|
|
@@ -121,7 +121,7 @@ export declare const claudeOpus46: import("../../utils/preset").Preset<"anthropi
|
|
|
121
121
|
}>;
|
|
122
122
|
export declare const claudeOpus41: import("../../utils/preset").Preset<"anthropic/claude-opus-4.1", CatalogModel, {
|
|
123
123
|
name: string;
|
|
124
|
-
capabilities: ("
|
|
124
|
+
capabilities: ("reasoning" | "temperature" | "attachments" | "tool_call" | "structured_output")[];
|
|
125
125
|
created: string;
|
|
126
126
|
knowledge: string;
|
|
127
127
|
modalities: {
|
|
@@ -133,7 +133,7 @@ export declare const claudeOpus41: import("../../utils/preset").Preset<"anthropi
|
|
|
133
133
|
}>;
|
|
134
134
|
export declare const claudeOpus4: import("../../utils/preset").Preset<"anthropic/claude-opus-4", CatalogModel, {
|
|
135
135
|
name: string;
|
|
136
|
-
capabilities: ("
|
|
136
|
+
capabilities: ("reasoning" | "temperature" | "attachments" | "tool_call" | "structured_output")[];
|
|
137
137
|
created: string;
|
|
138
138
|
knowledge: string;
|
|
139
139
|
modalities: {
|
|
@@ -146,7 +146,7 @@ export declare const claudeOpus4: import("../../utils/preset").Preset<"anthropic
|
|
|
146
146
|
export declare const claude: {
|
|
147
147
|
readonly latest: readonly [import("../../utils/preset").Preset<"anthropic/claude-sonnet-4.6", CatalogModel, {
|
|
148
148
|
name: string;
|
|
149
|
-
capabilities: ("
|
|
149
|
+
capabilities: ("reasoning" | "temperature" | "attachments" | "tool_call" | "structured_output")[];
|
|
150
150
|
created: string;
|
|
151
151
|
knowledge: string;
|
|
152
152
|
modalities: {
|
|
@@ -157,7 +157,7 @@ export declare const claude: {
|
|
|
157
157
|
providers: readonly ["anthropic", "bedrock", "vertex"];
|
|
158
158
|
}>, import("../../utils/preset").Preset<"anthropic/claude-opus-4.6", CatalogModel, {
|
|
159
159
|
name: string;
|
|
160
|
-
capabilities: ("
|
|
160
|
+
capabilities: ("reasoning" | "temperature" | "attachments" | "tool_call" | "structured_output")[];
|
|
161
161
|
created: string;
|
|
162
162
|
knowledge: string;
|
|
163
163
|
modalities: {
|
|
@@ -169,7 +169,7 @@ export declare const claude: {
|
|
|
169
169
|
}>];
|
|
170
170
|
readonly all: (import("../../utils/preset").Preset<"anthropic/claude-haiku-4.5", CatalogModel, {
|
|
171
171
|
name: string;
|
|
172
|
-
capabilities: ("
|
|
172
|
+
capabilities: ("reasoning" | "temperature" | "attachments" | "tool_call" | "structured_output")[];
|
|
173
173
|
created: string;
|
|
174
174
|
knowledge: string;
|
|
175
175
|
modalities: {
|
|
@@ -202,7 +202,7 @@ export declare const claude: {
|
|
|
202
202
|
providers: readonly ["anthropic", "bedrock", "vertex"];
|
|
203
203
|
}> | import("../../utils/preset").Preset<"anthropic/claude-sonnet-4.5", CatalogModel, {
|
|
204
204
|
name: string;
|
|
205
|
-
capabilities: ("
|
|
205
|
+
capabilities: ("reasoning" | "temperature" | "attachments" | "tool_call" | "structured_output")[];
|
|
206
206
|
created: string;
|
|
207
207
|
knowledge: string;
|
|
208
208
|
modalities: {
|
|
@@ -213,7 +213,7 @@ export declare const claude: {
|
|
|
213
213
|
providers: readonly ["anthropic", "bedrock", "vertex"];
|
|
214
214
|
}> | import("../../utils/preset").Preset<"anthropic/claude-sonnet-4.6", CatalogModel, {
|
|
215
215
|
name: string;
|
|
216
|
-
capabilities: ("
|
|
216
|
+
capabilities: ("reasoning" | "temperature" | "attachments" | "tool_call" | "structured_output")[];
|
|
217
217
|
created: string;
|
|
218
218
|
knowledge: string;
|
|
219
219
|
modalities: {
|
|
@@ -224,7 +224,7 @@ export declare const claude: {
|
|
|
224
224
|
providers: readonly ["anthropic", "bedrock", "vertex"];
|
|
225
225
|
}> | import("../../utils/preset").Preset<"anthropic/claude-sonnet-4", CatalogModel, {
|
|
226
226
|
name: string;
|
|
227
|
-
capabilities: ("
|
|
227
|
+
capabilities: ("reasoning" | "temperature" | "attachments" | "tool_call" | "structured_output")[];
|
|
228
228
|
created: string;
|
|
229
229
|
knowledge: string;
|
|
230
230
|
modalities: {
|
|
@@ -235,7 +235,7 @@ export declare const claude: {
|
|
|
235
235
|
providers: readonly ["anthropic", "bedrock", "vertex"];
|
|
236
236
|
}> | import("../../utils/preset").Preset<"anthropic/claude-sonnet-3.7", CatalogModel, {
|
|
237
237
|
name: string;
|
|
238
|
-
capabilities: ("
|
|
238
|
+
capabilities: ("reasoning" | "temperature" | "attachments" | "tool_call" | "structured_output")[];
|
|
239
239
|
created: string;
|
|
240
240
|
knowledge: string;
|
|
241
241
|
modalities: {
|
|
@@ -257,7 +257,7 @@ export declare const claude: {
|
|
|
257
257
|
providers: readonly ["anthropic", "bedrock", "vertex"];
|
|
258
258
|
}> | import("../../utils/preset").Preset<"anthropic/claude-opus-4.5", CatalogModel, {
|
|
259
259
|
name: string;
|
|
260
|
-
capabilities: ("
|
|
260
|
+
capabilities: ("reasoning" | "temperature" | "attachments" | "tool_call" | "structured_output")[];
|
|
261
261
|
created: string;
|
|
262
262
|
knowledge: string;
|
|
263
263
|
modalities: {
|
|
@@ -268,7 +268,7 @@ export declare const claude: {
|
|
|
268
268
|
providers: readonly ["anthropic", "bedrock", "vertex"];
|
|
269
269
|
}> | import("../../utils/preset").Preset<"anthropic/claude-opus-4.6", CatalogModel, {
|
|
270
270
|
name: string;
|
|
271
|
-
capabilities: ("
|
|
271
|
+
capabilities: ("reasoning" | "temperature" | "attachments" | "tool_call" | "structured_output")[];
|
|
272
272
|
created: string;
|
|
273
273
|
knowledge: string;
|
|
274
274
|
modalities: {
|
|
@@ -279,7 +279,7 @@ export declare const claude: {
|
|
|
279
279
|
providers: readonly ["anthropic", "bedrock", "vertex"];
|
|
280
280
|
}> | import("../../utils/preset").Preset<"anthropic/claude-opus-4.1", CatalogModel, {
|
|
281
281
|
name: string;
|
|
282
|
-
capabilities: ("
|
|
282
|
+
capabilities: ("reasoning" | "temperature" | "attachments" | "tool_call" | "structured_output")[];
|
|
283
283
|
created: string;
|
|
284
284
|
knowledge: string;
|
|
285
285
|
modalities: {
|
|
@@ -290,7 +290,7 @@ export declare const claude: {
|
|
|
290
290
|
providers: readonly ["anthropic", "bedrock", "vertex"];
|
|
291
291
|
}> | import("../../utils/preset").Preset<"anthropic/claude-opus-4", CatalogModel, {
|
|
292
292
|
name: string;
|
|
293
|
-
capabilities: ("
|
|
293
|
+
capabilities: ("reasoning" | "temperature" | "attachments" | "tool_call" | "structured_output")[];
|
|
294
294
|
created: string;
|
|
295
295
|
knowledge: string;
|
|
296
296
|
modalities: {
|
|
@@ -302,7 +302,7 @@ export declare const claude: {
|
|
|
302
302
|
}>)[];
|
|
303
303
|
readonly "v4.x": readonly [import("../../utils/preset").Preset<"anthropic/claude-sonnet-4.6", CatalogModel, {
|
|
304
304
|
name: string;
|
|
305
|
-
capabilities: ("
|
|
305
|
+
capabilities: ("reasoning" | "temperature" | "attachments" | "tool_call" | "structured_output")[];
|
|
306
306
|
created: string;
|
|
307
307
|
knowledge: string;
|
|
308
308
|
modalities: {
|
|
@@ -313,7 +313,7 @@ export declare const claude: {
|
|
|
313
313
|
providers: readonly ["anthropic", "bedrock", "vertex"];
|
|
314
314
|
}>, import("../../utils/preset").Preset<"anthropic/claude-opus-4.6", CatalogModel, {
|
|
315
315
|
name: string;
|
|
316
|
-
capabilities: ("
|
|
316
|
+
capabilities: ("reasoning" | "temperature" | "attachments" | "tool_call" | "structured_output")[];
|
|
317
317
|
created: string;
|
|
318
318
|
knowledge: string;
|
|
319
319
|
modalities: {
|
|
@@ -324,7 +324,7 @@ export declare const claude: {
|
|
|
324
324
|
providers: readonly ["anthropic", "bedrock", "vertex"];
|
|
325
325
|
}>, import("../../utils/preset").Preset<"anthropic/claude-haiku-4.5", CatalogModel, {
|
|
326
326
|
name: string;
|
|
327
|
-
capabilities: ("
|
|
327
|
+
capabilities: ("reasoning" | "temperature" | "attachments" | "tool_call" | "structured_output")[];
|
|
328
328
|
created: string;
|
|
329
329
|
knowledge: string;
|
|
330
330
|
modalities: {
|
|
@@ -335,7 +335,7 @@ export declare const claude: {
|
|
|
335
335
|
providers: readonly ["anthropic", "bedrock", "vertex"];
|
|
336
336
|
}>, import("../../utils/preset").Preset<"anthropic/claude-sonnet-4.5", CatalogModel, {
|
|
337
337
|
name: string;
|
|
338
|
-
capabilities: ("
|
|
338
|
+
capabilities: ("reasoning" | "temperature" | "attachments" | "tool_call" | "structured_output")[];
|
|
339
339
|
created: string;
|
|
340
340
|
knowledge: string;
|
|
341
341
|
modalities: {
|
|
@@ -346,7 +346,7 @@ export declare const claude: {
|
|
|
346
346
|
providers: readonly ["anthropic", "bedrock", "vertex"];
|
|
347
347
|
}>, import("../../utils/preset").Preset<"anthropic/claude-opus-4.5", CatalogModel, {
|
|
348
348
|
name: string;
|
|
349
|
-
capabilities: ("
|
|
349
|
+
capabilities: ("reasoning" | "temperature" | "attachments" | "tool_call" | "structured_output")[];
|
|
350
350
|
created: string;
|
|
351
351
|
knowledge: string;
|
|
352
352
|
modalities: {
|
|
@@ -357,7 +357,7 @@ export declare const claude: {
|
|
|
357
357
|
providers: readonly ["anthropic", "bedrock", "vertex"];
|
|
358
358
|
}>, import("../../utils/preset").Preset<"anthropic/claude-opus-4.1", CatalogModel, {
|
|
359
359
|
name: string;
|
|
360
|
-
capabilities: ("
|
|
360
|
+
capabilities: ("reasoning" | "temperature" | "attachments" | "tool_call" | "structured_output")[];
|
|
361
361
|
created: string;
|
|
362
362
|
knowledge: string;
|
|
363
363
|
modalities: {
|
|
@@ -368,7 +368,7 @@ export declare const claude: {
|
|
|
368
368
|
providers: readonly ["anthropic", "bedrock", "vertex"];
|
|
369
369
|
}>, import("../../utils/preset").Preset<"anthropic/claude-sonnet-4", CatalogModel, {
|
|
370
370
|
name: string;
|
|
371
|
-
capabilities: ("
|
|
371
|
+
capabilities: ("reasoning" | "temperature" | "attachments" | "tool_call" | "structured_output")[];
|
|
372
372
|
created: string;
|
|
373
373
|
knowledge: string;
|
|
374
374
|
modalities: {
|
|
@@ -379,7 +379,7 @@ export declare const claude: {
|
|
|
379
379
|
providers: readonly ["anthropic", "bedrock", "vertex"];
|
|
380
380
|
}>, import("../../utils/preset").Preset<"anthropic/claude-opus-4", CatalogModel, {
|
|
381
381
|
name: string;
|
|
382
|
-
capabilities: ("
|
|
382
|
+
capabilities: ("reasoning" | "temperature" | "attachments" | "tool_call" | "structured_output")[];
|
|
383
383
|
created: string;
|
|
384
384
|
knowledge: string;
|
|
385
385
|
modalities: {
|
|
@@ -391,7 +391,7 @@ export declare const claude: {
|
|
|
391
391
|
}>];
|
|
392
392
|
readonly "v3.x": readonly [import("../../utils/preset").Preset<"anthropic/claude-sonnet-3.7", CatalogModel, {
|
|
393
393
|
name: string;
|
|
394
|
-
capabilities: ("
|
|
394
|
+
capabilities: ("reasoning" | "temperature" | "attachments" | "tool_call" | "structured_output")[];
|
|
395
395
|
created: string;
|
|
396
396
|
knowledge: string;
|
|
397
397
|
modalities: {
|
|
@@ -436,7 +436,7 @@ export declare const claude: {
|
|
|
436
436
|
}>];
|
|
437
437
|
readonly "v4.6": readonly [import("../../utils/preset").Preset<"anthropic/claude-sonnet-4.6", CatalogModel, {
|
|
438
438
|
name: string;
|
|
439
|
-
capabilities: ("
|
|
439
|
+
capabilities: ("reasoning" | "temperature" | "attachments" | "tool_call" | "structured_output")[];
|
|
440
440
|
created: string;
|
|
441
441
|
knowledge: string;
|
|
442
442
|
modalities: {
|
|
@@ -447,7 +447,7 @@ export declare const claude: {
|
|
|
447
447
|
providers: readonly ["anthropic", "bedrock", "vertex"];
|
|
448
448
|
}>, import("../../utils/preset").Preset<"anthropic/claude-opus-4.6", CatalogModel, {
|
|
449
449
|
name: string;
|
|
450
|
-
capabilities: ("
|
|
450
|
+
capabilities: ("reasoning" | "temperature" | "attachments" | "tool_call" | "structured_output")[];
|
|
451
451
|
created: string;
|
|
452
452
|
knowledge: string;
|
|
453
453
|
modalities: {
|
|
@@ -459,7 +459,7 @@ export declare const claude: {
|
|
|
459
459
|
}>];
|
|
460
460
|
readonly "v4.5": readonly [import("../../utils/preset").Preset<"anthropic/claude-haiku-4.5", CatalogModel, {
|
|
461
461
|
name: string;
|
|
462
|
-
capabilities: ("
|
|
462
|
+
capabilities: ("reasoning" | "temperature" | "attachments" | "tool_call" | "structured_output")[];
|
|
463
463
|
created: string;
|
|
464
464
|
knowledge: string;
|
|
465
465
|
modalities: {
|
|
@@ -470,7 +470,7 @@ export declare const claude: {
|
|
|
470
470
|
providers: readonly ["anthropic", "bedrock", "vertex"];
|
|
471
471
|
}>, import("../../utils/preset").Preset<"anthropic/claude-sonnet-4.5", CatalogModel, {
|
|
472
472
|
name: string;
|
|
473
|
-
capabilities: ("
|
|
473
|
+
capabilities: ("reasoning" | "temperature" | "attachments" | "tool_call" | "structured_output")[];
|
|
474
474
|
created: string;
|
|
475
475
|
knowledge: string;
|
|
476
476
|
modalities: {
|
|
@@ -481,7 +481,7 @@ export declare const claude: {
|
|
|
481
481
|
providers: readonly ["anthropic", "bedrock", "vertex"];
|
|
482
482
|
}>, import("../../utils/preset").Preset<"anthropic/claude-opus-4.5", CatalogModel, {
|
|
483
483
|
name: string;
|
|
484
|
-
capabilities: ("
|
|
484
|
+
capabilities: ("reasoning" | "temperature" | "attachments" | "tool_call" | "structured_output")[];
|
|
485
485
|
created: string;
|
|
486
486
|
knowledge: string;
|
|
487
487
|
modalities: {
|
|
@@ -493,7 +493,7 @@ export declare const claude: {
|
|
|
493
493
|
}>];
|
|
494
494
|
readonly "v4.1": readonly [import("../../utils/preset").Preset<"anthropic/claude-opus-4.1", CatalogModel, {
|
|
495
495
|
name: string;
|
|
496
|
-
capabilities: ("
|
|
496
|
+
capabilities: ("reasoning" | "temperature" | "attachments" | "tool_call" | "structured_output")[];
|
|
497
497
|
created: string;
|
|
498
498
|
knowledge: string;
|
|
499
499
|
modalities: {
|
|
@@ -505,7 +505,7 @@ export declare const claude: {
|
|
|
505
505
|
}>];
|
|
506
506
|
readonly v4: readonly [import("../../utils/preset").Preset<"anthropic/claude-sonnet-4", CatalogModel, {
|
|
507
507
|
name: string;
|
|
508
|
-
capabilities: ("
|
|
508
|
+
capabilities: ("reasoning" | "temperature" | "attachments" | "tool_call" | "structured_output")[];
|
|
509
509
|
created: string;
|
|
510
510
|
knowledge: string;
|
|
511
511
|
modalities: {
|
|
@@ -516,7 +516,7 @@ export declare const claude: {
|
|
|
516
516
|
providers: readonly ["anthropic", "bedrock", "vertex"];
|
|
517
517
|
}>, import("../../utils/preset").Preset<"anthropic/claude-opus-4", CatalogModel, {
|
|
518
518
|
name: string;
|
|
519
|
-
capabilities: ("
|
|
519
|
+
capabilities: ("reasoning" | "temperature" | "attachments" | "tool_call" | "structured_output")[];
|
|
520
520
|
created: string;
|
|
521
521
|
knowledge: string;
|
|
522
522
|
modalities: {
|
|
@@ -528,7 +528,7 @@ export declare const claude: {
|
|
|
528
528
|
}>];
|
|
529
529
|
readonly "v3.7": readonly [import("../../utils/preset").Preset<"anthropic/claude-sonnet-3.7", CatalogModel, {
|
|
530
530
|
name: string;
|
|
531
|
-
capabilities: ("
|
|
531
|
+
capabilities: ("reasoning" | "temperature" | "attachments" | "tool_call" | "structured_output")[];
|
|
532
532
|
created: string;
|
|
533
533
|
knowledge: string;
|
|
534
534
|
modalities: {
|
|
@@ -575,7 +575,7 @@ export declare const claude: {
|
|
|
575
575
|
}>];
|
|
576
576
|
readonly haiku: readonly [import("../../utils/preset").Preset<"anthropic/claude-haiku-4.5", CatalogModel, {
|
|
577
577
|
name: string;
|
|
578
|
-
capabilities: ("
|
|
578
|
+
capabilities: ("reasoning" | "temperature" | "attachments" | "tool_call" | "structured_output")[];
|
|
579
579
|
created: string;
|
|
580
580
|
knowledge: string;
|
|
581
581
|
modalities: {
|
|
@@ -609,7 +609,7 @@ export declare const claude: {
|
|
|
609
609
|
}>];
|
|
610
610
|
readonly sonnet: readonly [import("../../utils/preset").Preset<"anthropic/claude-sonnet-4.6", CatalogModel, {
|
|
611
611
|
name: string;
|
|
612
|
-
capabilities: ("
|
|
612
|
+
capabilities: ("reasoning" | "temperature" | "attachments" | "tool_call" | "structured_output")[];
|
|
613
613
|
created: string;
|
|
614
614
|
knowledge: string;
|
|
615
615
|
modalities: {
|
|
@@ -620,7 +620,7 @@ export declare const claude: {
|
|
|
620
620
|
providers: readonly ["anthropic", "bedrock", "vertex"];
|
|
621
621
|
}>, import("../../utils/preset").Preset<"anthropic/claude-sonnet-4.5", CatalogModel, {
|
|
622
622
|
name: string;
|
|
623
|
-
capabilities: ("
|
|
623
|
+
capabilities: ("reasoning" | "temperature" | "attachments" | "tool_call" | "structured_output")[];
|
|
624
624
|
created: string;
|
|
625
625
|
knowledge: string;
|
|
626
626
|
modalities: {
|
|
@@ -631,7 +631,7 @@ export declare const claude: {
|
|
|
631
631
|
providers: readonly ["anthropic", "bedrock", "vertex"];
|
|
632
632
|
}>, import("../../utils/preset").Preset<"anthropic/claude-sonnet-4", CatalogModel, {
|
|
633
633
|
name: string;
|
|
634
|
-
capabilities: ("
|
|
634
|
+
capabilities: ("reasoning" | "temperature" | "attachments" | "tool_call" | "structured_output")[];
|
|
635
635
|
created: string;
|
|
636
636
|
knowledge: string;
|
|
637
637
|
modalities: {
|
|
@@ -642,7 +642,7 @@ export declare const claude: {
|
|
|
642
642
|
providers: readonly ["anthropic", "bedrock", "vertex"];
|
|
643
643
|
}>, import("../../utils/preset").Preset<"anthropic/claude-sonnet-3.7", CatalogModel, {
|
|
644
644
|
name: string;
|
|
645
|
-
capabilities: ("
|
|
645
|
+
capabilities: ("reasoning" | "temperature" | "attachments" | "tool_call" | "structured_output")[];
|
|
646
646
|
created: string;
|
|
647
647
|
knowledge: string;
|
|
648
648
|
modalities: {
|
|
@@ -665,7 +665,7 @@ export declare const claude: {
|
|
|
665
665
|
}>];
|
|
666
666
|
readonly opus: readonly [import("../../utils/preset").Preset<"anthropic/claude-opus-4.6", CatalogModel, {
|
|
667
667
|
name: string;
|
|
668
|
-
capabilities: ("
|
|
668
|
+
capabilities: ("reasoning" | "temperature" | "attachments" | "tool_call" | "structured_output")[];
|
|
669
669
|
created: string;
|
|
670
670
|
knowledge: string;
|
|
671
671
|
modalities: {
|
|
@@ -676,7 +676,7 @@ export declare const claude: {
|
|
|
676
676
|
providers: readonly ["anthropic", "bedrock", "vertex"];
|
|
677
677
|
}>, import("../../utils/preset").Preset<"anthropic/claude-opus-4.5", CatalogModel, {
|
|
678
678
|
name: string;
|
|
679
|
-
capabilities: ("
|
|
679
|
+
capabilities: ("reasoning" | "temperature" | "attachments" | "tool_call" | "structured_output")[];
|
|
680
680
|
created: string;
|
|
681
681
|
knowledge: string;
|
|
682
682
|
modalities: {
|
|
@@ -687,7 +687,7 @@ export declare const claude: {
|
|
|
687
687
|
providers: readonly ["anthropic", "bedrock", "vertex"];
|
|
688
688
|
}>, import("../../utils/preset").Preset<"anthropic/claude-opus-4.1", CatalogModel, {
|
|
689
689
|
name: string;
|
|
690
|
-
capabilities: ("
|
|
690
|
+
capabilities: ("reasoning" | "temperature" | "attachments" | "tool_call" | "structured_output")[];
|
|
691
691
|
created: string;
|
|
692
692
|
knowledge: string;
|
|
693
693
|
modalities: {
|
|
@@ -698,7 +698,7 @@ export declare const claude: {
|
|
|
698
698
|
providers: readonly ["anthropic", "bedrock", "vertex"];
|
|
699
699
|
}>, import("../../utils/preset").Preset<"anthropic/claude-opus-4", CatalogModel, {
|
|
700
700
|
name: string;
|
|
701
|
-
capabilities: ("
|
|
701
|
+
capabilities: ("reasoning" | "temperature" | "attachments" | "tool_call" | "structured_output")[];
|
|
702
702
|
created: string;
|
|
703
703
|
knowledge: string;
|
|
704
704
|
modalities: {
|
package/package.json
CHANGED
|
@@ -185,7 +185,7 @@ describe("Chat Completions Converters", () => {
|
|
|
185
185
|
|
|
186
186
|
const message = toChatCompletionsAssistantMessage(mockResult);
|
|
187
187
|
|
|
188
|
-
expect(message.
|
|
188
|
+
expect(message.reasoning).toBe("I am thinking...");
|
|
189
189
|
expect(message.reasoning_details![0]).toMatchObject({
|
|
190
190
|
type: "reasoning.text",
|
|
191
191
|
text: "I am thinking...",
|
|
@@ -211,7 +211,7 @@ describe("Chat Completions Converters", () => {
|
|
|
211
211
|
|
|
212
212
|
const message = toChatCompletionsAssistantMessage(mockResult);
|
|
213
213
|
|
|
214
|
-
expect(message.
|
|
214
|
+
expect(message.reasoning).toBe("Thinking via text...");
|
|
215
215
|
expect(message.reasoning_details![0]).toMatchObject({
|
|
216
216
|
type: "reasoning.text",
|
|
217
217
|
text: "Thinking via text...",
|
|
@@ -652,7 +652,7 @@ export class ChatCompletionsStream<E extends boolean = false> extends TransformS
|
|
|
652
652
|
controller.enqueue(
|
|
653
653
|
createChunk(
|
|
654
654
|
{
|
|
655
|
-
|
|
655
|
+
reasoning: part.text,
|
|
656
656
|
reasoning_details: [
|
|
657
657
|
toReasoningDetail(
|
|
658
658
|
{
|
|
@@ -760,7 +760,7 @@ export const toChatCompletionsAssistantMessage = (
|
|
|
760
760
|
}
|
|
761
761
|
|
|
762
762
|
if (result.reasoningText) {
|
|
763
|
-
message.
|
|
763
|
+
message.reasoning = result.reasoningText;
|
|
764
764
|
|
|
765
765
|
if (reasoningDetails.length === 0) {
|
|
766
766
|
reasoningDetails.push(
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { describe, expect, test } from "bun:test";
|
|
2
|
+
|
|
3
|
+
import type { ChatCompletionsBody } from "./schema";
|
|
4
|
+
|
|
5
|
+
import { getChatRequestAttributes } from "./otel";
|
|
6
|
+
|
|
7
|
+
describe("Chat Completions OTEL", () => {
|
|
8
|
+
test("should stringify each tool definition individually", () => {
|
|
9
|
+
const tool1 = {
|
|
10
|
+
type: "function" as const,
|
|
11
|
+
function: {
|
|
12
|
+
name: "get_weather",
|
|
13
|
+
parameters: {
|
|
14
|
+
type: "object",
|
|
15
|
+
properties: {
|
|
16
|
+
location: { type: "string" },
|
|
17
|
+
},
|
|
18
|
+
required: ["location"],
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const tool2 = {
|
|
24
|
+
type: "function" as const,
|
|
25
|
+
function: {
|
|
26
|
+
name: "get_time",
|
|
27
|
+
parameters: {
|
|
28
|
+
type: "object",
|
|
29
|
+
properties: {
|
|
30
|
+
timezone: { type: "string" },
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const inputs: ChatCompletionsBody = {
|
|
37
|
+
model: "openai/gpt-oss-20b",
|
|
38
|
+
messages: [{ role: "user", content: "hi" }],
|
|
39
|
+
tools: [tool1, tool2],
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const attrs = getChatRequestAttributes(inputs, "full");
|
|
43
|
+
|
|
44
|
+
expect(attrs["gen_ai.tool.definitions"]).toEqual([
|
|
45
|
+
JSON.stringify(tool1),
|
|
46
|
+
JSON.stringify(tool2),
|
|
47
|
+
]);
|
|
48
|
+
});
|
|
49
|
+
});
|
|
@@ -123,7 +123,9 @@ export const getChatRequestAttributes = (
|
|
|
123
123
|
"gen_ai.input.messages": inputs.messages
|
|
124
124
|
//.filter((m) => m.role !== "system")
|
|
125
125
|
.map((m) => JSON.stringify({ role: m.role, parts: toMessageParts(m) })),
|
|
126
|
-
"gen_ai.tool.definitions":
|
|
126
|
+
"gen_ai.tool.definitions": inputs.tools?.map((toolDefinition) =>
|
|
127
|
+
JSON.stringify(toolDefinition),
|
|
128
|
+
),
|
|
127
129
|
});
|
|
128
130
|
}
|
|
129
131
|
|
|
@@ -120,8 +120,8 @@ export const ChatCompletionsAssistantMessageSchema = z.object({
|
|
|
120
120
|
name: z.string().optional(),
|
|
121
121
|
// FUTURE: This should also support Custom Tool Calls
|
|
122
122
|
tool_calls: z.array(ChatCompletionsToolCallSchema).optional(),
|
|
123
|
-
// Extension origin: OpenRouter/Vercel
|
|
124
|
-
|
|
123
|
+
// Extension origin: OpenRouter/Vercel
|
|
124
|
+
reasoning: z.string().optional().meta({ extension: true }),
|
|
125
125
|
// Extension origin: OpenRouter/Vercel
|
|
126
126
|
reasoning_details: z
|
|
127
127
|
.array(ChatCompletionsReasoningDetailSchema)
|