@hebo-ai/gateway 0.10.0 → 0.10.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.
|
@@ -520,41 +520,79 @@ export declare const MessagesBodySchema: z.ZodObject<{
|
|
|
520
520
|
}, z.core.$strip>;
|
|
521
521
|
export type MessagesBody = z.infer<typeof MessagesBodySchema>;
|
|
522
522
|
export type MessagesInputs = Omit<MessagesBody, "model" | "stream">;
|
|
523
|
-
export
|
|
524
|
-
type: "text"
|
|
525
|
-
text:
|
|
526
|
-
}
|
|
527
|
-
type: "tool_use"
|
|
528
|
-
id:
|
|
529
|
-
name:
|
|
530
|
-
input:
|
|
531
|
-
extra_content
|
|
532
|
-
}
|
|
533
|
-
type: "thinking"
|
|
534
|
-
thinking:
|
|
535
|
-
signature:
|
|
536
|
-
}
|
|
537
|
-
type: "redacted_thinking"
|
|
538
|
-
data:
|
|
539
|
-
}
|
|
540
|
-
export type
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
export type
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
523
|
+
export declare const MessagesResponseContentBlockSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
524
|
+
type: z.ZodLiteral<"text">;
|
|
525
|
+
text: z.ZodString;
|
|
526
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
527
|
+
type: z.ZodLiteral<"tool_use">;
|
|
528
|
+
id: z.ZodString;
|
|
529
|
+
name: z.ZodString;
|
|
530
|
+
input: z.ZodUnknown;
|
|
531
|
+
extra_content: z.ZodOptional<z.ZodType<import("@ai-sdk/provider").SharedV3ProviderMetadata, unknown, z.core.$ZodTypeInternals<import("@ai-sdk/provider").SharedV3ProviderMetadata, unknown>>>;
|
|
532
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
533
|
+
type: z.ZodLiteral<"thinking">;
|
|
534
|
+
thinking: z.ZodString;
|
|
535
|
+
signature: z.ZodString;
|
|
536
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
537
|
+
type: z.ZodLiteral<"redacted_thinking">;
|
|
538
|
+
data: z.ZodString;
|
|
539
|
+
}, z.core.$strip>], "type">;
|
|
540
|
+
export type MessagesResponseContentBlock = z.infer<typeof MessagesResponseContentBlockSchema>;
|
|
541
|
+
export declare const MessagesUsageSchema: z.ZodObject<{
|
|
542
|
+
input_tokens: z.ZodNumber;
|
|
543
|
+
output_tokens: z.ZodNumber;
|
|
544
|
+
cache_creation_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
545
|
+
cache_read_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
546
|
+
}, z.core.$strip>;
|
|
547
|
+
export type MessagesUsage = z.infer<typeof MessagesUsageSchema>;
|
|
548
|
+
export declare const MessagesStopReasonSchema: z.ZodNullable<z.ZodEnum<{
|
|
549
|
+
max_tokens: "max_tokens";
|
|
550
|
+
tool_use: "tool_use";
|
|
551
|
+
end_turn: "end_turn";
|
|
552
|
+
stop_sequence: "stop_sequence";
|
|
553
|
+
}>>;
|
|
554
|
+
export type MessagesStopReason = z.infer<typeof MessagesStopReasonSchema>;
|
|
555
|
+
export declare const MessagesSchema: z.ZodObject<{
|
|
556
|
+
id: z.ZodString;
|
|
557
|
+
type: z.ZodLiteral<"message">;
|
|
558
|
+
role: z.ZodLiteral<"assistant">;
|
|
559
|
+
content: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
560
|
+
type: z.ZodLiteral<"text">;
|
|
561
|
+
text: z.ZodString;
|
|
562
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
563
|
+
type: z.ZodLiteral<"tool_use">;
|
|
564
|
+
id: z.ZodString;
|
|
565
|
+
name: z.ZodString;
|
|
566
|
+
input: z.ZodUnknown;
|
|
567
|
+
extra_content: z.ZodOptional<z.ZodType<import("@ai-sdk/provider").SharedV3ProviderMetadata, unknown, z.core.$ZodTypeInternals<import("@ai-sdk/provider").SharedV3ProviderMetadata, unknown>>>;
|
|
568
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
569
|
+
type: z.ZodLiteral<"thinking">;
|
|
570
|
+
thinking: z.ZodString;
|
|
571
|
+
signature: z.ZodString;
|
|
572
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
573
|
+
type: z.ZodLiteral<"redacted_thinking">;
|
|
574
|
+
data: z.ZodString;
|
|
575
|
+
}, z.core.$strip>], "type">>;
|
|
576
|
+
model: z.ZodString;
|
|
577
|
+
stop_reason: z.ZodNullable<z.ZodEnum<{
|
|
578
|
+
max_tokens: "max_tokens";
|
|
579
|
+
tool_use: "tool_use";
|
|
580
|
+
end_turn: "end_turn";
|
|
581
|
+
stop_sequence: "stop_sequence";
|
|
582
|
+
}>>;
|
|
583
|
+
stop_sequence: z.ZodNullable<z.ZodString>;
|
|
584
|
+
usage: z.ZodObject<{
|
|
585
|
+
input_tokens: z.ZodNumber;
|
|
586
|
+
output_tokens: z.ZodNumber;
|
|
587
|
+
cache_creation_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
588
|
+
cache_read_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
589
|
+
}, z.core.$strip>;
|
|
590
|
+
service_tier: z.ZodOptional<z.ZodEnum<{
|
|
591
|
+
auto: "auto";
|
|
592
|
+
standard_only: "standard_only";
|
|
593
|
+
}>>;
|
|
594
|
+
}, z.core.$strip>;
|
|
595
|
+
export type Messages = z.infer<typeof MessagesSchema>;
|
|
558
596
|
export type MessageStartEvent = SseFrame<{
|
|
559
597
|
type: "message_start";
|
|
560
598
|
message: Messages;
|
|
@@ -183,3 +183,50 @@ export const MessagesBodySchema = z.object({
|
|
|
183
183
|
cache_control: CacheControlSchema.optional(),
|
|
184
184
|
output_config: MessagesOutputConfigSchema.optional(),
|
|
185
185
|
});
|
|
186
|
+
// --- Response Schemas ---
|
|
187
|
+
const MessagesResponseTextBlockSchema = z.object({
|
|
188
|
+
type: z.literal("text"),
|
|
189
|
+
text: z.string(),
|
|
190
|
+
});
|
|
191
|
+
const MessagesResponseToolUseBlockSchema = z.object({
|
|
192
|
+
type: z.literal("tool_use"),
|
|
193
|
+
id: z.string(),
|
|
194
|
+
name: z.string(),
|
|
195
|
+
input: z.unknown(),
|
|
196
|
+
extra_content: ProviderMetadataSchema.optional(),
|
|
197
|
+
});
|
|
198
|
+
const MessagesResponseThinkingBlockSchema = z.object({
|
|
199
|
+
type: z.literal("thinking"),
|
|
200
|
+
thinking: z.string(),
|
|
201
|
+
signature: z.string(),
|
|
202
|
+
});
|
|
203
|
+
const MessagesResponseRedactedThinkingBlockSchema = z.object({
|
|
204
|
+
type: z.literal("redacted_thinking"),
|
|
205
|
+
data: z.string(),
|
|
206
|
+
});
|
|
207
|
+
export const MessagesResponseContentBlockSchema = z.discriminatedUnion("type", [
|
|
208
|
+
MessagesResponseTextBlockSchema,
|
|
209
|
+
MessagesResponseToolUseBlockSchema,
|
|
210
|
+
MessagesResponseThinkingBlockSchema,
|
|
211
|
+
MessagesResponseRedactedThinkingBlockSchema,
|
|
212
|
+
]);
|
|
213
|
+
export const MessagesUsageSchema = z.object({
|
|
214
|
+
input_tokens: z.number().int().nonnegative(),
|
|
215
|
+
output_tokens: z.number().int().nonnegative(),
|
|
216
|
+
cache_creation_input_tokens: z.number().int().nonnegative().optional(),
|
|
217
|
+
cache_read_input_tokens: z.number().int().nonnegative().optional(),
|
|
218
|
+
});
|
|
219
|
+
export const MessagesStopReasonSchema = z
|
|
220
|
+
.enum(["end_turn", "max_tokens", "stop_sequence", "tool_use"])
|
|
221
|
+
.nullable();
|
|
222
|
+
export const MessagesSchema = z.object({
|
|
223
|
+
id: z.string(),
|
|
224
|
+
type: z.literal("message"),
|
|
225
|
+
role: z.literal("assistant"),
|
|
226
|
+
content: z.array(MessagesResponseContentBlockSchema),
|
|
227
|
+
model: z.string(),
|
|
228
|
+
stop_reason: MessagesStopReasonSchema,
|
|
229
|
+
stop_sequence: z.string().nullable(),
|
|
230
|
+
usage: MessagesUsageSchema,
|
|
231
|
+
service_tier: MessagesServiceTierSchema.optional(),
|
|
232
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hebo-ai/gateway",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.1",
|
|
4
4
|
"description": "AI gateway as a framework. For full control over models, routing & lifecycle. OpenAI /chat/completions, OpenResponses /responses & Anthropic /messages.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|