ai-protocol-adapters 1.0.0-alpha.2 → 1.0.0-alpha.20
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 +7 -7
- package/dist/index.d.mts +862 -648
- package/dist/index.d.ts +862 -648
- package/dist/index.js +2086 -821
- package/dist/index.mjs +2083 -821
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -1,171 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* 流式协议适配器 - OpenAI到Anthropic的SSE转换
|
|
5
|
-
* 基于编译后的JavaScript文件重新生成的TypeScript源码
|
|
6
|
-
*/
|
|
7
|
-
interface StreamingProtocolAdapterOptions {
|
|
8
|
-
debugMode?: boolean;
|
|
9
|
-
validateInput?: boolean;
|
|
10
|
-
validateOutput?: boolean;
|
|
11
|
-
autoHeal?: boolean;
|
|
12
|
-
timeout?: number;
|
|
13
|
-
retries?: number;
|
|
14
|
-
bufferSize?: number;
|
|
15
|
-
logger?: any;
|
|
16
|
-
}
|
|
17
|
-
interface ConversionState {
|
|
18
|
-
processedLines: number;
|
|
19
|
-
textContent: string;
|
|
20
|
-
reasoningContent: string;
|
|
21
|
-
toolCallsMap: Map<string, any>;
|
|
22
|
-
completedToolCalls: any[];
|
|
23
|
-
allSSELines: string[];
|
|
24
|
-
errors: any[];
|
|
25
|
-
usage: {
|
|
26
|
-
input_tokens: number;
|
|
27
|
-
output_tokens: number;
|
|
28
|
-
};
|
|
29
|
-
thinkingBlockStarted: boolean;
|
|
30
|
-
contentBlockStarted: boolean;
|
|
31
|
-
}
|
|
32
|
-
interface ConversionResult$2 {
|
|
33
|
-
success: boolean;
|
|
34
|
-
error?: string;
|
|
35
|
-
anthropicSSE: string;
|
|
36
|
-
anthropicStandardResponse: any;
|
|
37
|
-
}
|
|
38
|
-
declare class StreamingProtocolAdapter {
|
|
39
|
-
private config;
|
|
40
|
-
constructor(options?: StreamingProtocolAdapterOptions);
|
|
41
|
-
/**
|
|
42
|
-
* 转换Anthropic请求为OpenAI格式
|
|
43
|
-
*/
|
|
44
|
-
convertAnthropicToOpenAI(anthropicRequest: any): {
|
|
45
|
-
openaiRequest: any;
|
|
46
|
-
metadata: {
|
|
47
|
-
hasImages: boolean;
|
|
48
|
-
requiresVisionHeaders: boolean;
|
|
49
|
-
};
|
|
50
|
-
};
|
|
51
|
-
/**
|
|
52
|
-
* 转换OpenAI流式响应为Anthropic SSE格式
|
|
53
|
-
*/
|
|
54
|
-
convertOpenAIStreamToAnthropic(openaiStream: string, originalRequest: any): ConversionResult$2;
|
|
55
|
-
/**
|
|
56
|
-
* 将OpenAI流转换为Anthropic SSE格式
|
|
57
|
-
*/
|
|
58
|
-
private convertToAnthropicSSE;
|
|
59
|
-
/**
|
|
60
|
-
* 处理单个流式数据块 - 支持thinking和content双模式
|
|
61
|
-
*/
|
|
62
|
-
private processStreamChunk;
|
|
63
|
-
/**
|
|
64
|
-
* 处理工具调用
|
|
65
|
-
*/
|
|
66
|
-
private processToolCalls;
|
|
67
|
-
/**
|
|
68
|
-
* 添加最终事件 - 支持thinking+content双模式
|
|
69
|
-
*/
|
|
70
|
-
private addFinalEvents;
|
|
71
|
-
/**
|
|
72
|
-
* 构建标准响应格式
|
|
73
|
-
*/
|
|
74
|
-
private buildStandardResponse;
|
|
75
|
-
/**
|
|
76
|
-
* 创建转换状态对象
|
|
77
|
-
*/
|
|
78
|
-
private createConversionState;
|
|
79
|
-
/**
|
|
80
|
-
* 转换消息格式
|
|
81
|
-
*/
|
|
82
|
-
private convertMessages;
|
|
83
|
-
/**
|
|
84
|
-
* 映射Anthropic模型到OpenAI模型
|
|
85
|
-
*/
|
|
86
|
-
private mapAnthropicModelToOpenAI;
|
|
87
|
-
/**
|
|
88
|
-
* 检查请求是否包含图片内容
|
|
89
|
-
*/
|
|
90
|
-
private hasImageContent;
|
|
91
|
-
/**
|
|
92
|
-
* 转义JSON字符串
|
|
93
|
-
*/
|
|
94
|
-
private escapeJsonString;
|
|
95
|
-
/**
|
|
96
|
-
* 获取初始SSE事件(message_start + ping)
|
|
97
|
-
*/
|
|
98
|
-
getInitialSSEEvents(modelName?: string, messageId?: string): string[];
|
|
99
|
-
/**
|
|
100
|
-
* 增量转换单个OpenAI数据块为Anthropic SSE事件
|
|
101
|
-
* 用于逐个处理流式数据片段
|
|
102
|
-
*/
|
|
103
|
-
convertIncrementalChunk(openaiDataLine: string, state: ConversionState): string[];
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* O2A SSE适配器相关类型定义
|
|
108
|
-
*/
|
|
109
|
-
interface CaptureSession {
|
|
110
|
-
[key: string]: any;
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* 工具调用信息接口
|
|
114
|
-
*/
|
|
115
|
-
interface ToolCallInfo {
|
|
116
|
-
index: number;
|
|
117
|
-
name: string;
|
|
118
|
-
hasArgs: boolean;
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* 流式转换状态接口
|
|
122
|
-
*/
|
|
123
|
-
interface StreamingConversionState {
|
|
124
|
-
hasContent: boolean;
|
|
125
|
-
hasThinking: boolean;
|
|
126
|
-
contentBlockIndex: number;
|
|
127
|
-
thinkingBlockIndex: number;
|
|
128
|
-
toolCallsMap: Map<string, ToolCallInfo>;
|
|
129
|
-
completedToolCalls: Set<string>;
|
|
130
|
-
accumulatedUsage: {
|
|
131
|
-
input_tokens: number;
|
|
132
|
-
output_tokens: number;
|
|
133
|
-
cache_creation_input_tokens?: number;
|
|
134
|
-
cache_read_input_tokens?: number;
|
|
135
|
-
};
|
|
136
|
-
processedLines: number;
|
|
137
|
-
errors: string[];
|
|
138
|
-
allSSELines: string[];
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* 增量转换状态接口(扩展基础状态)
|
|
142
|
-
*/
|
|
143
|
-
interface IncrementalConversionState extends StreamingConversionState {
|
|
144
|
-
captureSession?: CaptureSession;
|
|
145
|
-
}
|
|
146
|
-
/**
|
|
147
|
-
* Claude标准响应格式
|
|
148
|
-
*/
|
|
149
|
-
interface ClaudeStandardResponse {
|
|
150
|
-
id: string;
|
|
151
|
-
model: string;
|
|
152
|
-
role: 'assistant';
|
|
153
|
-
content: ContentBlock[];
|
|
154
|
-
type: 'message';
|
|
155
|
-
stop_reason: 'end_turn' | 'max_tokens' | 'stop_sequence' | 'tool_use' | null;
|
|
156
|
-
stop_sequence: string | null;
|
|
157
|
-
usage: Usage;
|
|
158
|
-
}
|
|
159
|
-
interface ContentBlock {
|
|
160
|
-
type: 'text' | 'tool_use' | 'tool_result' | 'image';
|
|
161
|
-
}
|
|
162
|
-
interface Usage {
|
|
163
|
-
input_tokens: number;
|
|
164
|
-
output_tokens: number;
|
|
165
|
-
cache_creation_input_tokens?: number;
|
|
166
|
-
cache_read_input_tokens?: number;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
3
|
/**
|
|
170
4
|
* OpenAI API 协议 zod schemas
|
|
171
5
|
* 提供完整的类型校验和自动推导
|
|
@@ -332,15 +166,15 @@ declare const OpenAIMessageContentSchema: z.ZodUnion<[z.ZodString, z.ZodArray<z.
|
|
|
332
166
|
detail?: "low" | "high" | "auto";
|
|
333
167
|
}>>;
|
|
334
168
|
}, "strip", z.ZodTypeAny, {
|
|
335
|
-
text?: string;
|
|
336
169
|
type?: "text" | "image_url";
|
|
170
|
+
text?: string;
|
|
337
171
|
image_url?: {
|
|
338
172
|
url?: string;
|
|
339
173
|
detail?: "low" | "high" | "auto";
|
|
340
174
|
};
|
|
341
175
|
}, {
|
|
342
|
-
text?: string;
|
|
343
176
|
type?: "text" | "image_url";
|
|
177
|
+
text?: string;
|
|
344
178
|
image_url?: {
|
|
345
179
|
url?: string;
|
|
346
180
|
detail?: "low" | "high" | "auto";
|
|
@@ -362,15 +196,15 @@ declare const OpenAIMessageSchema: z.ZodObject<{
|
|
|
362
196
|
detail?: "low" | "high" | "auto";
|
|
363
197
|
}>>;
|
|
364
198
|
}, "strip", z.ZodTypeAny, {
|
|
365
|
-
text?: string;
|
|
366
199
|
type?: "text" | "image_url";
|
|
200
|
+
text?: string;
|
|
367
201
|
image_url?: {
|
|
368
202
|
url?: string;
|
|
369
203
|
detail?: "low" | "high" | "auto";
|
|
370
204
|
};
|
|
371
205
|
}, {
|
|
372
|
-
text?: string;
|
|
373
206
|
type?: "text" | "image_url";
|
|
207
|
+
text?: string;
|
|
374
208
|
image_url?: {
|
|
375
209
|
url?: string;
|
|
376
210
|
detail?: "low" | "high" | "auto";
|
|
@@ -407,16 +241,16 @@ declare const OpenAIMessageSchema: z.ZodObject<{
|
|
|
407
241
|
}>, "many">>;
|
|
408
242
|
tool_call_id: z.ZodOptional<z.ZodString>;
|
|
409
243
|
}, "strip", z.ZodTypeAny, {
|
|
410
|
-
|
|
244
|
+
name?: string;
|
|
245
|
+
role?: "system" | "user" | "assistant" | "tool";
|
|
411
246
|
content?: string | {
|
|
412
|
-
text?: string;
|
|
413
247
|
type?: "text" | "image_url";
|
|
248
|
+
text?: string;
|
|
414
249
|
image_url?: {
|
|
415
250
|
url?: string;
|
|
416
251
|
detail?: "low" | "high" | "auto";
|
|
417
252
|
};
|
|
418
253
|
}[];
|
|
419
|
-
name?: string;
|
|
420
254
|
tool_calls?: {
|
|
421
255
|
function?: {
|
|
422
256
|
name?: string;
|
|
@@ -427,16 +261,16 @@ declare const OpenAIMessageSchema: z.ZodObject<{
|
|
|
427
261
|
}[];
|
|
428
262
|
tool_call_id?: string;
|
|
429
263
|
}, {
|
|
430
|
-
|
|
264
|
+
name?: string;
|
|
265
|
+
role?: "system" | "user" | "assistant" | "tool";
|
|
431
266
|
content?: string | {
|
|
432
|
-
text?: string;
|
|
433
267
|
type?: "text" | "image_url";
|
|
268
|
+
text?: string;
|
|
434
269
|
image_url?: {
|
|
435
270
|
url?: string;
|
|
436
271
|
detail?: "low" | "high" | "auto";
|
|
437
272
|
};
|
|
438
273
|
}[];
|
|
439
|
-
name?: string;
|
|
440
274
|
tool_calls?: {
|
|
441
275
|
function?: {
|
|
442
276
|
name?: string;
|
|
@@ -465,15 +299,15 @@ declare const OpenAIRequestSchema: z.ZodObject<{
|
|
|
465
299
|
detail?: "low" | "high" | "auto";
|
|
466
300
|
}>>;
|
|
467
301
|
}, "strip", z.ZodTypeAny, {
|
|
468
|
-
text?: string;
|
|
469
302
|
type?: "text" | "image_url";
|
|
303
|
+
text?: string;
|
|
470
304
|
image_url?: {
|
|
471
305
|
url?: string;
|
|
472
306
|
detail?: "low" | "high" | "auto";
|
|
473
307
|
};
|
|
474
308
|
}, {
|
|
475
|
-
text?: string;
|
|
476
309
|
type?: "text" | "image_url";
|
|
310
|
+
text?: string;
|
|
477
311
|
image_url?: {
|
|
478
312
|
url?: string;
|
|
479
313
|
detail?: "low" | "high" | "auto";
|
|
@@ -510,16 +344,16 @@ declare const OpenAIRequestSchema: z.ZodObject<{
|
|
|
510
344
|
}>, "many">>;
|
|
511
345
|
tool_call_id: z.ZodOptional<z.ZodString>;
|
|
512
346
|
}, "strip", z.ZodTypeAny, {
|
|
513
|
-
|
|
347
|
+
name?: string;
|
|
348
|
+
role?: "system" | "user" | "assistant" | "tool";
|
|
514
349
|
content?: string | {
|
|
515
|
-
text?: string;
|
|
516
350
|
type?: "text" | "image_url";
|
|
351
|
+
text?: string;
|
|
517
352
|
image_url?: {
|
|
518
353
|
url?: string;
|
|
519
354
|
detail?: "low" | "high" | "auto";
|
|
520
355
|
};
|
|
521
356
|
}[];
|
|
522
|
-
name?: string;
|
|
523
357
|
tool_calls?: {
|
|
524
358
|
function?: {
|
|
525
359
|
name?: string;
|
|
@@ -530,16 +364,16 @@ declare const OpenAIRequestSchema: z.ZodObject<{
|
|
|
530
364
|
}[];
|
|
531
365
|
tool_call_id?: string;
|
|
532
366
|
}, {
|
|
533
|
-
|
|
367
|
+
name?: string;
|
|
368
|
+
role?: "system" | "user" | "assistant" | "tool";
|
|
534
369
|
content?: string | {
|
|
535
|
-
text?: string;
|
|
536
370
|
type?: "text" | "image_url";
|
|
371
|
+
text?: string;
|
|
537
372
|
image_url?: {
|
|
538
373
|
url?: string;
|
|
539
374
|
detail?: "low" | "high" | "auto";
|
|
540
375
|
};
|
|
541
376
|
}[];
|
|
542
|
-
name?: string;
|
|
543
377
|
tool_calls?: {
|
|
544
378
|
function?: {
|
|
545
379
|
name?: string;
|
|
@@ -659,16 +493,16 @@ declare const OpenAIRequestSchema: z.ZodObject<{
|
|
|
659
493
|
user?: string;
|
|
660
494
|
model?: string;
|
|
661
495
|
messages?: {
|
|
662
|
-
|
|
496
|
+
name?: string;
|
|
497
|
+
role?: "system" | "user" | "assistant" | "tool";
|
|
663
498
|
content?: string | {
|
|
664
|
-
text?: string;
|
|
665
499
|
type?: "text" | "image_url";
|
|
500
|
+
text?: string;
|
|
666
501
|
image_url?: {
|
|
667
502
|
url?: string;
|
|
668
503
|
detail?: "low" | "high" | "auto";
|
|
669
504
|
};
|
|
670
505
|
}[];
|
|
671
|
-
name?: string;
|
|
672
506
|
tool_calls?: {
|
|
673
507
|
function?: {
|
|
674
508
|
name?: string;
|
|
@@ -717,16 +551,16 @@ declare const OpenAIRequestSchema: z.ZodObject<{
|
|
|
717
551
|
user?: string;
|
|
718
552
|
model?: string;
|
|
719
553
|
messages?: {
|
|
720
|
-
|
|
554
|
+
name?: string;
|
|
555
|
+
role?: "system" | "user" | "assistant" | "tool";
|
|
721
556
|
content?: string | {
|
|
722
|
-
text?: string;
|
|
723
557
|
type?: "text" | "image_url";
|
|
558
|
+
text?: string;
|
|
724
559
|
image_url?: {
|
|
725
560
|
url?: string;
|
|
726
561
|
detail?: "low" | "high" | "auto";
|
|
727
562
|
};
|
|
728
563
|
}[];
|
|
729
|
-
name?: string;
|
|
730
564
|
tool_calls?: {
|
|
731
565
|
function?: {
|
|
732
566
|
name?: string;
|
|
@@ -829,15 +663,15 @@ declare const OpenAIChoiceSchema: z.ZodObject<{
|
|
|
829
663
|
detail?: "low" | "high" | "auto";
|
|
830
664
|
}>>;
|
|
831
665
|
}, "strip", z.ZodTypeAny, {
|
|
832
|
-
text?: string;
|
|
833
666
|
type?: "text" | "image_url";
|
|
667
|
+
text?: string;
|
|
834
668
|
image_url?: {
|
|
835
669
|
url?: string;
|
|
836
670
|
detail?: "low" | "high" | "auto";
|
|
837
671
|
};
|
|
838
672
|
}, {
|
|
839
|
-
text?: string;
|
|
840
673
|
type?: "text" | "image_url";
|
|
674
|
+
text?: string;
|
|
841
675
|
image_url?: {
|
|
842
676
|
url?: string;
|
|
843
677
|
detail?: "low" | "high" | "auto";
|
|
@@ -874,16 +708,16 @@ declare const OpenAIChoiceSchema: z.ZodObject<{
|
|
|
874
708
|
}>, "many">>;
|
|
875
709
|
tool_call_id: z.ZodOptional<z.ZodString>;
|
|
876
710
|
}, "strip", z.ZodTypeAny, {
|
|
877
|
-
|
|
711
|
+
name?: string;
|
|
712
|
+
role?: "system" | "user" | "assistant" | "tool";
|
|
878
713
|
content?: string | {
|
|
879
|
-
text?: string;
|
|
880
714
|
type?: "text" | "image_url";
|
|
715
|
+
text?: string;
|
|
881
716
|
image_url?: {
|
|
882
717
|
url?: string;
|
|
883
718
|
detail?: "low" | "high" | "auto";
|
|
884
719
|
};
|
|
885
720
|
}[];
|
|
886
|
-
name?: string;
|
|
887
721
|
tool_calls?: {
|
|
888
722
|
function?: {
|
|
889
723
|
name?: string;
|
|
@@ -894,16 +728,16 @@ declare const OpenAIChoiceSchema: z.ZodObject<{
|
|
|
894
728
|
}[];
|
|
895
729
|
tool_call_id?: string;
|
|
896
730
|
}, {
|
|
897
|
-
|
|
731
|
+
name?: string;
|
|
732
|
+
role?: "system" | "user" | "assistant" | "tool";
|
|
898
733
|
content?: string | {
|
|
899
|
-
text?: string;
|
|
900
734
|
type?: "text" | "image_url";
|
|
735
|
+
text?: string;
|
|
901
736
|
image_url?: {
|
|
902
737
|
url?: string;
|
|
903
738
|
detail?: "low" | "high" | "auto";
|
|
904
739
|
};
|
|
905
740
|
}[];
|
|
906
|
-
name?: string;
|
|
907
741
|
tool_calls?: {
|
|
908
742
|
function?: {
|
|
909
743
|
name?: string;
|
|
@@ -930,15 +764,15 @@ declare const OpenAIChoiceSchema: z.ZodObject<{
|
|
|
930
764
|
detail?: "low" | "high" | "auto";
|
|
931
765
|
}>>;
|
|
932
766
|
}, "strip", z.ZodTypeAny, {
|
|
933
|
-
text?: string;
|
|
934
767
|
type?: "text" | "image_url";
|
|
768
|
+
text?: string;
|
|
935
769
|
image_url?: {
|
|
936
770
|
url?: string;
|
|
937
771
|
detail?: "low" | "high" | "auto";
|
|
938
772
|
};
|
|
939
773
|
}, {
|
|
940
|
-
text?: string;
|
|
941
774
|
type?: "text" | "image_url";
|
|
775
|
+
text?: string;
|
|
942
776
|
image_url?: {
|
|
943
777
|
url?: string;
|
|
944
778
|
detail?: "low" | "high" | "auto";
|
|
@@ -975,16 +809,16 @@ declare const OpenAIChoiceSchema: z.ZodObject<{
|
|
|
975
809
|
}>, "many">>;
|
|
976
810
|
tool_call_id: z.ZodOptional<z.ZodString>;
|
|
977
811
|
}, "strip", z.ZodTypeAny, {
|
|
978
|
-
|
|
812
|
+
name?: string;
|
|
813
|
+
role?: "system" | "user" | "assistant" | "tool";
|
|
979
814
|
content?: string | {
|
|
980
|
-
text?: string;
|
|
981
815
|
type?: "text" | "image_url";
|
|
816
|
+
text?: string;
|
|
982
817
|
image_url?: {
|
|
983
818
|
url?: string;
|
|
984
819
|
detail?: "low" | "high" | "auto";
|
|
985
820
|
};
|
|
986
821
|
}[];
|
|
987
|
-
name?: string;
|
|
988
822
|
tool_calls?: {
|
|
989
823
|
function?: {
|
|
990
824
|
name?: string;
|
|
@@ -995,16 +829,16 @@ declare const OpenAIChoiceSchema: z.ZodObject<{
|
|
|
995
829
|
}[];
|
|
996
830
|
tool_call_id?: string;
|
|
997
831
|
}, {
|
|
998
|
-
|
|
832
|
+
name?: string;
|
|
833
|
+
role?: "system" | "user" | "assistant" | "tool";
|
|
999
834
|
content?: string | {
|
|
1000
|
-
text?: string;
|
|
1001
835
|
type?: "text" | "image_url";
|
|
836
|
+
text?: string;
|
|
1002
837
|
image_url?: {
|
|
1003
838
|
url?: string;
|
|
1004
839
|
detail?: "low" | "high" | "auto";
|
|
1005
840
|
};
|
|
1006
841
|
}[];
|
|
1007
|
-
name?: string;
|
|
1008
842
|
tool_calls?: {
|
|
1009
843
|
function?: {
|
|
1010
844
|
name?: string;
|
|
@@ -1078,16 +912,16 @@ declare const OpenAIChoiceSchema: z.ZodObject<{
|
|
|
1078
912
|
finish_reason: z.ZodNullable<z.ZodEnum<["stop", "length", "tool_calls", "content_filter", "function_call"]>>;
|
|
1079
913
|
}, "strip", z.ZodTypeAny, {
|
|
1080
914
|
message?: {
|
|
1081
|
-
|
|
915
|
+
name?: string;
|
|
916
|
+
role?: "system" | "user" | "assistant" | "tool";
|
|
1082
917
|
content?: string | {
|
|
1083
|
-
text?: string;
|
|
1084
918
|
type?: "text" | "image_url";
|
|
919
|
+
text?: string;
|
|
1085
920
|
image_url?: {
|
|
1086
921
|
url?: string;
|
|
1087
922
|
detail?: "low" | "high" | "auto";
|
|
1088
923
|
};
|
|
1089
924
|
}[];
|
|
1090
|
-
name?: string;
|
|
1091
925
|
tool_calls?: {
|
|
1092
926
|
function?: {
|
|
1093
927
|
name?: string;
|
|
@@ -1112,16 +946,16 @@ declare const OpenAIChoiceSchema: z.ZodObject<{
|
|
|
1112
946
|
};
|
|
1113
947
|
index?: number;
|
|
1114
948
|
delta?: {
|
|
1115
|
-
|
|
949
|
+
name?: string;
|
|
950
|
+
role?: "system" | "user" | "assistant" | "tool";
|
|
1116
951
|
content?: string | {
|
|
1117
|
-
text?: string;
|
|
1118
952
|
type?: "text" | "image_url";
|
|
953
|
+
text?: string;
|
|
1119
954
|
image_url?: {
|
|
1120
955
|
url?: string;
|
|
1121
956
|
detail?: "low" | "high" | "auto";
|
|
1122
957
|
};
|
|
1123
958
|
}[];
|
|
1124
|
-
name?: string;
|
|
1125
959
|
tool_calls?: {
|
|
1126
960
|
function?: {
|
|
1127
961
|
name?: string;
|
|
@@ -1135,16 +969,16 @@ declare const OpenAIChoiceSchema: z.ZodObject<{
|
|
|
1135
969
|
finish_reason?: "length" | "tool_calls" | "stop" | "content_filter" | "function_call";
|
|
1136
970
|
}, {
|
|
1137
971
|
message?: {
|
|
1138
|
-
|
|
972
|
+
name?: string;
|
|
973
|
+
role?: "system" | "user" | "assistant" | "tool";
|
|
1139
974
|
content?: string | {
|
|
1140
|
-
text?: string;
|
|
1141
975
|
type?: "text" | "image_url";
|
|
976
|
+
text?: string;
|
|
1142
977
|
image_url?: {
|
|
1143
978
|
url?: string;
|
|
1144
979
|
detail?: "low" | "high" | "auto";
|
|
1145
980
|
};
|
|
1146
981
|
}[];
|
|
1147
|
-
name?: string;
|
|
1148
982
|
tool_calls?: {
|
|
1149
983
|
function?: {
|
|
1150
984
|
name?: string;
|
|
@@ -1169,16 +1003,16 @@ declare const OpenAIChoiceSchema: z.ZodObject<{
|
|
|
1169
1003
|
};
|
|
1170
1004
|
index?: number;
|
|
1171
1005
|
delta?: {
|
|
1172
|
-
|
|
1006
|
+
name?: string;
|
|
1007
|
+
role?: "system" | "user" | "assistant" | "tool";
|
|
1173
1008
|
content?: string | {
|
|
1174
|
-
text?: string;
|
|
1175
1009
|
type?: "text" | "image_url";
|
|
1010
|
+
text?: string;
|
|
1176
1011
|
image_url?: {
|
|
1177
1012
|
url?: string;
|
|
1178
1013
|
detail?: "low" | "high" | "auto";
|
|
1179
1014
|
};
|
|
1180
1015
|
}[];
|
|
1181
|
-
name?: string;
|
|
1182
1016
|
tool_calls?: {
|
|
1183
1017
|
function?: {
|
|
1184
1018
|
name?: string;
|
|
@@ -1214,15 +1048,15 @@ declare const OpenAIResponseSchema: z.ZodObject<{
|
|
|
1214
1048
|
detail?: "low" | "high" | "auto";
|
|
1215
1049
|
}>>;
|
|
1216
1050
|
}, "strip", z.ZodTypeAny, {
|
|
1217
|
-
text?: string;
|
|
1218
1051
|
type?: "text" | "image_url";
|
|
1052
|
+
text?: string;
|
|
1219
1053
|
image_url?: {
|
|
1220
1054
|
url?: string;
|
|
1221
1055
|
detail?: "low" | "high" | "auto";
|
|
1222
1056
|
};
|
|
1223
1057
|
}, {
|
|
1224
|
-
text?: string;
|
|
1225
1058
|
type?: "text" | "image_url";
|
|
1059
|
+
text?: string;
|
|
1226
1060
|
image_url?: {
|
|
1227
1061
|
url?: string;
|
|
1228
1062
|
detail?: "low" | "high" | "auto";
|
|
@@ -1259,16 +1093,16 @@ declare const OpenAIResponseSchema: z.ZodObject<{
|
|
|
1259
1093
|
}>, "many">>;
|
|
1260
1094
|
tool_call_id: z.ZodOptional<z.ZodString>;
|
|
1261
1095
|
}, "strip", z.ZodTypeAny, {
|
|
1262
|
-
|
|
1096
|
+
name?: string;
|
|
1097
|
+
role?: "system" | "user" | "assistant" | "tool";
|
|
1263
1098
|
content?: string | {
|
|
1264
|
-
text?: string;
|
|
1265
1099
|
type?: "text" | "image_url";
|
|
1100
|
+
text?: string;
|
|
1266
1101
|
image_url?: {
|
|
1267
1102
|
url?: string;
|
|
1268
1103
|
detail?: "low" | "high" | "auto";
|
|
1269
1104
|
};
|
|
1270
1105
|
}[];
|
|
1271
|
-
name?: string;
|
|
1272
1106
|
tool_calls?: {
|
|
1273
1107
|
function?: {
|
|
1274
1108
|
name?: string;
|
|
@@ -1279,16 +1113,16 @@ declare const OpenAIResponseSchema: z.ZodObject<{
|
|
|
1279
1113
|
}[];
|
|
1280
1114
|
tool_call_id?: string;
|
|
1281
1115
|
}, {
|
|
1282
|
-
|
|
1116
|
+
name?: string;
|
|
1117
|
+
role?: "system" | "user" | "assistant" | "tool";
|
|
1283
1118
|
content?: string | {
|
|
1284
|
-
text?: string;
|
|
1285
1119
|
type?: "text" | "image_url";
|
|
1120
|
+
text?: string;
|
|
1286
1121
|
image_url?: {
|
|
1287
1122
|
url?: string;
|
|
1288
1123
|
detail?: "low" | "high" | "auto";
|
|
1289
1124
|
};
|
|
1290
1125
|
}[];
|
|
1291
|
-
name?: string;
|
|
1292
1126
|
tool_calls?: {
|
|
1293
1127
|
function?: {
|
|
1294
1128
|
name?: string;
|
|
@@ -1315,15 +1149,15 @@ declare const OpenAIResponseSchema: z.ZodObject<{
|
|
|
1315
1149
|
detail?: "low" | "high" | "auto";
|
|
1316
1150
|
}>>;
|
|
1317
1151
|
}, "strip", z.ZodTypeAny, {
|
|
1318
|
-
text?: string;
|
|
1319
1152
|
type?: "text" | "image_url";
|
|
1153
|
+
text?: string;
|
|
1320
1154
|
image_url?: {
|
|
1321
1155
|
url?: string;
|
|
1322
1156
|
detail?: "low" | "high" | "auto";
|
|
1323
1157
|
};
|
|
1324
1158
|
}, {
|
|
1325
|
-
text?: string;
|
|
1326
1159
|
type?: "text" | "image_url";
|
|
1160
|
+
text?: string;
|
|
1327
1161
|
image_url?: {
|
|
1328
1162
|
url?: string;
|
|
1329
1163
|
detail?: "low" | "high" | "auto";
|
|
@@ -1360,16 +1194,16 @@ declare const OpenAIResponseSchema: z.ZodObject<{
|
|
|
1360
1194
|
}>, "many">>;
|
|
1361
1195
|
tool_call_id: z.ZodOptional<z.ZodString>;
|
|
1362
1196
|
}, "strip", z.ZodTypeAny, {
|
|
1363
|
-
|
|
1197
|
+
name?: string;
|
|
1198
|
+
role?: "system" | "user" | "assistant" | "tool";
|
|
1364
1199
|
content?: string | {
|
|
1365
|
-
text?: string;
|
|
1366
1200
|
type?: "text" | "image_url";
|
|
1201
|
+
text?: string;
|
|
1367
1202
|
image_url?: {
|
|
1368
1203
|
url?: string;
|
|
1369
1204
|
detail?: "low" | "high" | "auto";
|
|
1370
1205
|
};
|
|
1371
1206
|
}[];
|
|
1372
|
-
name?: string;
|
|
1373
1207
|
tool_calls?: {
|
|
1374
1208
|
function?: {
|
|
1375
1209
|
name?: string;
|
|
@@ -1380,16 +1214,16 @@ declare const OpenAIResponseSchema: z.ZodObject<{
|
|
|
1380
1214
|
}[];
|
|
1381
1215
|
tool_call_id?: string;
|
|
1382
1216
|
}, {
|
|
1383
|
-
|
|
1217
|
+
name?: string;
|
|
1218
|
+
role?: "system" | "user" | "assistant" | "tool";
|
|
1384
1219
|
content?: string | {
|
|
1385
|
-
text?: string;
|
|
1386
1220
|
type?: "text" | "image_url";
|
|
1221
|
+
text?: string;
|
|
1387
1222
|
image_url?: {
|
|
1388
1223
|
url?: string;
|
|
1389
1224
|
detail?: "low" | "high" | "auto";
|
|
1390
1225
|
};
|
|
1391
1226
|
}[];
|
|
1392
|
-
name?: string;
|
|
1393
1227
|
tool_calls?: {
|
|
1394
1228
|
function?: {
|
|
1395
1229
|
name?: string;
|
|
@@ -1463,16 +1297,16 @@ declare const OpenAIResponseSchema: z.ZodObject<{
|
|
|
1463
1297
|
finish_reason: z.ZodNullable<z.ZodEnum<["stop", "length", "tool_calls", "content_filter", "function_call"]>>;
|
|
1464
1298
|
}, "strip", z.ZodTypeAny, {
|
|
1465
1299
|
message?: {
|
|
1466
|
-
|
|
1300
|
+
name?: string;
|
|
1301
|
+
role?: "system" | "user" | "assistant" | "tool";
|
|
1467
1302
|
content?: string | {
|
|
1468
|
-
text?: string;
|
|
1469
1303
|
type?: "text" | "image_url";
|
|
1304
|
+
text?: string;
|
|
1470
1305
|
image_url?: {
|
|
1471
1306
|
url?: string;
|
|
1472
1307
|
detail?: "low" | "high" | "auto";
|
|
1473
1308
|
};
|
|
1474
1309
|
}[];
|
|
1475
|
-
name?: string;
|
|
1476
1310
|
tool_calls?: {
|
|
1477
1311
|
function?: {
|
|
1478
1312
|
name?: string;
|
|
@@ -1497,16 +1331,16 @@ declare const OpenAIResponseSchema: z.ZodObject<{
|
|
|
1497
1331
|
};
|
|
1498
1332
|
index?: number;
|
|
1499
1333
|
delta?: {
|
|
1500
|
-
|
|
1334
|
+
name?: string;
|
|
1335
|
+
role?: "system" | "user" | "assistant" | "tool";
|
|
1501
1336
|
content?: string | {
|
|
1502
|
-
text?: string;
|
|
1503
1337
|
type?: "text" | "image_url";
|
|
1338
|
+
text?: string;
|
|
1504
1339
|
image_url?: {
|
|
1505
1340
|
url?: string;
|
|
1506
1341
|
detail?: "low" | "high" | "auto";
|
|
1507
1342
|
};
|
|
1508
1343
|
}[];
|
|
1509
|
-
name?: string;
|
|
1510
1344
|
tool_calls?: {
|
|
1511
1345
|
function?: {
|
|
1512
1346
|
name?: string;
|
|
@@ -1520,16 +1354,16 @@ declare const OpenAIResponseSchema: z.ZodObject<{
|
|
|
1520
1354
|
finish_reason?: "length" | "tool_calls" | "stop" | "content_filter" | "function_call";
|
|
1521
1355
|
}, {
|
|
1522
1356
|
message?: {
|
|
1523
|
-
|
|
1357
|
+
name?: string;
|
|
1358
|
+
role?: "system" | "user" | "assistant" | "tool";
|
|
1524
1359
|
content?: string | {
|
|
1525
|
-
text?: string;
|
|
1526
1360
|
type?: "text" | "image_url";
|
|
1361
|
+
text?: string;
|
|
1527
1362
|
image_url?: {
|
|
1528
1363
|
url?: string;
|
|
1529
1364
|
detail?: "low" | "high" | "auto";
|
|
1530
1365
|
};
|
|
1531
1366
|
}[];
|
|
1532
|
-
name?: string;
|
|
1533
1367
|
tool_calls?: {
|
|
1534
1368
|
function?: {
|
|
1535
1369
|
name?: string;
|
|
@@ -1554,16 +1388,16 @@ declare const OpenAIResponseSchema: z.ZodObject<{
|
|
|
1554
1388
|
};
|
|
1555
1389
|
index?: number;
|
|
1556
1390
|
delta?: {
|
|
1557
|
-
|
|
1391
|
+
name?: string;
|
|
1392
|
+
role?: "system" | "user" | "assistant" | "tool";
|
|
1558
1393
|
content?: string | {
|
|
1559
|
-
text?: string;
|
|
1560
1394
|
type?: "text" | "image_url";
|
|
1395
|
+
text?: string;
|
|
1561
1396
|
image_url?: {
|
|
1562
1397
|
url?: string;
|
|
1563
1398
|
detail?: "low" | "high" | "auto";
|
|
1564
1399
|
};
|
|
1565
1400
|
}[];
|
|
1566
|
-
name?: string;
|
|
1567
1401
|
tool_calls?: {
|
|
1568
1402
|
function?: {
|
|
1569
1403
|
name?: string;
|
|
@@ -1623,16 +1457,16 @@ declare const OpenAIResponseSchema: z.ZodObject<{
|
|
|
1623
1457
|
created?: number;
|
|
1624
1458
|
choices?: {
|
|
1625
1459
|
message?: {
|
|
1626
|
-
|
|
1460
|
+
name?: string;
|
|
1461
|
+
role?: "system" | "user" | "assistant" | "tool";
|
|
1627
1462
|
content?: string | {
|
|
1628
|
-
text?: string;
|
|
1629
1463
|
type?: "text" | "image_url";
|
|
1464
|
+
text?: string;
|
|
1630
1465
|
image_url?: {
|
|
1631
1466
|
url?: string;
|
|
1632
1467
|
detail?: "low" | "high" | "auto";
|
|
1633
1468
|
};
|
|
1634
1469
|
}[];
|
|
1635
|
-
name?: string;
|
|
1636
1470
|
tool_calls?: {
|
|
1637
1471
|
function?: {
|
|
1638
1472
|
name?: string;
|
|
@@ -1657,16 +1491,16 @@ declare const OpenAIResponseSchema: z.ZodObject<{
|
|
|
1657
1491
|
};
|
|
1658
1492
|
index?: number;
|
|
1659
1493
|
delta?: {
|
|
1660
|
-
|
|
1494
|
+
name?: string;
|
|
1495
|
+
role?: "system" | "user" | "assistant" | "tool";
|
|
1661
1496
|
content?: string | {
|
|
1662
|
-
text?: string;
|
|
1663
1497
|
type?: "text" | "image_url";
|
|
1498
|
+
text?: string;
|
|
1664
1499
|
image_url?: {
|
|
1665
1500
|
url?: string;
|
|
1666
1501
|
detail?: "low" | "high" | "auto";
|
|
1667
1502
|
};
|
|
1668
1503
|
}[];
|
|
1669
|
-
name?: string;
|
|
1670
1504
|
tool_calls?: {
|
|
1671
1505
|
function?: {
|
|
1672
1506
|
name?: string;
|
|
@@ -1698,16 +1532,16 @@ declare const OpenAIResponseSchema: z.ZodObject<{
|
|
|
1698
1532
|
created?: number;
|
|
1699
1533
|
choices?: {
|
|
1700
1534
|
message?: {
|
|
1701
|
-
|
|
1535
|
+
name?: string;
|
|
1536
|
+
role?: "system" | "user" | "assistant" | "tool";
|
|
1702
1537
|
content?: string | {
|
|
1703
|
-
text?: string;
|
|
1704
1538
|
type?: "text" | "image_url";
|
|
1539
|
+
text?: string;
|
|
1705
1540
|
image_url?: {
|
|
1706
1541
|
url?: string;
|
|
1707
1542
|
detail?: "low" | "high" | "auto";
|
|
1708
1543
|
};
|
|
1709
1544
|
}[];
|
|
1710
|
-
name?: string;
|
|
1711
1545
|
tool_calls?: {
|
|
1712
1546
|
function?: {
|
|
1713
1547
|
name?: string;
|
|
@@ -1732,16 +1566,16 @@ declare const OpenAIResponseSchema: z.ZodObject<{
|
|
|
1732
1566
|
};
|
|
1733
1567
|
index?: number;
|
|
1734
1568
|
delta?: {
|
|
1735
|
-
|
|
1569
|
+
name?: string;
|
|
1570
|
+
role?: "system" | "user" | "assistant" | "tool";
|
|
1736
1571
|
content?: string | {
|
|
1737
|
-
text?: string;
|
|
1738
1572
|
type?: "text" | "image_url";
|
|
1573
|
+
text?: string;
|
|
1739
1574
|
image_url?: {
|
|
1740
1575
|
url?: string;
|
|
1741
1576
|
detail?: "low" | "high" | "auto";
|
|
1742
1577
|
};
|
|
1743
1578
|
}[];
|
|
1744
|
-
name?: string;
|
|
1745
1579
|
tool_calls?: {
|
|
1746
1580
|
function?: {
|
|
1747
1581
|
name?: string;
|
|
@@ -1790,15 +1624,15 @@ declare const OpenAIStreamChunkSchema: z.ZodObject<{
|
|
|
1790
1624
|
detail?: "low" | "high" | "auto";
|
|
1791
1625
|
}>>;
|
|
1792
1626
|
}, "strip", z.ZodTypeAny, {
|
|
1793
|
-
text?: string;
|
|
1794
1627
|
type?: "text" | "image_url";
|
|
1628
|
+
text?: string;
|
|
1795
1629
|
image_url?: {
|
|
1796
1630
|
url?: string;
|
|
1797
1631
|
detail?: "low" | "high" | "auto";
|
|
1798
1632
|
};
|
|
1799
1633
|
}, {
|
|
1800
|
-
text?: string;
|
|
1801
1634
|
type?: "text" | "image_url";
|
|
1635
|
+
text?: string;
|
|
1802
1636
|
image_url?: {
|
|
1803
1637
|
url?: string;
|
|
1804
1638
|
detail?: "low" | "high" | "auto";
|
|
@@ -1835,16 +1669,16 @@ declare const OpenAIStreamChunkSchema: z.ZodObject<{
|
|
|
1835
1669
|
}>, "many">>;
|
|
1836
1670
|
tool_call_id: z.ZodOptional<z.ZodString>;
|
|
1837
1671
|
}, "strip", z.ZodTypeAny, {
|
|
1838
|
-
|
|
1672
|
+
name?: string;
|
|
1673
|
+
role?: "system" | "user" | "assistant" | "tool";
|
|
1839
1674
|
content?: string | {
|
|
1840
|
-
text?: string;
|
|
1841
1675
|
type?: "text" | "image_url";
|
|
1676
|
+
text?: string;
|
|
1842
1677
|
image_url?: {
|
|
1843
1678
|
url?: string;
|
|
1844
1679
|
detail?: "low" | "high" | "auto";
|
|
1845
1680
|
};
|
|
1846
1681
|
}[];
|
|
1847
|
-
name?: string;
|
|
1848
1682
|
tool_calls?: {
|
|
1849
1683
|
function?: {
|
|
1850
1684
|
name?: string;
|
|
@@ -1855,16 +1689,16 @@ declare const OpenAIStreamChunkSchema: z.ZodObject<{
|
|
|
1855
1689
|
}[];
|
|
1856
1690
|
tool_call_id?: string;
|
|
1857
1691
|
}, {
|
|
1858
|
-
|
|
1692
|
+
name?: string;
|
|
1693
|
+
role?: "system" | "user" | "assistant" | "tool";
|
|
1859
1694
|
content?: string | {
|
|
1860
|
-
text?: string;
|
|
1861
1695
|
type?: "text" | "image_url";
|
|
1696
|
+
text?: string;
|
|
1862
1697
|
image_url?: {
|
|
1863
1698
|
url?: string;
|
|
1864
1699
|
detail?: "low" | "high" | "auto";
|
|
1865
1700
|
};
|
|
1866
1701
|
}[];
|
|
1867
|
-
name?: string;
|
|
1868
1702
|
tool_calls?: {
|
|
1869
1703
|
function?: {
|
|
1870
1704
|
name?: string;
|
|
@@ -1891,15 +1725,15 @@ declare const OpenAIStreamChunkSchema: z.ZodObject<{
|
|
|
1891
1725
|
detail?: "low" | "high" | "auto";
|
|
1892
1726
|
}>>;
|
|
1893
1727
|
}, "strip", z.ZodTypeAny, {
|
|
1894
|
-
text?: string;
|
|
1895
1728
|
type?: "text" | "image_url";
|
|
1729
|
+
text?: string;
|
|
1896
1730
|
image_url?: {
|
|
1897
1731
|
url?: string;
|
|
1898
1732
|
detail?: "low" | "high" | "auto";
|
|
1899
1733
|
};
|
|
1900
1734
|
}, {
|
|
1901
|
-
text?: string;
|
|
1902
1735
|
type?: "text" | "image_url";
|
|
1736
|
+
text?: string;
|
|
1903
1737
|
image_url?: {
|
|
1904
1738
|
url?: string;
|
|
1905
1739
|
detail?: "low" | "high" | "auto";
|
|
@@ -1936,16 +1770,16 @@ declare const OpenAIStreamChunkSchema: z.ZodObject<{
|
|
|
1936
1770
|
}>, "many">>;
|
|
1937
1771
|
tool_call_id: z.ZodOptional<z.ZodString>;
|
|
1938
1772
|
}, "strip", z.ZodTypeAny, {
|
|
1939
|
-
|
|
1773
|
+
name?: string;
|
|
1774
|
+
role?: "system" | "user" | "assistant" | "tool";
|
|
1940
1775
|
content?: string | {
|
|
1941
|
-
text?: string;
|
|
1942
1776
|
type?: "text" | "image_url";
|
|
1777
|
+
text?: string;
|
|
1943
1778
|
image_url?: {
|
|
1944
1779
|
url?: string;
|
|
1945
1780
|
detail?: "low" | "high" | "auto";
|
|
1946
1781
|
};
|
|
1947
1782
|
}[];
|
|
1948
|
-
name?: string;
|
|
1949
1783
|
tool_calls?: {
|
|
1950
1784
|
function?: {
|
|
1951
1785
|
name?: string;
|
|
@@ -1956,16 +1790,16 @@ declare const OpenAIStreamChunkSchema: z.ZodObject<{
|
|
|
1956
1790
|
}[];
|
|
1957
1791
|
tool_call_id?: string;
|
|
1958
1792
|
}, {
|
|
1959
|
-
|
|
1793
|
+
name?: string;
|
|
1794
|
+
role?: "system" | "user" | "assistant" | "tool";
|
|
1960
1795
|
content?: string | {
|
|
1961
|
-
text?: string;
|
|
1962
1796
|
type?: "text" | "image_url";
|
|
1797
|
+
text?: string;
|
|
1963
1798
|
image_url?: {
|
|
1964
1799
|
url?: string;
|
|
1965
1800
|
detail?: "low" | "high" | "auto";
|
|
1966
1801
|
};
|
|
1967
1802
|
}[];
|
|
1968
|
-
name?: string;
|
|
1969
1803
|
tool_calls?: {
|
|
1970
1804
|
function?: {
|
|
1971
1805
|
name?: string;
|
|
@@ -2039,16 +1873,16 @@ declare const OpenAIStreamChunkSchema: z.ZodObject<{
|
|
|
2039
1873
|
finish_reason: z.ZodNullable<z.ZodEnum<["stop", "length", "tool_calls", "content_filter", "function_call"]>>;
|
|
2040
1874
|
}, "strip", z.ZodTypeAny, {
|
|
2041
1875
|
message?: {
|
|
2042
|
-
|
|
1876
|
+
name?: string;
|
|
1877
|
+
role?: "system" | "user" | "assistant" | "tool";
|
|
2043
1878
|
content?: string | {
|
|
2044
|
-
text?: string;
|
|
2045
1879
|
type?: "text" | "image_url";
|
|
1880
|
+
text?: string;
|
|
2046
1881
|
image_url?: {
|
|
2047
1882
|
url?: string;
|
|
2048
1883
|
detail?: "low" | "high" | "auto";
|
|
2049
1884
|
};
|
|
2050
1885
|
}[];
|
|
2051
|
-
name?: string;
|
|
2052
1886
|
tool_calls?: {
|
|
2053
1887
|
function?: {
|
|
2054
1888
|
name?: string;
|
|
@@ -2073,16 +1907,16 @@ declare const OpenAIStreamChunkSchema: z.ZodObject<{
|
|
|
2073
1907
|
};
|
|
2074
1908
|
index?: number;
|
|
2075
1909
|
delta?: {
|
|
2076
|
-
|
|
1910
|
+
name?: string;
|
|
1911
|
+
role?: "system" | "user" | "assistant" | "tool";
|
|
2077
1912
|
content?: string | {
|
|
2078
|
-
text?: string;
|
|
2079
1913
|
type?: "text" | "image_url";
|
|
1914
|
+
text?: string;
|
|
2080
1915
|
image_url?: {
|
|
2081
1916
|
url?: string;
|
|
2082
1917
|
detail?: "low" | "high" | "auto";
|
|
2083
1918
|
};
|
|
2084
1919
|
}[];
|
|
2085
|
-
name?: string;
|
|
2086
1920
|
tool_calls?: {
|
|
2087
1921
|
function?: {
|
|
2088
1922
|
name?: string;
|
|
@@ -2096,16 +1930,16 @@ declare const OpenAIStreamChunkSchema: z.ZodObject<{
|
|
|
2096
1930
|
finish_reason?: "length" | "tool_calls" | "stop" | "content_filter" | "function_call";
|
|
2097
1931
|
}, {
|
|
2098
1932
|
message?: {
|
|
2099
|
-
|
|
1933
|
+
name?: string;
|
|
1934
|
+
role?: "system" | "user" | "assistant" | "tool";
|
|
2100
1935
|
content?: string | {
|
|
2101
|
-
text?: string;
|
|
2102
1936
|
type?: "text" | "image_url";
|
|
1937
|
+
text?: string;
|
|
2103
1938
|
image_url?: {
|
|
2104
1939
|
url?: string;
|
|
2105
1940
|
detail?: "low" | "high" | "auto";
|
|
2106
1941
|
};
|
|
2107
1942
|
}[];
|
|
2108
|
-
name?: string;
|
|
2109
1943
|
tool_calls?: {
|
|
2110
1944
|
function?: {
|
|
2111
1945
|
name?: string;
|
|
@@ -2130,16 +1964,16 @@ declare const OpenAIStreamChunkSchema: z.ZodObject<{
|
|
|
2130
1964
|
};
|
|
2131
1965
|
index?: number;
|
|
2132
1966
|
delta?: {
|
|
2133
|
-
|
|
1967
|
+
name?: string;
|
|
1968
|
+
role?: "system" | "user" | "assistant" | "tool";
|
|
2134
1969
|
content?: string | {
|
|
2135
|
-
text?: string;
|
|
2136
1970
|
type?: "text" | "image_url";
|
|
1971
|
+
text?: string;
|
|
2137
1972
|
image_url?: {
|
|
2138
1973
|
url?: string;
|
|
2139
1974
|
detail?: "low" | "high" | "auto";
|
|
2140
1975
|
};
|
|
2141
1976
|
}[];
|
|
2142
|
-
name?: string;
|
|
2143
1977
|
tool_calls?: {
|
|
2144
1978
|
function?: {
|
|
2145
1979
|
name?: string;
|
|
@@ -2199,16 +2033,16 @@ declare const OpenAIStreamChunkSchema: z.ZodObject<{
|
|
|
2199
2033
|
created?: number;
|
|
2200
2034
|
choices?: {
|
|
2201
2035
|
message?: {
|
|
2202
|
-
|
|
2036
|
+
name?: string;
|
|
2037
|
+
role?: "system" | "user" | "assistant" | "tool";
|
|
2203
2038
|
content?: string | {
|
|
2204
|
-
text?: string;
|
|
2205
2039
|
type?: "text" | "image_url";
|
|
2040
|
+
text?: string;
|
|
2206
2041
|
image_url?: {
|
|
2207
2042
|
url?: string;
|
|
2208
2043
|
detail?: "low" | "high" | "auto";
|
|
2209
2044
|
};
|
|
2210
2045
|
}[];
|
|
2211
|
-
name?: string;
|
|
2212
2046
|
tool_calls?: {
|
|
2213
2047
|
function?: {
|
|
2214
2048
|
name?: string;
|
|
@@ -2233,16 +2067,16 @@ declare const OpenAIStreamChunkSchema: z.ZodObject<{
|
|
|
2233
2067
|
};
|
|
2234
2068
|
index?: number;
|
|
2235
2069
|
delta?: {
|
|
2236
|
-
|
|
2070
|
+
name?: string;
|
|
2071
|
+
role?: "system" | "user" | "assistant" | "tool";
|
|
2237
2072
|
content?: string | {
|
|
2238
|
-
text?: string;
|
|
2239
2073
|
type?: "text" | "image_url";
|
|
2074
|
+
text?: string;
|
|
2240
2075
|
image_url?: {
|
|
2241
2076
|
url?: string;
|
|
2242
2077
|
detail?: "low" | "high" | "auto";
|
|
2243
2078
|
};
|
|
2244
2079
|
}[];
|
|
2245
|
-
name?: string;
|
|
2246
2080
|
tool_calls?: {
|
|
2247
2081
|
function?: {
|
|
2248
2082
|
name?: string;
|
|
@@ -2274,16 +2108,16 @@ declare const OpenAIStreamChunkSchema: z.ZodObject<{
|
|
|
2274
2108
|
created?: number;
|
|
2275
2109
|
choices?: {
|
|
2276
2110
|
message?: {
|
|
2277
|
-
|
|
2111
|
+
name?: string;
|
|
2112
|
+
role?: "system" | "user" | "assistant" | "tool";
|
|
2278
2113
|
content?: string | {
|
|
2279
|
-
text?: string;
|
|
2280
2114
|
type?: "text" | "image_url";
|
|
2115
|
+
text?: string;
|
|
2281
2116
|
image_url?: {
|
|
2282
2117
|
url?: string;
|
|
2283
2118
|
detail?: "low" | "high" | "auto";
|
|
2284
2119
|
};
|
|
2285
2120
|
}[];
|
|
2286
|
-
name?: string;
|
|
2287
2121
|
tool_calls?: {
|
|
2288
2122
|
function?: {
|
|
2289
2123
|
name?: string;
|
|
@@ -2308,16 +2142,16 @@ declare const OpenAIStreamChunkSchema: z.ZodObject<{
|
|
|
2308
2142
|
};
|
|
2309
2143
|
index?: number;
|
|
2310
2144
|
delta?: {
|
|
2311
|
-
|
|
2145
|
+
name?: string;
|
|
2146
|
+
role?: "system" | "user" | "assistant" | "tool";
|
|
2312
2147
|
content?: string | {
|
|
2313
|
-
text?: string;
|
|
2314
2148
|
type?: "text" | "image_url";
|
|
2149
|
+
text?: string;
|
|
2315
2150
|
image_url?: {
|
|
2316
2151
|
url?: string;
|
|
2317
2152
|
detail?: "low" | "high" | "auto";
|
|
2318
2153
|
};
|
|
2319
2154
|
}[];
|
|
2320
|
-
name?: string;
|
|
2321
2155
|
tool_calls?: {
|
|
2322
2156
|
function?: {
|
|
2323
2157
|
name?: string;
|
|
@@ -2355,16 +2189,16 @@ declare const validateOpenAIRequest: (data: unknown) => {
|
|
|
2355
2189
|
user?: string;
|
|
2356
2190
|
model?: string;
|
|
2357
2191
|
messages?: {
|
|
2358
|
-
|
|
2192
|
+
name?: string;
|
|
2193
|
+
role?: "system" | "user" | "assistant" | "tool";
|
|
2359
2194
|
content?: string | {
|
|
2360
|
-
text?: string;
|
|
2361
2195
|
type?: "text" | "image_url";
|
|
2196
|
+
text?: string;
|
|
2362
2197
|
image_url?: {
|
|
2363
2198
|
url?: string;
|
|
2364
2199
|
detail?: "low" | "high" | "auto";
|
|
2365
2200
|
};
|
|
2366
2201
|
}[];
|
|
2367
|
-
name?: string;
|
|
2368
2202
|
tool_calls?: {
|
|
2369
2203
|
function?: {
|
|
2370
2204
|
name?: string;
|
|
@@ -2417,16 +2251,16 @@ declare const validateOpenAIResponse: (data: unknown) => {
|
|
|
2417
2251
|
created?: number;
|
|
2418
2252
|
choices?: {
|
|
2419
2253
|
message?: {
|
|
2420
|
-
|
|
2254
|
+
name?: string;
|
|
2255
|
+
role?: "system" | "user" | "assistant" | "tool";
|
|
2421
2256
|
content?: string | {
|
|
2422
|
-
text?: string;
|
|
2423
2257
|
type?: "text" | "image_url";
|
|
2258
|
+
text?: string;
|
|
2424
2259
|
image_url?: {
|
|
2425
2260
|
url?: string;
|
|
2426
2261
|
detail?: "low" | "high" | "auto";
|
|
2427
2262
|
};
|
|
2428
2263
|
}[];
|
|
2429
|
-
name?: string;
|
|
2430
2264
|
tool_calls?: {
|
|
2431
2265
|
function?: {
|
|
2432
2266
|
name?: string;
|
|
@@ -2451,16 +2285,16 @@ declare const validateOpenAIResponse: (data: unknown) => {
|
|
|
2451
2285
|
};
|
|
2452
2286
|
index?: number;
|
|
2453
2287
|
delta?: {
|
|
2454
|
-
|
|
2288
|
+
name?: string;
|
|
2289
|
+
role?: "system" | "user" | "assistant" | "tool";
|
|
2455
2290
|
content?: string | {
|
|
2456
|
-
text?: string;
|
|
2457
2291
|
type?: "text" | "image_url";
|
|
2292
|
+
text?: string;
|
|
2458
2293
|
image_url?: {
|
|
2459
2294
|
url?: string;
|
|
2460
2295
|
detail?: "low" | "high" | "auto";
|
|
2461
2296
|
};
|
|
2462
2297
|
}[];
|
|
2463
|
-
name?: string;
|
|
2464
2298
|
tool_calls?: {
|
|
2465
2299
|
function?: {
|
|
2466
2300
|
name?: string;
|
|
@@ -2493,16 +2327,16 @@ declare const validateOpenAIStreamChunk: (data: unknown) => {
|
|
|
2493
2327
|
created?: number;
|
|
2494
2328
|
choices?: {
|
|
2495
2329
|
message?: {
|
|
2496
|
-
|
|
2330
|
+
name?: string;
|
|
2331
|
+
role?: "system" | "user" | "assistant" | "tool";
|
|
2497
2332
|
content?: string | {
|
|
2498
|
-
text?: string;
|
|
2499
2333
|
type?: "text" | "image_url";
|
|
2334
|
+
text?: string;
|
|
2500
2335
|
image_url?: {
|
|
2501
2336
|
url?: string;
|
|
2502
2337
|
detail?: "low" | "high" | "auto";
|
|
2503
2338
|
};
|
|
2504
2339
|
}[];
|
|
2505
|
-
name?: string;
|
|
2506
2340
|
tool_calls?: {
|
|
2507
2341
|
function?: {
|
|
2508
2342
|
name?: string;
|
|
@@ -2527,16 +2361,16 @@ declare const validateOpenAIStreamChunk: (data: unknown) => {
|
|
|
2527
2361
|
};
|
|
2528
2362
|
index?: number;
|
|
2529
2363
|
delta?: {
|
|
2530
|
-
|
|
2364
|
+
name?: string;
|
|
2365
|
+
role?: "system" | "user" | "assistant" | "tool";
|
|
2531
2366
|
content?: string | {
|
|
2532
|
-
text?: string;
|
|
2533
2367
|
type?: "text" | "image_url";
|
|
2368
|
+
text?: string;
|
|
2534
2369
|
image_url?: {
|
|
2535
2370
|
url?: string;
|
|
2536
2371
|
detail?: "low" | "high" | "auto";
|
|
2537
2372
|
};
|
|
2538
2373
|
}[];
|
|
2539
|
-
name?: string;
|
|
2540
2374
|
tool_calls?: {
|
|
2541
2375
|
function?: {
|
|
2542
2376
|
name?: string;
|
|
@@ -2654,11 +2488,11 @@ declare const AnthropicTextContentBlockSchema: z.ZodObject<{} & {
|
|
|
2654
2488
|
type: z.ZodLiteral<"text">;
|
|
2655
2489
|
text: z.ZodString;
|
|
2656
2490
|
}, "strip", z.ZodTypeAny, {
|
|
2657
|
-
text?: string;
|
|
2658
2491
|
type?: "text";
|
|
2659
|
-
}, {
|
|
2660
2492
|
text?: string;
|
|
2493
|
+
}, {
|
|
2661
2494
|
type?: "text";
|
|
2495
|
+
text?: string;
|
|
2662
2496
|
}>;
|
|
2663
2497
|
declare const AnthropicImageContentBlockSchema: z.ZodObject<{} & {
|
|
2664
2498
|
type: z.ZodLiteral<"image">;
|
|
@@ -2713,11 +2547,11 @@ declare const AnthropicToolResultContentBlockSchema: z.ZodObject<{} & {
|
|
|
2713
2547
|
type: z.ZodLiteral<"text">;
|
|
2714
2548
|
text: z.ZodString;
|
|
2715
2549
|
}, "strip", z.ZodTypeAny, {
|
|
2716
|
-
text?: string;
|
|
2717
2550
|
type?: "text";
|
|
2718
|
-
}, {
|
|
2719
2551
|
text?: string;
|
|
2552
|
+
}, {
|
|
2720
2553
|
type?: "text";
|
|
2554
|
+
text?: string;
|
|
2721
2555
|
}>, z.ZodObject<{} & {
|
|
2722
2556
|
type: z.ZodLiteral<"image">;
|
|
2723
2557
|
source: z.ZodObject<{
|
|
@@ -2750,9 +2584,10 @@ declare const AnthropicToolResultContentBlockSchema: z.ZodObject<{} & {
|
|
|
2750
2584
|
}>]>, "many">]>>;
|
|
2751
2585
|
is_error: z.ZodOptional<z.ZodBoolean>;
|
|
2752
2586
|
}, "strip", z.ZodTypeAny, {
|
|
2587
|
+
type?: "tool_result";
|
|
2753
2588
|
content?: string | ({
|
|
2754
|
-
text?: string;
|
|
2755
2589
|
type?: "text";
|
|
2590
|
+
text?: string;
|
|
2756
2591
|
} | {
|
|
2757
2592
|
type?: "image";
|
|
2758
2593
|
source?: {
|
|
@@ -2761,13 +2596,13 @@ declare const AnthropicToolResultContentBlockSchema: z.ZodObject<{} & {
|
|
|
2761
2596
|
data?: string;
|
|
2762
2597
|
};
|
|
2763
2598
|
})[];
|
|
2764
|
-
type?: "tool_result";
|
|
2765
2599
|
tool_use_id?: string;
|
|
2766
2600
|
is_error?: boolean;
|
|
2767
2601
|
}, {
|
|
2602
|
+
type?: "tool_result";
|
|
2768
2603
|
content?: string | ({
|
|
2769
|
-
text?: string;
|
|
2770
2604
|
type?: "text";
|
|
2605
|
+
text?: string;
|
|
2771
2606
|
} | {
|
|
2772
2607
|
type?: "image";
|
|
2773
2608
|
source?: {
|
|
@@ -2776,7 +2611,6 @@ declare const AnthropicToolResultContentBlockSchema: z.ZodObject<{} & {
|
|
|
2776
2611
|
data?: string;
|
|
2777
2612
|
};
|
|
2778
2613
|
})[];
|
|
2779
|
-
type?: "tool_result";
|
|
2780
2614
|
tool_use_id?: string;
|
|
2781
2615
|
is_error?: boolean;
|
|
2782
2616
|
}>;
|
|
@@ -2784,11 +2618,11 @@ declare const AnthropicContentBlockSchema: z.ZodUnion<[z.ZodObject<{} & {
|
|
|
2784
2618
|
type: z.ZodLiteral<"text">;
|
|
2785
2619
|
text: z.ZodString;
|
|
2786
2620
|
}, "strip", z.ZodTypeAny, {
|
|
2787
|
-
text?: string;
|
|
2788
2621
|
type?: "text";
|
|
2789
|
-
}, {
|
|
2790
2622
|
text?: string;
|
|
2623
|
+
}, {
|
|
2791
2624
|
type?: "text";
|
|
2625
|
+
text?: string;
|
|
2792
2626
|
}>, z.ZodObject<{} & {
|
|
2793
2627
|
type: z.ZodLiteral<"image">;
|
|
2794
2628
|
source: z.ZodObject<{
|
|
@@ -2840,11 +2674,11 @@ declare const AnthropicContentBlockSchema: z.ZodUnion<[z.ZodObject<{} & {
|
|
|
2840
2674
|
type: z.ZodLiteral<"text">;
|
|
2841
2675
|
text: z.ZodString;
|
|
2842
2676
|
}, "strip", z.ZodTypeAny, {
|
|
2843
|
-
text?: string;
|
|
2844
2677
|
type?: "text";
|
|
2845
|
-
}, {
|
|
2846
2678
|
text?: string;
|
|
2679
|
+
}, {
|
|
2847
2680
|
type?: "text";
|
|
2681
|
+
text?: string;
|
|
2848
2682
|
}>, z.ZodObject<{} & {
|
|
2849
2683
|
type: z.ZodLiteral<"image">;
|
|
2850
2684
|
source: z.ZodObject<{
|
|
@@ -2877,9 +2711,10 @@ declare const AnthropicContentBlockSchema: z.ZodUnion<[z.ZodObject<{} & {
|
|
|
2877
2711
|
}>]>, "many">]>>;
|
|
2878
2712
|
is_error: z.ZodOptional<z.ZodBoolean>;
|
|
2879
2713
|
}, "strip", z.ZodTypeAny, {
|
|
2714
|
+
type?: "tool_result";
|
|
2880
2715
|
content?: string | ({
|
|
2881
|
-
text?: string;
|
|
2882
2716
|
type?: "text";
|
|
2717
|
+
text?: string;
|
|
2883
2718
|
} | {
|
|
2884
2719
|
type?: "image";
|
|
2885
2720
|
source?: {
|
|
@@ -2888,13 +2723,13 @@ declare const AnthropicContentBlockSchema: z.ZodUnion<[z.ZodObject<{} & {
|
|
|
2888
2723
|
data?: string;
|
|
2889
2724
|
};
|
|
2890
2725
|
})[];
|
|
2891
|
-
type?: "tool_result";
|
|
2892
2726
|
tool_use_id?: string;
|
|
2893
2727
|
is_error?: boolean;
|
|
2894
2728
|
}, {
|
|
2729
|
+
type?: "tool_result";
|
|
2895
2730
|
content?: string | ({
|
|
2896
|
-
text?: string;
|
|
2897
2731
|
type?: "text";
|
|
2732
|
+
text?: string;
|
|
2898
2733
|
} | {
|
|
2899
2734
|
type?: "image";
|
|
2900
2735
|
source?: {
|
|
@@ -2903,7 +2738,6 @@ declare const AnthropicContentBlockSchema: z.ZodUnion<[z.ZodObject<{} & {
|
|
|
2903
2738
|
data?: string;
|
|
2904
2739
|
};
|
|
2905
2740
|
})[];
|
|
2906
|
-
type?: "tool_result";
|
|
2907
2741
|
tool_use_id?: string;
|
|
2908
2742
|
is_error?: boolean;
|
|
2909
2743
|
}>]>;
|
|
@@ -2913,11 +2747,11 @@ declare const AnthropicMessageSchema: z.ZodObject<{
|
|
|
2913
2747
|
type: z.ZodLiteral<"text">;
|
|
2914
2748
|
text: z.ZodString;
|
|
2915
2749
|
}, "strip", z.ZodTypeAny, {
|
|
2916
|
-
text?: string;
|
|
2917
2750
|
type?: "text";
|
|
2918
|
-
}, {
|
|
2919
2751
|
text?: string;
|
|
2752
|
+
}, {
|
|
2920
2753
|
type?: "text";
|
|
2754
|
+
text?: string;
|
|
2921
2755
|
}>, z.ZodObject<{} & {
|
|
2922
2756
|
type: z.ZodLiteral<"image">;
|
|
2923
2757
|
source: z.ZodObject<{
|
|
@@ -2969,11 +2803,11 @@ declare const AnthropicMessageSchema: z.ZodObject<{
|
|
|
2969
2803
|
type: z.ZodLiteral<"text">;
|
|
2970
2804
|
text: z.ZodString;
|
|
2971
2805
|
}, "strip", z.ZodTypeAny, {
|
|
2972
|
-
text?: string;
|
|
2973
2806
|
type?: "text";
|
|
2974
|
-
}, {
|
|
2975
2807
|
text?: string;
|
|
2808
|
+
}, {
|
|
2976
2809
|
type?: "text";
|
|
2810
|
+
text?: string;
|
|
2977
2811
|
}>, z.ZodObject<{} & {
|
|
2978
2812
|
type: z.ZodLiteral<"image">;
|
|
2979
2813
|
source: z.ZodObject<{
|
|
@@ -3006,9 +2840,10 @@ declare const AnthropicMessageSchema: z.ZodObject<{
|
|
|
3006
2840
|
}>]>, "many">]>>;
|
|
3007
2841
|
is_error: z.ZodOptional<z.ZodBoolean>;
|
|
3008
2842
|
}, "strip", z.ZodTypeAny, {
|
|
2843
|
+
type?: "tool_result";
|
|
3009
2844
|
content?: string | ({
|
|
3010
|
-
text?: string;
|
|
3011
2845
|
type?: "text";
|
|
2846
|
+
text?: string;
|
|
3012
2847
|
} | {
|
|
3013
2848
|
type?: "image";
|
|
3014
2849
|
source?: {
|
|
@@ -3017,13 +2852,13 @@ declare const AnthropicMessageSchema: z.ZodObject<{
|
|
|
3017
2852
|
data?: string;
|
|
3018
2853
|
};
|
|
3019
2854
|
})[];
|
|
3020
|
-
type?: "tool_result";
|
|
3021
2855
|
tool_use_id?: string;
|
|
3022
2856
|
is_error?: boolean;
|
|
3023
2857
|
}, {
|
|
2858
|
+
type?: "tool_result";
|
|
3024
2859
|
content?: string | ({
|
|
3025
|
-
text?: string;
|
|
3026
2860
|
type?: "text";
|
|
2861
|
+
text?: string;
|
|
3027
2862
|
} | {
|
|
3028
2863
|
type?: "image";
|
|
3029
2864
|
source?: {
|
|
@@ -3032,15 +2867,14 @@ declare const AnthropicMessageSchema: z.ZodObject<{
|
|
|
3032
2867
|
data?: string;
|
|
3033
2868
|
};
|
|
3034
2869
|
})[];
|
|
3035
|
-
type?: "tool_result";
|
|
3036
2870
|
tool_use_id?: string;
|
|
3037
2871
|
is_error?: boolean;
|
|
3038
2872
|
}>]>, "many">]>;
|
|
3039
2873
|
}, "strip", z.ZodTypeAny, {
|
|
3040
|
-
role?: "
|
|
2874
|
+
role?: "system" | "user" | "assistant";
|
|
3041
2875
|
content?: string | ({
|
|
3042
|
-
text?: string;
|
|
3043
2876
|
type?: "text";
|
|
2877
|
+
text?: string;
|
|
3044
2878
|
} | {
|
|
3045
2879
|
type?: "image";
|
|
3046
2880
|
source?: {
|
|
@@ -3054,9 +2888,10 @@ declare const AnthropicMessageSchema: z.ZodObject<{
|
|
|
3054
2888
|
id?: string;
|
|
3055
2889
|
input?: Record<string, unknown>;
|
|
3056
2890
|
} | {
|
|
2891
|
+
type?: "tool_result";
|
|
3057
2892
|
content?: string | ({
|
|
3058
|
-
text?: string;
|
|
3059
2893
|
type?: "text";
|
|
2894
|
+
text?: string;
|
|
3060
2895
|
} | {
|
|
3061
2896
|
type?: "image";
|
|
3062
2897
|
source?: {
|
|
@@ -3065,15 +2900,14 @@ declare const AnthropicMessageSchema: z.ZodObject<{
|
|
|
3065
2900
|
data?: string;
|
|
3066
2901
|
};
|
|
3067
2902
|
})[];
|
|
3068
|
-
type?: "tool_result";
|
|
3069
2903
|
tool_use_id?: string;
|
|
3070
2904
|
is_error?: boolean;
|
|
3071
2905
|
})[];
|
|
3072
2906
|
}, {
|
|
3073
|
-
role?: "
|
|
2907
|
+
role?: "system" | "user" | "assistant";
|
|
3074
2908
|
content?: string | ({
|
|
3075
|
-
text?: string;
|
|
3076
2909
|
type?: "text";
|
|
2910
|
+
text?: string;
|
|
3077
2911
|
} | {
|
|
3078
2912
|
type?: "image";
|
|
3079
2913
|
source?: {
|
|
@@ -3087,9 +2921,10 @@ declare const AnthropicMessageSchema: z.ZodObject<{
|
|
|
3087
2921
|
id?: string;
|
|
3088
2922
|
input?: Record<string, unknown>;
|
|
3089
2923
|
} | {
|
|
2924
|
+
type?: "tool_result";
|
|
3090
2925
|
content?: string | ({
|
|
3091
|
-
text?: string;
|
|
3092
2926
|
type?: "text";
|
|
2927
|
+
text?: string;
|
|
3093
2928
|
} | {
|
|
3094
2929
|
type?: "image";
|
|
3095
2930
|
source?: {
|
|
@@ -3098,7 +2933,6 @@ declare const AnthropicMessageSchema: z.ZodObject<{
|
|
|
3098
2933
|
data?: string;
|
|
3099
2934
|
};
|
|
3100
2935
|
})[];
|
|
3101
|
-
type?: "tool_result";
|
|
3102
2936
|
tool_use_id?: string;
|
|
3103
2937
|
is_error?: boolean;
|
|
3104
2938
|
})[];
|
|
@@ -3114,14 +2948,14 @@ declare const AnthropicSystemMessageSchema: z.ZodUnion<[z.ZodString, z.ZodArray<
|
|
|
3114
2948
|
type?: "ephemeral";
|
|
3115
2949
|
}>>;
|
|
3116
2950
|
}, "strip", z.ZodTypeAny, {
|
|
3117
|
-
text?: string;
|
|
3118
2951
|
type?: "text";
|
|
2952
|
+
text?: string;
|
|
3119
2953
|
cache_control?: {
|
|
3120
2954
|
type?: "ephemeral";
|
|
3121
2955
|
};
|
|
3122
2956
|
}, {
|
|
3123
|
-
text?: string;
|
|
3124
2957
|
type?: "text";
|
|
2958
|
+
text?: string;
|
|
3125
2959
|
cache_control?: {
|
|
3126
2960
|
type?: "ephemeral";
|
|
3127
2961
|
};
|
|
@@ -3142,11 +2976,11 @@ declare const AnthropicRequestSchema: z.ZodObject<{
|
|
|
3142
2976
|
type: z.ZodLiteral<"text">;
|
|
3143
2977
|
text: z.ZodString;
|
|
3144
2978
|
}, "strip", z.ZodTypeAny, {
|
|
3145
|
-
text?: string;
|
|
3146
2979
|
type?: "text";
|
|
3147
|
-
}, {
|
|
3148
2980
|
text?: string;
|
|
2981
|
+
}, {
|
|
3149
2982
|
type?: "text";
|
|
2983
|
+
text?: string;
|
|
3150
2984
|
}>, z.ZodObject<{} & {
|
|
3151
2985
|
type: z.ZodLiteral<"image">;
|
|
3152
2986
|
source: z.ZodObject<{
|
|
@@ -3198,11 +3032,11 @@ declare const AnthropicRequestSchema: z.ZodObject<{
|
|
|
3198
3032
|
type: z.ZodLiteral<"text">;
|
|
3199
3033
|
text: z.ZodString;
|
|
3200
3034
|
}, "strip", z.ZodTypeAny, {
|
|
3201
|
-
text?: string;
|
|
3202
3035
|
type?: "text";
|
|
3203
|
-
}, {
|
|
3204
3036
|
text?: string;
|
|
3037
|
+
}, {
|
|
3205
3038
|
type?: "text";
|
|
3039
|
+
text?: string;
|
|
3206
3040
|
}>, z.ZodObject<{} & {
|
|
3207
3041
|
type: z.ZodLiteral<"image">;
|
|
3208
3042
|
source: z.ZodObject<{
|
|
@@ -3235,9 +3069,10 @@ declare const AnthropicRequestSchema: z.ZodObject<{
|
|
|
3235
3069
|
}>]>, "many">]>>;
|
|
3236
3070
|
is_error: z.ZodOptional<z.ZodBoolean>;
|
|
3237
3071
|
}, "strip", z.ZodTypeAny, {
|
|
3072
|
+
type?: "tool_result";
|
|
3238
3073
|
content?: string | ({
|
|
3239
|
-
text?: string;
|
|
3240
3074
|
type?: "text";
|
|
3075
|
+
text?: string;
|
|
3241
3076
|
} | {
|
|
3242
3077
|
type?: "image";
|
|
3243
3078
|
source?: {
|
|
@@ -3246,13 +3081,13 @@ declare const AnthropicRequestSchema: z.ZodObject<{
|
|
|
3246
3081
|
data?: string;
|
|
3247
3082
|
};
|
|
3248
3083
|
})[];
|
|
3249
|
-
type?: "tool_result";
|
|
3250
3084
|
tool_use_id?: string;
|
|
3251
3085
|
is_error?: boolean;
|
|
3252
3086
|
}, {
|
|
3087
|
+
type?: "tool_result";
|
|
3253
3088
|
content?: string | ({
|
|
3254
|
-
text?: string;
|
|
3255
3089
|
type?: "text";
|
|
3090
|
+
text?: string;
|
|
3256
3091
|
} | {
|
|
3257
3092
|
type?: "image";
|
|
3258
3093
|
source?: {
|
|
@@ -3261,15 +3096,14 @@ declare const AnthropicRequestSchema: z.ZodObject<{
|
|
|
3261
3096
|
data?: string;
|
|
3262
3097
|
};
|
|
3263
3098
|
})[];
|
|
3264
|
-
type?: "tool_result";
|
|
3265
3099
|
tool_use_id?: string;
|
|
3266
3100
|
is_error?: boolean;
|
|
3267
3101
|
}>]>, "many">]>;
|
|
3268
3102
|
}, "strip", z.ZodTypeAny, {
|
|
3269
|
-
role?: "
|
|
3103
|
+
role?: "system" | "user" | "assistant";
|
|
3270
3104
|
content?: string | ({
|
|
3271
|
-
text?: string;
|
|
3272
3105
|
type?: "text";
|
|
3106
|
+
text?: string;
|
|
3273
3107
|
} | {
|
|
3274
3108
|
type?: "image";
|
|
3275
3109
|
source?: {
|
|
@@ -3283,9 +3117,10 @@ declare const AnthropicRequestSchema: z.ZodObject<{
|
|
|
3283
3117
|
id?: string;
|
|
3284
3118
|
input?: Record<string, unknown>;
|
|
3285
3119
|
} | {
|
|
3120
|
+
type?: "tool_result";
|
|
3286
3121
|
content?: string | ({
|
|
3287
|
-
text?: string;
|
|
3288
3122
|
type?: "text";
|
|
3123
|
+
text?: string;
|
|
3289
3124
|
} | {
|
|
3290
3125
|
type?: "image";
|
|
3291
3126
|
source?: {
|
|
@@ -3294,15 +3129,14 @@ declare const AnthropicRequestSchema: z.ZodObject<{
|
|
|
3294
3129
|
data?: string;
|
|
3295
3130
|
};
|
|
3296
3131
|
})[];
|
|
3297
|
-
type?: "tool_result";
|
|
3298
3132
|
tool_use_id?: string;
|
|
3299
3133
|
is_error?: boolean;
|
|
3300
3134
|
})[];
|
|
3301
3135
|
}, {
|
|
3302
|
-
role?: "
|
|
3136
|
+
role?: "system" | "user" | "assistant";
|
|
3303
3137
|
content?: string | ({
|
|
3304
|
-
text?: string;
|
|
3305
3138
|
type?: "text";
|
|
3139
|
+
text?: string;
|
|
3306
3140
|
} | {
|
|
3307
3141
|
type?: "image";
|
|
3308
3142
|
source?: {
|
|
@@ -3316,9 +3150,10 @@ declare const AnthropicRequestSchema: z.ZodObject<{
|
|
|
3316
3150
|
id?: string;
|
|
3317
3151
|
input?: Record<string, unknown>;
|
|
3318
3152
|
} | {
|
|
3153
|
+
type?: "tool_result";
|
|
3319
3154
|
content?: string | ({
|
|
3320
|
-
text?: string;
|
|
3321
3155
|
type?: "text";
|
|
3156
|
+
text?: string;
|
|
3322
3157
|
} | {
|
|
3323
3158
|
type?: "image";
|
|
3324
3159
|
source?: {
|
|
@@ -3327,7 +3162,6 @@ declare const AnthropicRequestSchema: z.ZodObject<{
|
|
|
3327
3162
|
data?: string;
|
|
3328
3163
|
};
|
|
3329
3164
|
})[];
|
|
3330
|
-
type?: "tool_result";
|
|
3331
3165
|
tool_use_id?: string;
|
|
3332
3166
|
is_error?: boolean;
|
|
3333
3167
|
})[];
|
|
@@ -3343,14 +3177,14 @@ declare const AnthropicRequestSchema: z.ZodObject<{
|
|
|
3343
3177
|
type?: "ephemeral";
|
|
3344
3178
|
}>>;
|
|
3345
3179
|
}, "strip", z.ZodTypeAny, {
|
|
3346
|
-
text?: string;
|
|
3347
3180
|
type?: "text";
|
|
3181
|
+
text?: string;
|
|
3348
3182
|
cache_control?: {
|
|
3349
3183
|
type?: "ephemeral";
|
|
3350
3184
|
};
|
|
3351
3185
|
}, {
|
|
3352
|
-
text?: string;
|
|
3353
3186
|
type?: "text";
|
|
3187
|
+
text?: string;
|
|
3354
3188
|
cache_control?: {
|
|
3355
3189
|
type?: "ephemeral";
|
|
3356
3190
|
};
|
|
@@ -3434,18 +3268,18 @@ declare const AnthropicRequestSchema: z.ZodObject<{
|
|
|
3434
3268
|
}>]>>;
|
|
3435
3269
|
}, "strip", z.ZodTypeAny, {
|
|
3436
3270
|
system?: string | {
|
|
3437
|
-
text?: string;
|
|
3438
3271
|
type?: "text";
|
|
3272
|
+
text?: string;
|
|
3439
3273
|
cache_control?: {
|
|
3440
3274
|
type?: "ephemeral";
|
|
3441
3275
|
};
|
|
3442
3276
|
}[];
|
|
3443
3277
|
model?: string;
|
|
3444
3278
|
messages?: {
|
|
3445
|
-
role?: "
|
|
3279
|
+
role?: "system" | "user" | "assistant";
|
|
3446
3280
|
content?: string | ({
|
|
3447
|
-
text?: string;
|
|
3448
3281
|
type?: "text";
|
|
3282
|
+
text?: string;
|
|
3449
3283
|
} | {
|
|
3450
3284
|
type?: "image";
|
|
3451
3285
|
source?: {
|
|
@@ -3459,9 +3293,10 @@ declare const AnthropicRequestSchema: z.ZodObject<{
|
|
|
3459
3293
|
id?: string;
|
|
3460
3294
|
input?: Record<string, unknown>;
|
|
3461
3295
|
} | {
|
|
3296
|
+
type?: "tool_result";
|
|
3462
3297
|
content?: string | ({
|
|
3463
|
-
text?: string;
|
|
3464
3298
|
type?: "text";
|
|
3299
|
+
text?: string;
|
|
3465
3300
|
} | {
|
|
3466
3301
|
type?: "image";
|
|
3467
3302
|
source?: {
|
|
@@ -3470,7 +3305,6 @@ declare const AnthropicRequestSchema: z.ZodObject<{
|
|
|
3470
3305
|
data?: string;
|
|
3471
3306
|
};
|
|
3472
3307
|
})[];
|
|
3473
|
-
type?: "tool_result";
|
|
3474
3308
|
tool_use_id?: string;
|
|
3475
3309
|
is_error?: boolean;
|
|
3476
3310
|
})[];
|
|
@@ -3505,18 +3339,18 @@ declare const AnthropicRequestSchema: z.ZodObject<{
|
|
|
3505
3339
|
top_k?: number;
|
|
3506
3340
|
}, {
|
|
3507
3341
|
system?: string | {
|
|
3508
|
-
text?: string;
|
|
3509
3342
|
type?: "text";
|
|
3343
|
+
text?: string;
|
|
3510
3344
|
cache_control?: {
|
|
3511
3345
|
type?: "ephemeral";
|
|
3512
3346
|
};
|
|
3513
3347
|
}[];
|
|
3514
3348
|
model?: string;
|
|
3515
3349
|
messages?: {
|
|
3516
|
-
role?: "
|
|
3350
|
+
role?: "system" | "user" | "assistant";
|
|
3517
3351
|
content?: string | ({
|
|
3518
|
-
text?: string;
|
|
3519
3352
|
type?: "text";
|
|
3353
|
+
text?: string;
|
|
3520
3354
|
} | {
|
|
3521
3355
|
type?: "image";
|
|
3522
3356
|
source?: {
|
|
@@ -3530,9 +3364,10 @@ declare const AnthropicRequestSchema: z.ZodObject<{
|
|
|
3530
3364
|
id?: string;
|
|
3531
3365
|
input?: Record<string, unknown>;
|
|
3532
3366
|
} | {
|
|
3367
|
+
type?: "tool_result";
|
|
3533
3368
|
content?: string | ({
|
|
3534
|
-
text?: string;
|
|
3535
3369
|
type?: "text";
|
|
3370
|
+
text?: string;
|
|
3536
3371
|
} | {
|
|
3537
3372
|
type?: "image";
|
|
3538
3373
|
source?: {
|
|
@@ -3541,7 +3376,6 @@ declare const AnthropicRequestSchema: z.ZodObject<{
|
|
|
3541
3376
|
data?: string;
|
|
3542
3377
|
};
|
|
3543
3378
|
})[];
|
|
3544
|
-
type?: "tool_result";
|
|
3545
3379
|
tool_use_id?: string;
|
|
3546
3380
|
is_error?: boolean;
|
|
3547
3381
|
})[];
|
|
@@ -3600,11 +3434,11 @@ declare const AnthropicResponseSchema: z.ZodObject<{
|
|
|
3600
3434
|
type: z.ZodLiteral<"text">;
|
|
3601
3435
|
text: z.ZodString;
|
|
3602
3436
|
}, "strip", z.ZodTypeAny, {
|
|
3603
|
-
text?: string;
|
|
3604
3437
|
type?: "text";
|
|
3605
|
-
}, {
|
|
3606
3438
|
text?: string;
|
|
3439
|
+
}, {
|
|
3607
3440
|
type?: "text";
|
|
3441
|
+
text?: string;
|
|
3608
3442
|
}>, z.ZodObject<{} & {
|
|
3609
3443
|
type: z.ZodLiteral<"image">;
|
|
3610
3444
|
source: z.ZodObject<{
|
|
@@ -3656,11 +3490,11 @@ declare const AnthropicResponseSchema: z.ZodObject<{
|
|
|
3656
3490
|
type: z.ZodLiteral<"text">;
|
|
3657
3491
|
text: z.ZodString;
|
|
3658
3492
|
}, "strip", z.ZodTypeAny, {
|
|
3659
|
-
text?: string;
|
|
3660
3493
|
type?: "text";
|
|
3661
|
-
}, {
|
|
3662
3494
|
text?: string;
|
|
3495
|
+
}, {
|
|
3663
3496
|
type?: "text";
|
|
3497
|
+
text?: string;
|
|
3664
3498
|
}>, z.ZodObject<{} & {
|
|
3665
3499
|
type: z.ZodLiteral<"image">;
|
|
3666
3500
|
source: z.ZodObject<{
|
|
@@ -3693,9 +3527,10 @@ declare const AnthropicResponseSchema: z.ZodObject<{
|
|
|
3693
3527
|
}>]>, "many">]>>;
|
|
3694
3528
|
is_error: z.ZodOptional<z.ZodBoolean>;
|
|
3695
3529
|
}, "strip", z.ZodTypeAny, {
|
|
3530
|
+
type?: "tool_result";
|
|
3696
3531
|
content?: string | ({
|
|
3697
|
-
text?: string;
|
|
3698
3532
|
type?: "text";
|
|
3533
|
+
text?: string;
|
|
3699
3534
|
} | {
|
|
3700
3535
|
type?: "image";
|
|
3701
3536
|
source?: {
|
|
@@ -3704,13 +3539,13 @@ declare const AnthropicResponseSchema: z.ZodObject<{
|
|
|
3704
3539
|
data?: string;
|
|
3705
3540
|
};
|
|
3706
3541
|
})[];
|
|
3707
|
-
type?: "tool_result";
|
|
3708
3542
|
tool_use_id?: string;
|
|
3709
3543
|
is_error?: boolean;
|
|
3710
3544
|
}, {
|
|
3545
|
+
type?: "tool_result";
|
|
3711
3546
|
content?: string | ({
|
|
3712
|
-
text?: string;
|
|
3713
3547
|
type?: "text";
|
|
3548
|
+
text?: string;
|
|
3714
3549
|
} | {
|
|
3715
3550
|
type?: "image";
|
|
3716
3551
|
source?: {
|
|
@@ -3719,7 +3554,6 @@ declare const AnthropicResponseSchema: z.ZodObject<{
|
|
|
3719
3554
|
data?: string;
|
|
3720
3555
|
};
|
|
3721
3556
|
})[];
|
|
3722
|
-
type?: "tool_result";
|
|
3723
3557
|
tool_use_id?: string;
|
|
3724
3558
|
is_error?: boolean;
|
|
3725
3559
|
}>]>, "many">;
|
|
@@ -3742,10 +3576,12 @@ declare const AnthropicResponseSchema: z.ZodObject<{
|
|
|
3742
3576
|
cache_read_input_tokens?: number;
|
|
3743
3577
|
}>;
|
|
3744
3578
|
}, "strip", z.ZodTypeAny, {
|
|
3579
|
+
type?: "message";
|
|
3580
|
+
id?: string;
|
|
3745
3581
|
role?: "assistant";
|
|
3746
3582
|
content?: ({
|
|
3747
|
-
text?: string;
|
|
3748
3583
|
type?: "text";
|
|
3584
|
+
text?: string;
|
|
3749
3585
|
} | {
|
|
3750
3586
|
type?: "image";
|
|
3751
3587
|
source?: {
|
|
@@ -3759,9 +3595,10 @@ declare const AnthropicResponseSchema: z.ZodObject<{
|
|
|
3759
3595
|
id?: string;
|
|
3760
3596
|
input?: Record<string, unknown>;
|
|
3761
3597
|
} | {
|
|
3598
|
+
type?: "tool_result";
|
|
3762
3599
|
content?: string | ({
|
|
3763
|
-
text?: string;
|
|
3764
3600
|
type?: "text";
|
|
3601
|
+
text?: string;
|
|
3765
3602
|
} | {
|
|
3766
3603
|
type?: "image";
|
|
3767
3604
|
source?: {
|
|
@@ -3770,12 +3607,9 @@ declare const AnthropicResponseSchema: z.ZodObject<{
|
|
|
3770
3607
|
data?: string;
|
|
3771
3608
|
};
|
|
3772
3609
|
})[];
|
|
3773
|
-
type?: "tool_result";
|
|
3774
3610
|
tool_use_id?: string;
|
|
3775
3611
|
is_error?: boolean;
|
|
3776
3612
|
})[];
|
|
3777
|
-
type?: "message";
|
|
3778
|
-
id?: string;
|
|
3779
3613
|
model?: string;
|
|
3780
3614
|
usage?: {
|
|
3781
3615
|
input_tokens?: number;
|
|
@@ -3784,12 +3618,14 @@ declare const AnthropicResponseSchema: z.ZodObject<{
|
|
|
3784
3618
|
cache_read_input_tokens?: number;
|
|
3785
3619
|
};
|
|
3786
3620
|
stop_sequence?: string;
|
|
3787
|
-
stop_reason?: "
|
|
3621
|
+
stop_reason?: "max_tokens" | "tool_use" | "end_turn" | "stop_sequence";
|
|
3788
3622
|
}, {
|
|
3623
|
+
type?: "message";
|
|
3624
|
+
id?: string;
|
|
3789
3625
|
role?: "assistant";
|
|
3790
3626
|
content?: ({
|
|
3791
|
-
text?: string;
|
|
3792
3627
|
type?: "text";
|
|
3628
|
+
text?: string;
|
|
3793
3629
|
} | {
|
|
3794
3630
|
type?: "image";
|
|
3795
3631
|
source?: {
|
|
@@ -3803,9 +3639,10 @@ declare const AnthropicResponseSchema: z.ZodObject<{
|
|
|
3803
3639
|
id?: string;
|
|
3804
3640
|
input?: Record<string, unknown>;
|
|
3805
3641
|
} | {
|
|
3642
|
+
type?: "tool_result";
|
|
3806
3643
|
content?: string | ({
|
|
3807
|
-
text?: string;
|
|
3808
3644
|
type?: "text";
|
|
3645
|
+
text?: string;
|
|
3809
3646
|
} | {
|
|
3810
3647
|
type?: "image";
|
|
3811
3648
|
source?: {
|
|
@@ -3814,12 +3651,9 @@ declare const AnthropicResponseSchema: z.ZodObject<{
|
|
|
3814
3651
|
data?: string;
|
|
3815
3652
|
};
|
|
3816
3653
|
})[];
|
|
3817
|
-
type?: "tool_result";
|
|
3818
3654
|
tool_use_id?: string;
|
|
3819
3655
|
is_error?: boolean;
|
|
3820
3656
|
})[];
|
|
3821
|
-
type?: "message";
|
|
3822
|
-
id?: string;
|
|
3823
3657
|
model?: string;
|
|
3824
3658
|
usage?: {
|
|
3825
3659
|
input_tokens?: number;
|
|
@@ -3828,7 +3662,7 @@ declare const AnthropicResponseSchema: z.ZodObject<{
|
|
|
3828
3662
|
cache_read_input_tokens?: number;
|
|
3829
3663
|
};
|
|
3830
3664
|
stop_sequence?: string;
|
|
3831
|
-
stop_reason?: "
|
|
3665
|
+
stop_reason?: "max_tokens" | "tool_use" | "end_turn" | "stop_sequence";
|
|
3832
3666
|
}>;
|
|
3833
3667
|
declare const AnthropicStreamEventBaseSchema: z.ZodObject<{
|
|
3834
3668
|
type: z.ZodString;
|
|
@@ -3848,11 +3682,11 @@ declare const AnthropicMessageStartEventSchema: z.ZodObject<{} & {
|
|
|
3848
3682
|
type: z.ZodLiteral<"text">;
|
|
3849
3683
|
text: z.ZodString;
|
|
3850
3684
|
}, "strip", z.ZodTypeAny, {
|
|
3851
|
-
text?: string;
|
|
3852
3685
|
type?: "text";
|
|
3853
|
-
}, {
|
|
3854
3686
|
text?: string;
|
|
3687
|
+
}, {
|
|
3855
3688
|
type?: "text";
|
|
3689
|
+
text?: string;
|
|
3856
3690
|
}>, z.ZodObject<{} & {
|
|
3857
3691
|
type: z.ZodLiteral<"image">;
|
|
3858
3692
|
source: z.ZodObject<{
|
|
@@ -3904,11 +3738,11 @@ declare const AnthropicMessageStartEventSchema: z.ZodObject<{} & {
|
|
|
3904
3738
|
type: z.ZodLiteral<"text">;
|
|
3905
3739
|
text: z.ZodString;
|
|
3906
3740
|
}, "strip", z.ZodTypeAny, {
|
|
3907
|
-
text?: string;
|
|
3908
3741
|
type?: "text";
|
|
3909
|
-
}, {
|
|
3910
3742
|
text?: string;
|
|
3743
|
+
}, {
|
|
3911
3744
|
type?: "text";
|
|
3745
|
+
text?: string;
|
|
3912
3746
|
}>, z.ZodObject<{} & {
|
|
3913
3747
|
type: z.ZodLiteral<"image">;
|
|
3914
3748
|
source: z.ZodObject<{
|
|
@@ -3941,9 +3775,10 @@ declare const AnthropicMessageStartEventSchema: z.ZodObject<{} & {
|
|
|
3941
3775
|
}>]>, "many">]>>;
|
|
3942
3776
|
is_error: z.ZodOptional<z.ZodBoolean>;
|
|
3943
3777
|
}, "strip", z.ZodTypeAny, {
|
|
3778
|
+
type?: "tool_result";
|
|
3944
3779
|
content?: string | ({
|
|
3945
|
-
text?: string;
|
|
3946
3780
|
type?: "text";
|
|
3781
|
+
text?: string;
|
|
3947
3782
|
} | {
|
|
3948
3783
|
type?: "image";
|
|
3949
3784
|
source?: {
|
|
@@ -3952,13 +3787,13 @@ declare const AnthropicMessageStartEventSchema: z.ZodObject<{} & {
|
|
|
3952
3787
|
data?: string;
|
|
3953
3788
|
};
|
|
3954
3789
|
})[];
|
|
3955
|
-
type?: "tool_result";
|
|
3956
3790
|
tool_use_id?: string;
|
|
3957
3791
|
is_error?: boolean;
|
|
3958
3792
|
}, {
|
|
3793
|
+
type?: "tool_result";
|
|
3959
3794
|
content?: string | ({
|
|
3960
|
-
text?: string;
|
|
3961
3795
|
type?: "text";
|
|
3796
|
+
text?: string;
|
|
3962
3797
|
} | {
|
|
3963
3798
|
type?: "image";
|
|
3964
3799
|
source?: {
|
|
@@ -3967,7 +3802,6 @@ declare const AnthropicMessageStartEventSchema: z.ZodObject<{} & {
|
|
|
3967
3802
|
data?: string;
|
|
3968
3803
|
};
|
|
3969
3804
|
})[];
|
|
3970
|
-
type?: "tool_result";
|
|
3971
3805
|
tool_use_id?: string;
|
|
3972
3806
|
is_error?: boolean;
|
|
3973
3807
|
}>]>, "many">;
|
|
@@ -3994,11 +3828,11 @@ declare const AnthropicMessageStartEventSchema: z.ZodObject<{} & {
|
|
|
3994
3828
|
type: z.ZodLiteral<"text">;
|
|
3995
3829
|
text: z.ZodString;
|
|
3996
3830
|
}, "strip", z.ZodTypeAny, {
|
|
3997
|
-
text?: string;
|
|
3998
3831
|
type?: "text";
|
|
3999
|
-
}, {
|
|
4000
3832
|
text?: string;
|
|
3833
|
+
}, {
|
|
4001
3834
|
type?: "text";
|
|
3835
|
+
text?: string;
|
|
4002
3836
|
}>, z.ZodObject<{} & {
|
|
4003
3837
|
type: z.ZodLiteral<"image">;
|
|
4004
3838
|
source: z.ZodObject<{
|
|
@@ -4050,11 +3884,11 @@ declare const AnthropicMessageStartEventSchema: z.ZodObject<{} & {
|
|
|
4050
3884
|
type: z.ZodLiteral<"text">;
|
|
4051
3885
|
text: z.ZodString;
|
|
4052
3886
|
}, "strip", z.ZodTypeAny, {
|
|
4053
|
-
text?: string;
|
|
4054
3887
|
type?: "text";
|
|
4055
|
-
}, {
|
|
4056
3888
|
text?: string;
|
|
3889
|
+
}, {
|
|
4057
3890
|
type?: "text";
|
|
3891
|
+
text?: string;
|
|
4058
3892
|
}>, z.ZodObject<{} & {
|
|
4059
3893
|
type: z.ZodLiteral<"image">;
|
|
4060
3894
|
source: z.ZodObject<{
|
|
@@ -4087,9 +3921,10 @@ declare const AnthropicMessageStartEventSchema: z.ZodObject<{} & {
|
|
|
4087
3921
|
}>]>, "many">]>>;
|
|
4088
3922
|
is_error: z.ZodOptional<z.ZodBoolean>;
|
|
4089
3923
|
}, "strip", z.ZodTypeAny, {
|
|
3924
|
+
type?: "tool_result";
|
|
4090
3925
|
content?: string | ({
|
|
4091
|
-
text?: string;
|
|
4092
3926
|
type?: "text";
|
|
3927
|
+
text?: string;
|
|
4093
3928
|
} | {
|
|
4094
3929
|
type?: "image";
|
|
4095
3930
|
source?: {
|
|
@@ -4098,13 +3933,13 @@ declare const AnthropicMessageStartEventSchema: z.ZodObject<{} & {
|
|
|
4098
3933
|
data?: string;
|
|
4099
3934
|
};
|
|
4100
3935
|
})[];
|
|
4101
|
-
type?: "tool_result";
|
|
4102
3936
|
tool_use_id?: string;
|
|
4103
3937
|
is_error?: boolean;
|
|
4104
3938
|
}, {
|
|
3939
|
+
type?: "tool_result";
|
|
4105
3940
|
content?: string | ({
|
|
4106
|
-
text?: string;
|
|
4107
3941
|
type?: "text";
|
|
3942
|
+
text?: string;
|
|
4108
3943
|
} | {
|
|
4109
3944
|
type?: "image";
|
|
4110
3945
|
source?: {
|
|
@@ -4113,15 +3948,16 @@ declare const AnthropicMessageStartEventSchema: z.ZodObject<{} & {
|
|
|
4113
3948
|
data?: string;
|
|
4114
3949
|
};
|
|
4115
3950
|
})[];
|
|
4116
|
-
type?: "tool_result";
|
|
4117
3951
|
tool_use_id?: string;
|
|
4118
3952
|
is_error?: boolean;
|
|
4119
3953
|
}>]>, "many">>;
|
|
4120
3954
|
}, "strip", z.ZodTypeAny, {
|
|
3955
|
+
type?: "message";
|
|
3956
|
+
id?: string;
|
|
4121
3957
|
role?: "assistant";
|
|
4122
3958
|
content?: ({
|
|
4123
|
-
text?: string;
|
|
4124
3959
|
type?: "text";
|
|
3960
|
+
text?: string;
|
|
4125
3961
|
} | {
|
|
4126
3962
|
type?: "image";
|
|
4127
3963
|
source?: {
|
|
@@ -4135,9 +3971,10 @@ declare const AnthropicMessageStartEventSchema: z.ZodObject<{} & {
|
|
|
4135
3971
|
id?: string;
|
|
4136
3972
|
input?: Record<string, unknown>;
|
|
4137
3973
|
} | {
|
|
3974
|
+
type?: "tool_result";
|
|
4138
3975
|
content?: string | ({
|
|
4139
|
-
text?: string;
|
|
4140
3976
|
type?: "text";
|
|
3977
|
+
text?: string;
|
|
4141
3978
|
} | {
|
|
4142
3979
|
type?: "image";
|
|
4143
3980
|
source?: {
|
|
@@ -4146,12 +3983,9 @@ declare const AnthropicMessageStartEventSchema: z.ZodObject<{} & {
|
|
|
4146
3983
|
data?: string;
|
|
4147
3984
|
};
|
|
4148
3985
|
})[];
|
|
4149
|
-
type?: "tool_result";
|
|
4150
3986
|
tool_use_id?: string;
|
|
4151
3987
|
is_error?: boolean;
|
|
4152
3988
|
})[];
|
|
4153
|
-
type?: "message";
|
|
4154
|
-
id?: string;
|
|
4155
3989
|
model?: string;
|
|
4156
3990
|
usage?: {
|
|
4157
3991
|
input_tokens?: number;
|
|
@@ -4160,12 +3994,14 @@ declare const AnthropicMessageStartEventSchema: z.ZodObject<{} & {
|
|
|
4160
3994
|
cache_read_input_tokens?: number;
|
|
4161
3995
|
};
|
|
4162
3996
|
stop_sequence?: string;
|
|
4163
|
-
stop_reason?: "
|
|
3997
|
+
stop_reason?: "max_tokens" | "tool_use" | "end_turn" | "stop_sequence";
|
|
4164
3998
|
}, {
|
|
3999
|
+
type?: "message";
|
|
4000
|
+
id?: string;
|
|
4165
4001
|
role?: "assistant";
|
|
4166
4002
|
content?: ({
|
|
4167
|
-
text?: string;
|
|
4168
4003
|
type?: "text";
|
|
4004
|
+
text?: string;
|
|
4169
4005
|
} | {
|
|
4170
4006
|
type?: "image";
|
|
4171
4007
|
source?: {
|
|
@@ -4179,9 +4015,10 @@ declare const AnthropicMessageStartEventSchema: z.ZodObject<{} & {
|
|
|
4179
4015
|
id?: string;
|
|
4180
4016
|
input?: Record<string, unknown>;
|
|
4181
4017
|
} | {
|
|
4018
|
+
type?: "tool_result";
|
|
4182
4019
|
content?: string | ({
|
|
4183
|
-
text?: string;
|
|
4184
4020
|
type?: "text";
|
|
4021
|
+
text?: string;
|
|
4185
4022
|
} | {
|
|
4186
4023
|
type?: "image";
|
|
4187
4024
|
source?: {
|
|
@@ -4190,12 +4027,9 @@ declare const AnthropicMessageStartEventSchema: z.ZodObject<{} & {
|
|
|
4190
4027
|
data?: string;
|
|
4191
4028
|
};
|
|
4192
4029
|
})[];
|
|
4193
|
-
type?: "tool_result";
|
|
4194
4030
|
tool_use_id?: string;
|
|
4195
4031
|
is_error?: boolean;
|
|
4196
4032
|
})[];
|
|
4197
|
-
type?: "message";
|
|
4198
|
-
id?: string;
|
|
4199
4033
|
model?: string;
|
|
4200
4034
|
usage?: {
|
|
4201
4035
|
input_tokens?: number;
|
|
@@ -4204,14 +4038,17 @@ declare const AnthropicMessageStartEventSchema: z.ZodObject<{} & {
|
|
|
4204
4038
|
cache_read_input_tokens?: number;
|
|
4205
4039
|
};
|
|
4206
4040
|
stop_sequence?: string;
|
|
4207
|
-
stop_reason?: "
|
|
4041
|
+
stop_reason?: "max_tokens" | "tool_use" | "end_turn" | "stop_sequence";
|
|
4208
4042
|
}>;
|
|
4209
4043
|
}, "strip", z.ZodTypeAny, {
|
|
4044
|
+
type?: "message_start";
|
|
4210
4045
|
message?: {
|
|
4046
|
+
type?: "message";
|
|
4047
|
+
id?: string;
|
|
4211
4048
|
role?: "assistant";
|
|
4212
4049
|
content?: ({
|
|
4213
|
-
text?: string;
|
|
4214
4050
|
type?: "text";
|
|
4051
|
+
text?: string;
|
|
4215
4052
|
} | {
|
|
4216
4053
|
type?: "image";
|
|
4217
4054
|
source?: {
|
|
@@ -4225,9 +4062,10 @@ declare const AnthropicMessageStartEventSchema: z.ZodObject<{} & {
|
|
|
4225
4062
|
id?: string;
|
|
4226
4063
|
input?: Record<string, unknown>;
|
|
4227
4064
|
} | {
|
|
4065
|
+
type?: "tool_result";
|
|
4228
4066
|
content?: string | ({
|
|
4229
|
-
text?: string;
|
|
4230
4067
|
type?: "text";
|
|
4068
|
+
text?: string;
|
|
4231
4069
|
} | {
|
|
4232
4070
|
type?: "image";
|
|
4233
4071
|
source?: {
|
|
@@ -4236,12 +4074,9 @@ declare const AnthropicMessageStartEventSchema: z.ZodObject<{} & {
|
|
|
4236
4074
|
data?: string;
|
|
4237
4075
|
};
|
|
4238
4076
|
})[];
|
|
4239
|
-
type?: "tool_result";
|
|
4240
4077
|
tool_use_id?: string;
|
|
4241
4078
|
is_error?: boolean;
|
|
4242
4079
|
})[];
|
|
4243
|
-
type?: "message";
|
|
4244
|
-
id?: string;
|
|
4245
4080
|
model?: string;
|
|
4246
4081
|
usage?: {
|
|
4247
4082
|
input_tokens?: number;
|
|
@@ -4250,15 +4085,17 @@ declare const AnthropicMessageStartEventSchema: z.ZodObject<{} & {
|
|
|
4250
4085
|
cache_read_input_tokens?: number;
|
|
4251
4086
|
};
|
|
4252
4087
|
stop_sequence?: string;
|
|
4253
|
-
stop_reason?: "
|
|
4088
|
+
stop_reason?: "max_tokens" | "tool_use" | "end_turn" | "stop_sequence";
|
|
4254
4089
|
};
|
|
4255
|
-
type?: "message_start";
|
|
4256
4090
|
}, {
|
|
4091
|
+
type?: "message_start";
|
|
4257
4092
|
message?: {
|
|
4093
|
+
type?: "message";
|
|
4094
|
+
id?: string;
|
|
4258
4095
|
role?: "assistant";
|
|
4259
4096
|
content?: ({
|
|
4260
|
-
text?: string;
|
|
4261
4097
|
type?: "text";
|
|
4098
|
+
text?: string;
|
|
4262
4099
|
} | {
|
|
4263
4100
|
type?: "image";
|
|
4264
4101
|
source?: {
|
|
@@ -4272,9 +4109,10 @@ declare const AnthropicMessageStartEventSchema: z.ZodObject<{} & {
|
|
|
4272
4109
|
id?: string;
|
|
4273
4110
|
input?: Record<string, unknown>;
|
|
4274
4111
|
} | {
|
|
4112
|
+
type?: "tool_result";
|
|
4275
4113
|
content?: string | ({
|
|
4276
|
-
text?: string;
|
|
4277
4114
|
type?: "text";
|
|
4115
|
+
text?: string;
|
|
4278
4116
|
} | {
|
|
4279
4117
|
type?: "image";
|
|
4280
4118
|
source?: {
|
|
@@ -4283,12 +4121,9 @@ declare const AnthropicMessageStartEventSchema: z.ZodObject<{} & {
|
|
|
4283
4121
|
data?: string;
|
|
4284
4122
|
};
|
|
4285
4123
|
})[];
|
|
4286
|
-
type?: "tool_result";
|
|
4287
4124
|
tool_use_id?: string;
|
|
4288
4125
|
is_error?: boolean;
|
|
4289
4126
|
})[];
|
|
4290
|
-
type?: "message";
|
|
4291
|
-
id?: string;
|
|
4292
4127
|
model?: string;
|
|
4293
4128
|
usage?: {
|
|
4294
4129
|
input_tokens?: number;
|
|
@@ -4297,9 +4132,8 @@ declare const AnthropicMessageStartEventSchema: z.ZodObject<{} & {
|
|
|
4297
4132
|
cache_read_input_tokens?: number;
|
|
4298
4133
|
};
|
|
4299
4134
|
stop_sequence?: string;
|
|
4300
|
-
stop_reason?: "
|
|
4135
|
+
stop_reason?: "max_tokens" | "tool_use" | "end_turn" | "stop_sequence";
|
|
4301
4136
|
};
|
|
4302
|
-
type?: "message_start";
|
|
4303
4137
|
}>;
|
|
4304
4138
|
declare const AnthropicContentBlockStartEventSchema: z.ZodObject<{} & {
|
|
4305
4139
|
type: z.ZodLiteral<"content_block_start">;
|
|
@@ -4308,11 +4142,11 @@ declare const AnthropicContentBlockStartEventSchema: z.ZodObject<{} & {
|
|
|
4308
4142
|
type: z.ZodLiteral<"text">;
|
|
4309
4143
|
text: z.ZodString;
|
|
4310
4144
|
}, "strip", z.ZodTypeAny, {
|
|
4311
|
-
text?: string;
|
|
4312
4145
|
type?: "text";
|
|
4313
|
-
}, {
|
|
4314
4146
|
text?: string;
|
|
4147
|
+
}, {
|
|
4315
4148
|
type?: "text";
|
|
4149
|
+
text?: string;
|
|
4316
4150
|
}>, z.ZodObject<{} & {
|
|
4317
4151
|
type: z.ZodLiteral<"image">;
|
|
4318
4152
|
source: z.ZodObject<{
|
|
@@ -4364,11 +4198,11 @@ declare const AnthropicContentBlockStartEventSchema: z.ZodObject<{} & {
|
|
|
4364
4198
|
type: z.ZodLiteral<"text">;
|
|
4365
4199
|
text: z.ZodString;
|
|
4366
4200
|
}, "strip", z.ZodTypeAny, {
|
|
4367
|
-
text?: string;
|
|
4368
4201
|
type?: "text";
|
|
4369
|
-
}, {
|
|
4370
4202
|
text?: string;
|
|
4203
|
+
}, {
|
|
4371
4204
|
type?: "text";
|
|
4205
|
+
text?: string;
|
|
4372
4206
|
}>, z.ZodObject<{} & {
|
|
4373
4207
|
type: z.ZodLiteral<"image">;
|
|
4374
4208
|
source: z.ZodObject<{
|
|
@@ -4401,9 +4235,10 @@ declare const AnthropicContentBlockStartEventSchema: z.ZodObject<{} & {
|
|
|
4401
4235
|
}>]>, "many">]>>;
|
|
4402
4236
|
is_error: z.ZodOptional<z.ZodBoolean>;
|
|
4403
4237
|
}, "strip", z.ZodTypeAny, {
|
|
4238
|
+
type?: "tool_result";
|
|
4404
4239
|
content?: string | ({
|
|
4405
|
-
text?: string;
|
|
4406
4240
|
type?: "text";
|
|
4241
|
+
text?: string;
|
|
4407
4242
|
} | {
|
|
4408
4243
|
type?: "image";
|
|
4409
4244
|
source?: {
|
|
@@ -4412,13 +4247,13 @@ declare const AnthropicContentBlockStartEventSchema: z.ZodObject<{} & {
|
|
|
4412
4247
|
data?: string;
|
|
4413
4248
|
};
|
|
4414
4249
|
})[];
|
|
4415
|
-
type?: "tool_result";
|
|
4416
4250
|
tool_use_id?: string;
|
|
4417
4251
|
is_error?: boolean;
|
|
4418
4252
|
}, {
|
|
4253
|
+
type?: "tool_result";
|
|
4419
4254
|
content?: string | ({
|
|
4420
|
-
text?: string;
|
|
4421
4255
|
type?: "text";
|
|
4256
|
+
text?: string;
|
|
4422
4257
|
} | {
|
|
4423
4258
|
type?: "image";
|
|
4424
4259
|
source?: {
|
|
@@ -4427,7 +4262,6 @@ declare const AnthropicContentBlockStartEventSchema: z.ZodObject<{} & {
|
|
|
4427
4262
|
data?: string;
|
|
4428
4263
|
};
|
|
4429
4264
|
})[];
|
|
4430
|
-
type?: "tool_result";
|
|
4431
4265
|
tool_use_id?: string;
|
|
4432
4266
|
is_error?: boolean;
|
|
4433
4267
|
}>]>;
|
|
@@ -4435,8 +4269,8 @@ declare const AnthropicContentBlockStartEventSchema: z.ZodObject<{} & {
|
|
|
4435
4269
|
type?: "content_block_start";
|
|
4436
4270
|
index?: number;
|
|
4437
4271
|
content_block?: {
|
|
4438
|
-
text?: string;
|
|
4439
4272
|
type?: "text";
|
|
4273
|
+
text?: string;
|
|
4440
4274
|
} | {
|
|
4441
4275
|
type?: "image";
|
|
4442
4276
|
source?: {
|
|
@@ -4450,9 +4284,10 @@ declare const AnthropicContentBlockStartEventSchema: z.ZodObject<{} & {
|
|
|
4450
4284
|
id?: string;
|
|
4451
4285
|
input?: Record<string, unknown>;
|
|
4452
4286
|
} | {
|
|
4287
|
+
type?: "tool_result";
|
|
4453
4288
|
content?: string | ({
|
|
4454
|
-
text?: string;
|
|
4455
4289
|
type?: "text";
|
|
4290
|
+
text?: string;
|
|
4456
4291
|
} | {
|
|
4457
4292
|
type?: "image";
|
|
4458
4293
|
source?: {
|
|
@@ -4461,7 +4296,6 @@ declare const AnthropicContentBlockStartEventSchema: z.ZodObject<{} & {
|
|
|
4461
4296
|
data?: string;
|
|
4462
4297
|
};
|
|
4463
4298
|
})[];
|
|
4464
|
-
type?: "tool_result";
|
|
4465
4299
|
tool_use_id?: string;
|
|
4466
4300
|
is_error?: boolean;
|
|
4467
4301
|
};
|
|
@@ -4469,8 +4303,8 @@ declare const AnthropicContentBlockStartEventSchema: z.ZodObject<{} & {
|
|
|
4469
4303
|
type?: "content_block_start";
|
|
4470
4304
|
index?: number;
|
|
4471
4305
|
content_block?: {
|
|
4472
|
-
text?: string;
|
|
4473
4306
|
type?: "text";
|
|
4307
|
+
text?: string;
|
|
4474
4308
|
} | {
|
|
4475
4309
|
type?: "image";
|
|
4476
4310
|
source?: {
|
|
@@ -4484,9 +4318,10 @@ declare const AnthropicContentBlockStartEventSchema: z.ZodObject<{} & {
|
|
|
4484
4318
|
id?: string;
|
|
4485
4319
|
input?: Record<string, unknown>;
|
|
4486
4320
|
} | {
|
|
4321
|
+
type?: "tool_result";
|
|
4487
4322
|
content?: string | ({
|
|
4488
|
-
text?: string;
|
|
4489
4323
|
type?: "text";
|
|
4324
|
+
text?: string;
|
|
4490
4325
|
} | {
|
|
4491
4326
|
type?: "image";
|
|
4492
4327
|
source?: {
|
|
@@ -4495,7 +4330,6 @@ declare const AnthropicContentBlockStartEventSchema: z.ZodObject<{} & {
|
|
|
4495
4330
|
data?: string;
|
|
4496
4331
|
};
|
|
4497
4332
|
})[];
|
|
4498
|
-
type?: "tool_result";
|
|
4499
4333
|
tool_use_id?: string;
|
|
4500
4334
|
is_error?: boolean;
|
|
4501
4335
|
};
|
|
@@ -4507,11 +4341,11 @@ declare const AnthropicContentBlockDeltaEventSchema: z.ZodObject<{} & {
|
|
|
4507
4341
|
type: z.ZodLiteral<"text_delta">;
|
|
4508
4342
|
text: z.ZodString;
|
|
4509
4343
|
}, "strip", z.ZodTypeAny, {
|
|
4510
|
-
text?: string;
|
|
4511
4344
|
type?: "text_delta";
|
|
4512
|
-
}, {
|
|
4513
4345
|
text?: string;
|
|
4346
|
+
}, {
|
|
4514
4347
|
type?: "text_delta";
|
|
4348
|
+
text?: string;
|
|
4515
4349
|
}>, z.ZodObject<{
|
|
4516
4350
|
type: z.ZodLiteral<"input_json_delta">;
|
|
4517
4351
|
partial_json: z.ZodString;
|
|
@@ -4526,8 +4360,8 @@ declare const AnthropicContentBlockDeltaEventSchema: z.ZodObject<{} & {
|
|
|
4526
4360
|
type?: "content_block_delta";
|
|
4527
4361
|
index?: number;
|
|
4528
4362
|
delta?: {
|
|
4529
|
-
text?: string;
|
|
4530
4363
|
type?: "text_delta";
|
|
4364
|
+
text?: string;
|
|
4531
4365
|
} | {
|
|
4532
4366
|
type?: "input_json_delta";
|
|
4533
4367
|
partial_json?: string;
|
|
@@ -4536,8 +4370,8 @@ declare const AnthropicContentBlockDeltaEventSchema: z.ZodObject<{} & {
|
|
|
4536
4370
|
type?: "content_block_delta";
|
|
4537
4371
|
index?: number;
|
|
4538
4372
|
delta?: {
|
|
4539
|
-
text?: string;
|
|
4540
4373
|
type?: "text_delta";
|
|
4374
|
+
text?: string;
|
|
4541
4375
|
} | {
|
|
4542
4376
|
type?: "input_json_delta";
|
|
4543
4377
|
partial_json?: string;
|
|
@@ -4560,10 +4394,10 @@ declare const AnthropicMessageDeltaEventSchema: z.ZodObject<{} & {
|
|
|
4560
4394
|
stop_sequence: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
4561
4395
|
}, "strip", z.ZodTypeAny, {
|
|
4562
4396
|
stop_sequence?: string;
|
|
4563
|
-
stop_reason?: "
|
|
4397
|
+
stop_reason?: "max_tokens" | "tool_use" | "end_turn" | "stop_sequence";
|
|
4564
4398
|
}, {
|
|
4565
4399
|
stop_sequence?: string;
|
|
4566
|
-
stop_reason?: "
|
|
4400
|
+
stop_reason?: "max_tokens" | "tool_use" | "end_turn" | "stop_sequence";
|
|
4567
4401
|
}>;
|
|
4568
4402
|
usage: z.ZodObject<{
|
|
4569
4403
|
input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
@@ -4585,7 +4419,7 @@ declare const AnthropicMessageDeltaEventSchema: z.ZodObject<{} & {
|
|
|
4585
4419
|
type?: "message_delta";
|
|
4586
4420
|
delta?: {
|
|
4587
4421
|
stop_sequence?: string;
|
|
4588
|
-
stop_reason?: "
|
|
4422
|
+
stop_reason?: "max_tokens" | "tool_use" | "end_turn" | "stop_sequence";
|
|
4589
4423
|
};
|
|
4590
4424
|
usage?: {
|
|
4591
4425
|
input_tokens?: number;
|
|
@@ -4597,7 +4431,7 @@ declare const AnthropicMessageDeltaEventSchema: z.ZodObject<{} & {
|
|
|
4597
4431
|
type?: "message_delta";
|
|
4598
4432
|
delta?: {
|
|
4599
4433
|
stop_sequence?: string;
|
|
4600
|
-
stop_reason?: "
|
|
4434
|
+
stop_reason?: "max_tokens" | "tool_use" | "end_turn" | "stop_sequence";
|
|
4601
4435
|
};
|
|
4602
4436
|
usage?: {
|
|
4603
4437
|
input_tokens?: number;
|
|
@@ -4626,23 +4460,23 @@ declare const AnthropicErrorEventSchema: z.ZodObject<{} & {
|
|
|
4626
4460
|
type: z.ZodString;
|
|
4627
4461
|
message: z.ZodString;
|
|
4628
4462
|
}, "strip", z.ZodTypeAny, {
|
|
4629
|
-
message?: string;
|
|
4630
4463
|
type?: string;
|
|
4631
|
-
}, {
|
|
4632
4464
|
message?: string;
|
|
4465
|
+
}, {
|
|
4633
4466
|
type?: string;
|
|
4467
|
+
message?: string;
|
|
4634
4468
|
}>;
|
|
4635
4469
|
}, "strip", z.ZodTypeAny, {
|
|
4636
4470
|
type?: "error";
|
|
4637
4471
|
error?: {
|
|
4638
|
-
message?: string;
|
|
4639
4472
|
type?: string;
|
|
4473
|
+
message?: string;
|
|
4640
4474
|
};
|
|
4641
4475
|
}, {
|
|
4642
4476
|
type?: "error";
|
|
4643
4477
|
error?: {
|
|
4644
|
-
message?: string;
|
|
4645
4478
|
type?: string;
|
|
4479
|
+
message?: string;
|
|
4646
4480
|
};
|
|
4647
4481
|
}>;
|
|
4648
4482
|
declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
|
|
@@ -4656,11 +4490,11 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
|
|
|
4656
4490
|
type: z.ZodLiteral<"text">;
|
|
4657
4491
|
text: z.ZodString;
|
|
4658
4492
|
}, "strip", z.ZodTypeAny, {
|
|
4659
|
-
text?: string;
|
|
4660
4493
|
type?: "text";
|
|
4661
|
-
}, {
|
|
4662
4494
|
text?: string;
|
|
4495
|
+
}, {
|
|
4663
4496
|
type?: "text";
|
|
4497
|
+
text?: string;
|
|
4664
4498
|
}>, z.ZodObject<{} & {
|
|
4665
4499
|
type: z.ZodLiteral<"image">;
|
|
4666
4500
|
source: z.ZodObject<{
|
|
@@ -4712,11 +4546,11 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
|
|
|
4712
4546
|
type: z.ZodLiteral<"text">;
|
|
4713
4547
|
text: z.ZodString;
|
|
4714
4548
|
}, "strip", z.ZodTypeAny, {
|
|
4715
|
-
text?: string;
|
|
4716
4549
|
type?: "text";
|
|
4717
|
-
}, {
|
|
4718
4550
|
text?: string;
|
|
4551
|
+
}, {
|
|
4719
4552
|
type?: "text";
|
|
4553
|
+
text?: string;
|
|
4720
4554
|
}>, z.ZodObject<{} & {
|
|
4721
4555
|
type: z.ZodLiteral<"image">;
|
|
4722
4556
|
source: z.ZodObject<{
|
|
@@ -4749,9 +4583,10 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
|
|
|
4749
4583
|
}>]>, "many">]>>;
|
|
4750
4584
|
is_error: z.ZodOptional<z.ZodBoolean>;
|
|
4751
4585
|
}, "strip", z.ZodTypeAny, {
|
|
4586
|
+
type?: "tool_result";
|
|
4752
4587
|
content?: string | ({
|
|
4753
|
-
text?: string;
|
|
4754
4588
|
type?: "text";
|
|
4589
|
+
text?: string;
|
|
4755
4590
|
} | {
|
|
4756
4591
|
type?: "image";
|
|
4757
4592
|
source?: {
|
|
@@ -4760,13 +4595,13 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
|
|
|
4760
4595
|
data?: string;
|
|
4761
4596
|
};
|
|
4762
4597
|
})[];
|
|
4763
|
-
type?: "tool_result";
|
|
4764
4598
|
tool_use_id?: string;
|
|
4765
4599
|
is_error?: boolean;
|
|
4766
4600
|
}, {
|
|
4601
|
+
type?: "tool_result";
|
|
4767
4602
|
content?: string | ({
|
|
4768
|
-
text?: string;
|
|
4769
4603
|
type?: "text";
|
|
4604
|
+
text?: string;
|
|
4770
4605
|
} | {
|
|
4771
4606
|
type?: "image";
|
|
4772
4607
|
source?: {
|
|
@@ -4775,7 +4610,6 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
|
|
|
4775
4610
|
data?: string;
|
|
4776
4611
|
};
|
|
4777
4612
|
})[];
|
|
4778
|
-
type?: "tool_result";
|
|
4779
4613
|
tool_use_id?: string;
|
|
4780
4614
|
is_error?: boolean;
|
|
4781
4615
|
}>]>, "many">;
|
|
@@ -4802,11 +4636,11 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
|
|
|
4802
4636
|
type: z.ZodLiteral<"text">;
|
|
4803
4637
|
text: z.ZodString;
|
|
4804
4638
|
}, "strip", z.ZodTypeAny, {
|
|
4805
|
-
text?: string;
|
|
4806
4639
|
type?: "text";
|
|
4807
|
-
}, {
|
|
4808
4640
|
text?: string;
|
|
4641
|
+
}, {
|
|
4809
4642
|
type?: "text";
|
|
4643
|
+
text?: string;
|
|
4810
4644
|
}>, z.ZodObject<{} & {
|
|
4811
4645
|
type: z.ZodLiteral<"image">;
|
|
4812
4646
|
source: z.ZodObject<{
|
|
@@ -4858,11 +4692,11 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
|
|
|
4858
4692
|
type: z.ZodLiteral<"text">;
|
|
4859
4693
|
text: z.ZodString;
|
|
4860
4694
|
}, "strip", z.ZodTypeAny, {
|
|
4861
|
-
text?: string;
|
|
4862
4695
|
type?: "text";
|
|
4863
|
-
}, {
|
|
4864
4696
|
text?: string;
|
|
4697
|
+
}, {
|
|
4865
4698
|
type?: "text";
|
|
4699
|
+
text?: string;
|
|
4866
4700
|
}>, z.ZodObject<{} & {
|
|
4867
4701
|
type: z.ZodLiteral<"image">;
|
|
4868
4702
|
source: z.ZodObject<{
|
|
@@ -4895,9 +4729,10 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
|
|
|
4895
4729
|
}>]>, "many">]>>;
|
|
4896
4730
|
is_error: z.ZodOptional<z.ZodBoolean>;
|
|
4897
4731
|
}, "strip", z.ZodTypeAny, {
|
|
4732
|
+
type?: "tool_result";
|
|
4898
4733
|
content?: string | ({
|
|
4899
|
-
text?: string;
|
|
4900
4734
|
type?: "text";
|
|
4735
|
+
text?: string;
|
|
4901
4736
|
} | {
|
|
4902
4737
|
type?: "image";
|
|
4903
4738
|
source?: {
|
|
@@ -4906,13 +4741,13 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
|
|
|
4906
4741
|
data?: string;
|
|
4907
4742
|
};
|
|
4908
4743
|
})[];
|
|
4909
|
-
type?: "tool_result";
|
|
4910
4744
|
tool_use_id?: string;
|
|
4911
4745
|
is_error?: boolean;
|
|
4912
4746
|
}, {
|
|
4747
|
+
type?: "tool_result";
|
|
4913
4748
|
content?: string | ({
|
|
4914
|
-
text?: string;
|
|
4915
4749
|
type?: "text";
|
|
4750
|
+
text?: string;
|
|
4916
4751
|
} | {
|
|
4917
4752
|
type?: "image";
|
|
4918
4753
|
source?: {
|
|
@@ -4921,15 +4756,16 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
|
|
|
4921
4756
|
data?: string;
|
|
4922
4757
|
};
|
|
4923
4758
|
})[];
|
|
4924
|
-
type?: "tool_result";
|
|
4925
4759
|
tool_use_id?: string;
|
|
4926
4760
|
is_error?: boolean;
|
|
4927
4761
|
}>]>, "many">>;
|
|
4928
4762
|
}, "strip", z.ZodTypeAny, {
|
|
4763
|
+
type?: "message";
|
|
4764
|
+
id?: string;
|
|
4929
4765
|
role?: "assistant";
|
|
4930
4766
|
content?: ({
|
|
4931
|
-
text?: string;
|
|
4932
4767
|
type?: "text";
|
|
4768
|
+
text?: string;
|
|
4933
4769
|
} | {
|
|
4934
4770
|
type?: "image";
|
|
4935
4771
|
source?: {
|
|
@@ -4943,9 +4779,10 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
|
|
|
4943
4779
|
id?: string;
|
|
4944
4780
|
input?: Record<string, unknown>;
|
|
4945
4781
|
} | {
|
|
4782
|
+
type?: "tool_result";
|
|
4946
4783
|
content?: string | ({
|
|
4947
|
-
text?: string;
|
|
4948
4784
|
type?: "text";
|
|
4785
|
+
text?: string;
|
|
4949
4786
|
} | {
|
|
4950
4787
|
type?: "image";
|
|
4951
4788
|
source?: {
|
|
@@ -4954,12 +4791,9 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
|
|
|
4954
4791
|
data?: string;
|
|
4955
4792
|
};
|
|
4956
4793
|
})[];
|
|
4957
|
-
type?: "tool_result";
|
|
4958
4794
|
tool_use_id?: string;
|
|
4959
4795
|
is_error?: boolean;
|
|
4960
4796
|
})[];
|
|
4961
|
-
type?: "message";
|
|
4962
|
-
id?: string;
|
|
4963
4797
|
model?: string;
|
|
4964
4798
|
usage?: {
|
|
4965
4799
|
input_tokens?: number;
|
|
@@ -4968,12 +4802,14 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
|
|
|
4968
4802
|
cache_read_input_tokens?: number;
|
|
4969
4803
|
};
|
|
4970
4804
|
stop_sequence?: string;
|
|
4971
|
-
stop_reason?: "
|
|
4805
|
+
stop_reason?: "max_tokens" | "tool_use" | "end_turn" | "stop_sequence";
|
|
4972
4806
|
}, {
|
|
4807
|
+
type?: "message";
|
|
4808
|
+
id?: string;
|
|
4973
4809
|
role?: "assistant";
|
|
4974
4810
|
content?: ({
|
|
4975
|
-
text?: string;
|
|
4976
4811
|
type?: "text";
|
|
4812
|
+
text?: string;
|
|
4977
4813
|
} | {
|
|
4978
4814
|
type?: "image";
|
|
4979
4815
|
source?: {
|
|
@@ -4987,9 +4823,10 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
|
|
|
4987
4823
|
id?: string;
|
|
4988
4824
|
input?: Record<string, unknown>;
|
|
4989
4825
|
} | {
|
|
4826
|
+
type?: "tool_result";
|
|
4990
4827
|
content?: string | ({
|
|
4991
|
-
text?: string;
|
|
4992
4828
|
type?: "text";
|
|
4829
|
+
text?: string;
|
|
4993
4830
|
} | {
|
|
4994
4831
|
type?: "image";
|
|
4995
4832
|
source?: {
|
|
@@ -4998,12 +4835,9 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
|
|
|
4998
4835
|
data?: string;
|
|
4999
4836
|
};
|
|
5000
4837
|
})[];
|
|
5001
|
-
type?: "tool_result";
|
|
5002
4838
|
tool_use_id?: string;
|
|
5003
4839
|
is_error?: boolean;
|
|
5004
4840
|
})[];
|
|
5005
|
-
type?: "message";
|
|
5006
|
-
id?: string;
|
|
5007
4841
|
model?: string;
|
|
5008
4842
|
usage?: {
|
|
5009
4843
|
input_tokens?: number;
|
|
@@ -5012,14 +4846,17 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
|
|
|
5012
4846
|
cache_read_input_tokens?: number;
|
|
5013
4847
|
};
|
|
5014
4848
|
stop_sequence?: string;
|
|
5015
|
-
stop_reason?: "
|
|
4849
|
+
stop_reason?: "max_tokens" | "tool_use" | "end_turn" | "stop_sequence";
|
|
5016
4850
|
}>;
|
|
5017
4851
|
}, "strip", z.ZodTypeAny, {
|
|
4852
|
+
type?: "message_start";
|
|
5018
4853
|
message?: {
|
|
4854
|
+
type?: "message";
|
|
4855
|
+
id?: string;
|
|
5019
4856
|
role?: "assistant";
|
|
5020
4857
|
content?: ({
|
|
5021
|
-
text?: string;
|
|
5022
4858
|
type?: "text";
|
|
4859
|
+
text?: string;
|
|
5023
4860
|
} | {
|
|
5024
4861
|
type?: "image";
|
|
5025
4862
|
source?: {
|
|
@@ -5033,9 +4870,10 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
|
|
|
5033
4870
|
id?: string;
|
|
5034
4871
|
input?: Record<string, unknown>;
|
|
5035
4872
|
} | {
|
|
4873
|
+
type?: "tool_result";
|
|
5036
4874
|
content?: string | ({
|
|
5037
|
-
text?: string;
|
|
5038
4875
|
type?: "text";
|
|
4876
|
+
text?: string;
|
|
5039
4877
|
} | {
|
|
5040
4878
|
type?: "image";
|
|
5041
4879
|
source?: {
|
|
@@ -5044,12 +4882,9 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
|
|
|
5044
4882
|
data?: string;
|
|
5045
4883
|
};
|
|
5046
4884
|
})[];
|
|
5047
|
-
type?: "tool_result";
|
|
5048
4885
|
tool_use_id?: string;
|
|
5049
4886
|
is_error?: boolean;
|
|
5050
4887
|
})[];
|
|
5051
|
-
type?: "message";
|
|
5052
|
-
id?: string;
|
|
5053
4888
|
model?: string;
|
|
5054
4889
|
usage?: {
|
|
5055
4890
|
input_tokens?: number;
|
|
@@ -5058,15 +4893,17 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
|
|
|
5058
4893
|
cache_read_input_tokens?: number;
|
|
5059
4894
|
};
|
|
5060
4895
|
stop_sequence?: string;
|
|
5061
|
-
stop_reason?: "
|
|
4896
|
+
stop_reason?: "max_tokens" | "tool_use" | "end_turn" | "stop_sequence";
|
|
5062
4897
|
};
|
|
5063
|
-
type?: "message_start";
|
|
5064
4898
|
}, {
|
|
4899
|
+
type?: "message_start";
|
|
5065
4900
|
message?: {
|
|
4901
|
+
type?: "message";
|
|
4902
|
+
id?: string;
|
|
5066
4903
|
role?: "assistant";
|
|
5067
4904
|
content?: ({
|
|
5068
|
-
text?: string;
|
|
5069
4905
|
type?: "text";
|
|
4906
|
+
text?: string;
|
|
5070
4907
|
} | {
|
|
5071
4908
|
type?: "image";
|
|
5072
4909
|
source?: {
|
|
@@ -5080,9 +4917,10 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
|
|
|
5080
4917
|
id?: string;
|
|
5081
4918
|
input?: Record<string, unknown>;
|
|
5082
4919
|
} | {
|
|
4920
|
+
type?: "tool_result";
|
|
5083
4921
|
content?: string | ({
|
|
5084
|
-
text?: string;
|
|
5085
4922
|
type?: "text";
|
|
4923
|
+
text?: string;
|
|
5086
4924
|
} | {
|
|
5087
4925
|
type?: "image";
|
|
5088
4926
|
source?: {
|
|
@@ -5091,12 +4929,9 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
|
|
|
5091
4929
|
data?: string;
|
|
5092
4930
|
};
|
|
5093
4931
|
})[];
|
|
5094
|
-
type?: "tool_result";
|
|
5095
4932
|
tool_use_id?: string;
|
|
5096
4933
|
is_error?: boolean;
|
|
5097
4934
|
})[];
|
|
5098
|
-
type?: "message";
|
|
5099
|
-
id?: string;
|
|
5100
4935
|
model?: string;
|
|
5101
4936
|
usage?: {
|
|
5102
4937
|
input_tokens?: number;
|
|
@@ -5105,9 +4940,8 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
|
|
|
5105
4940
|
cache_read_input_tokens?: number;
|
|
5106
4941
|
};
|
|
5107
4942
|
stop_sequence?: string;
|
|
5108
|
-
stop_reason?: "
|
|
4943
|
+
stop_reason?: "max_tokens" | "tool_use" | "end_turn" | "stop_sequence";
|
|
5109
4944
|
};
|
|
5110
|
-
type?: "message_start";
|
|
5111
4945
|
}>, z.ZodObject<{} & {
|
|
5112
4946
|
type: z.ZodLiteral<"content_block_start">;
|
|
5113
4947
|
index: z.ZodNumber;
|
|
@@ -5115,11 +4949,11 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
|
|
|
5115
4949
|
type: z.ZodLiteral<"text">;
|
|
5116
4950
|
text: z.ZodString;
|
|
5117
4951
|
}, "strip", z.ZodTypeAny, {
|
|
5118
|
-
text?: string;
|
|
5119
4952
|
type?: "text";
|
|
5120
|
-
}, {
|
|
5121
4953
|
text?: string;
|
|
4954
|
+
}, {
|
|
5122
4955
|
type?: "text";
|
|
4956
|
+
text?: string;
|
|
5123
4957
|
}>, z.ZodObject<{} & {
|
|
5124
4958
|
type: z.ZodLiteral<"image">;
|
|
5125
4959
|
source: z.ZodObject<{
|
|
@@ -5171,11 +5005,11 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
|
|
|
5171
5005
|
type: z.ZodLiteral<"text">;
|
|
5172
5006
|
text: z.ZodString;
|
|
5173
5007
|
}, "strip", z.ZodTypeAny, {
|
|
5174
|
-
text?: string;
|
|
5175
5008
|
type?: "text";
|
|
5176
|
-
}, {
|
|
5177
5009
|
text?: string;
|
|
5010
|
+
}, {
|
|
5178
5011
|
type?: "text";
|
|
5012
|
+
text?: string;
|
|
5179
5013
|
}>, z.ZodObject<{} & {
|
|
5180
5014
|
type: z.ZodLiteral<"image">;
|
|
5181
5015
|
source: z.ZodObject<{
|
|
@@ -5208,9 +5042,10 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
|
|
|
5208
5042
|
}>]>, "many">]>>;
|
|
5209
5043
|
is_error: z.ZodOptional<z.ZodBoolean>;
|
|
5210
5044
|
}, "strip", z.ZodTypeAny, {
|
|
5045
|
+
type?: "tool_result";
|
|
5211
5046
|
content?: string | ({
|
|
5212
|
-
text?: string;
|
|
5213
5047
|
type?: "text";
|
|
5048
|
+
text?: string;
|
|
5214
5049
|
} | {
|
|
5215
5050
|
type?: "image";
|
|
5216
5051
|
source?: {
|
|
@@ -5219,13 +5054,13 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
|
|
|
5219
5054
|
data?: string;
|
|
5220
5055
|
};
|
|
5221
5056
|
})[];
|
|
5222
|
-
type?: "tool_result";
|
|
5223
5057
|
tool_use_id?: string;
|
|
5224
5058
|
is_error?: boolean;
|
|
5225
5059
|
}, {
|
|
5060
|
+
type?: "tool_result";
|
|
5226
5061
|
content?: string | ({
|
|
5227
|
-
text?: string;
|
|
5228
5062
|
type?: "text";
|
|
5063
|
+
text?: string;
|
|
5229
5064
|
} | {
|
|
5230
5065
|
type?: "image";
|
|
5231
5066
|
source?: {
|
|
@@ -5234,7 +5069,6 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
|
|
|
5234
5069
|
data?: string;
|
|
5235
5070
|
};
|
|
5236
5071
|
})[];
|
|
5237
|
-
type?: "tool_result";
|
|
5238
5072
|
tool_use_id?: string;
|
|
5239
5073
|
is_error?: boolean;
|
|
5240
5074
|
}>]>;
|
|
@@ -5242,8 +5076,8 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
|
|
|
5242
5076
|
type?: "content_block_start";
|
|
5243
5077
|
index?: number;
|
|
5244
5078
|
content_block?: {
|
|
5245
|
-
text?: string;
|
|
5246
5079
|
type?: "text";
|
|
5080
|
+
text?: string;
|
|
5247
5081
|
} | {
|
|
5248
5082
|
type?: "image";
|
|
5249
5083
|
source?: {
|
|
@@ -5257,9 +5091,10 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
|
|
|
5257
5091
|
id?: string;
|
|
5258
5092
|
input?: Record<string, unknown>;
|
|
5259
5093
|
} | {
|
|
5094
|
+
type?: "tool_result";
|
|
5260
5095
|
content?: string | ({
|
|
5261
|
-
text?: string;
|
|
5262
5096
|
type?: "text";
|
|
5097
|
+
text?: string;
|
|
5263
5098
|
} | {
|
|
5264
5099
|
type?: "image";
|
|
5265
5100
|
source?: {
|
|
@@ -5268,7 +5103,6 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
|
|
|
5268
5103
|
data?: string;
|
|
5269
5104
|
};
|
|
5270
5105
|
})[];
|
|
5271
|
-
type?: "tool_result";
|
|
5272
5106
|
tool_use_id?: string;
|
|
5273
5107
|
is_error?: boolean;
|
|
5274
5108
|
};
|
|
@@ -5276,8 +5110,8 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
|
|
|
5276
5110
|
type?: "content_block_start";
|
|
5277
5111
|
index?: number;
|
|
5278
5112
|
content_block?: {
|
|
5279
|
-
text?: string;
|
|
5280
5113
|
type?: "text";
|
|
5114
|
+
text?: string;
|
|
5281
5115
|
} | {
|
|
5282
5116
|
type?: "image";
|
|
5283
5117
|
source?: {
|
|
@@ -5291,9 +5125,10 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
|
|
|
5291
5125
|
id?: string;
|
|
5292
5126
|
input?: Record<string, unknown>;
|
|
5293
5127
|
} | {
|
|
5128
|
+
type?: "tool_result";
|
|
5294
5129
|
content?: string | ({
|
|
5295
|
-
text?: string;
|
|
5296
5130
|
type?: "text";
|
|
5131
|
+
text?: string;
|
|
5297
5132
|
} | {
|
|
5298
5133
|
type?: "image";
|
|
5299
5134
|
source?: {
|
|
@@ -5302,7 +5137,6 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
|
|
|
5302
5137
|
data?: string;
|
|
5303
5138
|
};
|
|
5304
5139
|
})[];
|
|
5305
|
-
type?: "tool_result";
|
|
5306
5140
|
tool_use_id?: string;
|
|
5307
5141
|
is_error?: boolean;
|
|
5308
5142
|
};
|
|
@@ -5313,11 +5147,11 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
|
|
|
5313
5147
|
type: z.ZodLiteral<"text_delta">;
|
|
5314
5148
|
text: z.ZodString;
|
|
5315
5149
|
}, "strip", z.ZodTypeAny, {
|
|
5316
|
-
text?: string;
|
|
5317
5150
|
type?: "text_delta";
|
|
5318
|
-
}, {
|
|
5319
5151
|
text?: string;
|
|
5152
|
+
}, {
|
|
5320
5153
|
type?: "text_delta";
|
|
5154
|
+
text?: string;
|
|
5321
5155
|
}>, z.ZodObject<{
|
|
5322
5156
|
type: z.ZodLiteral<"input_json_delta">;
|
|
5323
5157
|
partial_json: z.ZodString;
|
|
@@ -5332,8 +5166,8 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
|
|
|
5332
5166
|
type?: "content_block_delta";
|
|
5333
5167
|
index?: number;
|
|
5334
5168
|
delta?: {
|
|
5335
|
-
text?: string;
|
|
5336
5169
|
type?: "text_delta";
|
|
5170
|
+
text?: string;
|
|
5337
5171
|
} | {
|
|
5338
5172
|
type?: "input_json_delta";
|
|
5339
5173
|
partial_json?: string;
|
|
@@ -5342,8 +5176,8 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
|
|
|
5342
5176
|
type?: "content_block_delta";
|
|
5343
5177
|
index?: number;
|
|
5344
5178
|
delta?: {
|
|
5345
|
-
text?: string;
|
|
5346
5179
|
type?: "text_delta";
|
|
5180
|
+
text?: string;
|
|
5347
5181
|
} | {
|
|
5348
5182
|
type?: "input_json_delta";
|
|
5349
5183
|
partial_json?: string;
|
|
@@ -5364,10 +5198,10 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
|
|
|
5364
5198
|
stop_sequence: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
5365
5199
|
}, "strip", z.ZodTypeAny, {
|
|
5366
5200
|
stop_sequence?: string;
|
|
5367
|
-
stop_reason?: "
|
|
5201
|
+
stop_reason?: "max_tokens" | "tool_use" | "end_turn" | "stop_sequence";
|
|
5368
5202
|
}, {
|
|
5369
5203
|
stop_sequence?: string;
|
|
5370
|
-
stop_reason?: "
|
|
5204
|
+
stop_reason?: "max_tokens" | "tool_use" | "end_turn" | "stop_sequence";
|
|
5371
5205
|
}>;
|
|
5372
5206
|
usage: z.ZodObject<{
|
|
5373
5207
|
input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
@@ -5389,7 +5223,7 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
|
|
|
5389
5223
|
type?: "message_delta";
|
|
5390
5224
|
delta?: {
|
|
5391
5225
|
stop_sequence?: string;
|
|
5392
|
-
stop_reason?: "
|
|
5226
|
+
stop_reason?: "max_tokens" | "tool_use" | "end_turn" | "stop_sequence";
|
|
5393
5227
|
};
|
|
5394
5228
|
usage?: {
|
|
5395
5229
|
input_tokens?: number;
|
|
@@ -5401,7 +5235,7 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
|
|
|
5401
5235
|
type?: "message_delta";
|
|
5402
5236
|
delta?: {
|
|
5403
5237
|
stop_sequence?: string;
|
|
5404
|
-
stop_reason?: "
|
|
5238
|
+
stop_reason?: "max_tokens" | "tool_use" | "end_turn" | "stop_sequence";
|
|
5405
5239
|
};
|
|
5406
5240
|
usage?: {
|
|
5407
5241
|
input_tokens?: number;
|
|
@@ -5427,23 +5261,23 @@ declare const AnthropicStreamEventSchema: z.ZodUnion<[z.ZodObject<{} & {
|
|
|
5427
5261
|
type: z.ZodString;
|
|
5428
5262
|
message: z.ZodString;
|
|
5429
5263
|
}, "strip", z.ZodTypeAny, {
|
|
5430
|
-
message?: string;
|
|
5431
5264
|
type?: string;
|
|
5432
|
-
}, {
|
|
5433
5265
|
message?: string;
|
|
5266
|
+
}, {
|
|
5434
5267
|
type?: string;
|
|
5268
|
+
message?: string;
|
|
5435
5269
|
}>;
|
|
5436
5270
|
}, "strip", z.ZodTypeAny, {
|
|
5437
5271
|
type?: "error";
|
|
5438
5272
|
error?: {
|
|
5439
|
-
message?: string;
|
|
5440
5273
|
type?: string;
|
|
5274
|
+
message?: string;
|
|
5441
5275
|
};
|
|
5442
5276
|
}, {
|
|
5443
5277
|
type?: "error";
|
|
5444
5278
|
error?: {
|
|
5445
|
-
message?: string;
|
|
5446
5279
|
type?: string;
|
|
5280
|
+
message?: string;
|
|
5447
5281
|
};
|
|
5448
5282
|
}>]>;
|
|
5449
5283
|
type AnthropicRequest = z.infer<typeof AnthropicRequestSchema>;
|
|
@@ -5459,18 +5293,18 @@ type AnthropicToolUseContentBlock = z.infer<typeof AnthropicToolUseContentBlockS
|
|
|
5459
5293
|
type AnthropicToolResultContentBlock = z.infer<typeof AnthropicToolResultContentBlockSchema>;
|
|
5460
5294
|
declare const validateAnthropicRequest: (data: unknown) => {
|
|
5461
5295
|
system?: string | {
|
|
5462
|
-
text?: string;
|
|
5463
5296
|
type?: "text";
|
|
5297
|
+
text?: string;
|
|
5464
5298
|
cache_control?: {
|
|
5465
5299
|
type?: "ephemeral";
|
|
5466
5300
|
};
|
|
5467
5301
|
}[];
|
|
5468
5302
|
model?: string;
|
|
5469
5303
|
messages?: {
|
|
5470
|
-
role?: "
|
|
5304
|
+
role?: "system" | "user" | "assistant";
|
|
5471
5305
|
content?: string | ({
|
|
5472
|
-
text?: string;
|
|
5473
5306
|
type?: "text";
|
|
5307
|
+
text?: string;
|
|
5474
5308
|
} | {
|
|
5475
5309
|
type?: "image";
|
|
5476
5310
|
source?: {
|
|
@@ -5484,9 +5318,10 @@ declare const validateAnthropicRequest: (data: unknown) => {
|
|
|
5484
5318
|
id?: string;
|
|
5485
5319
|
input?: Record<string, unknown>;
|
|
5486
5320
|
} | {
|
|
5321
|
+
type?: "tool_result";
|
|
5487
5322
|
content?: string | ({
|
|
5488
|
-
text?: string;
|
|
5489
5323
|
type?: "text";
|
|
5324
|
+
text?: string;
|
|
5490
5325
|
} | {
|
|
5491
5326
|
type?: "image";
|
|
5492
5327
|
source?: {
|
|
@@ -5495,7 +5330,6 @@ declare const validateAnthropicRequest: (data: unknown) => {
|
|
|
5495
5330
|
data?: string;
|
|
5496
5331
|
};
|
|
5497
5332
|
})[];
|
|
5498
|
-
type?: "tool_result";
|
|
5499
5333
|
tool_use_id?: string;
|
|
5500
5334
|
is_error?: boolean;
|
|
5501
5335
|
})[];
|
|
@@ -5530,10 +5364,12 @@ declare const validateAnthropicRequest: (data: unknown) => {
|
|
|
5530
5364
|
top_k?: number;
|
|
5531
5365
|
};
|
|
5532
5366
|
declare const validateAnthropicResponse: (data: unknown) => {
|
|
5367
|
+
type?: "message";
|
|
5368
|
+
id?: string;
|
|
5533
5369
|
role?: "assistant";
|
|
5534
5370
|
content?: ({
|
|
5535
|
-
text?: string;
|
|
5536
5371
|
type?: "text";
|
|
5372
|
+
text?: string;
|
|
5537
5373
|
} | {
|
|
5538
5374
|
type?: "image";
|
|
5539
5375
|
source?: {
|
|
@@ -5547,9 +5383,10 @@ declare const validateAnthropicResponse: (data: unknown) => {
|
|
|
5547
5383
|
id?: string;
|
|
5548
5384
|
input?: Record<string, unknown>;
|
|
5549
5385
|
} | {
|
|
5386
|
+
type?: "tool_result";
|
|
5550
5387
|
content?: string | ({
|
|
5551
|
-
text?: string;
|
|
5552
5388
|
type?: "text";
|
|
5389
|
+
text?: string;
|
|
5553
5390
|
} | {
|
|
5554
5391
|
type?: "image";
|
|
5555
5392
|
source?: {
|
|
@@ -5558,12 +5395,9 @@ declare const validateAnthropicResponse: (data: unknown) => {
|
|
|
5558
5395
|
data?: string;
|
|
5559
5396
|
};
|
|
5560
5397
|
})[];
|
|
5561
|
-
type?: "tool_result";
|
|
5562
5398
|
tool_use_id?: string;
|
|
5563
5399
|
is_error?: boolean;
|
|
5564
5400
|
})[];
|
|
5565
|
-
type?: "message";
|
|
5566
|
-
id?: string;
|
|
5567
5401
|
model?: string;
|
|
5568
5402
|
usage?: {
|
|
5569
5403
|
input_tokens?: number;
|
|
@@ -5572,14 +5406,17 @@ declare const validateAnthropicResponse: (data: unknown) => {
|
|
|
5572
5406
|
cache_read_input_tokens?: number;
|
|
5573
5407
|
};
|
|
5574
5408
|
stop_sequence?: string;
|
|
5575
|
-
stop_reason?: "
|
|
5409
|
+
stop_reason?: "max_tokens" | "tool_use" | "end_turn" | "stop_sequence";
|
|
5576
5410
|
};
|
|
5577
5411
|
declare const validateAnthropicStreamEvent: (data: unknown) => {
|
|
5412
|
+
type?: "message_start";
|
|
5578
5413
|
message?: {
|
|
5414
|
+
type?: "message";
|
|
5415
|
+
id?: string;
|
|
5579
5416
|
role?: "assistant";
|
|
5580
5417
|
content?: ({
|
|
5581
|
-
text?: string;
|
|
5582
5418
|
type?: "text";
|
|
5419
|
+
text?: string;
|
|
5583
5420
|
} | {
|
|
5584
5421
|
type?: "image";
|
|
5585
5422
|
source?: {
|
|
@@ -5593,9 +5430,10 @@ declare const validateAnthropicStreamEvent: (data: unknown) => {
|
|
|
5593
5430
|
id?: string;
|
|
5594
5431
|
input?: Record<string, unknown>;
|
|
5595
5432
|
} | {
|
|
5433
|
+
type?: "tool_result";
|
|
5596
5434
|
content?: string | ({
|
|
5597
|
-
text?: string;
|
|
5598
5435
|
type?: "text";
|
|
5436
|
+
text?: string;
|
|
5599
5437
|
} | {
|
|
5600
5438
|
type?: "image";
|
|
5601
5439
|
source?: {
|
|
@@ -5604,12 +5442,9 @@ declare const validateAnthropicStreamEvent: (data: unknown) => {
|
|
|
5604
5442
|
data?: string;
|
|
5605
5443
|
};
|
|
5606
5444
|
})[];
|
|
5607
|
-
type?: "tool_result";
|
|
5608
5445
|
tool_use_id?: string;
|
|
5609
5446
|
is_error?: boolean;
|
|
5610
5447
|
})[];
|
|
5611
|
-
type?: "message";
|
|
5612
|
-
id?: string;
|
|
5613
5448
|
model?: string;
|
|
5614
5449
|
usage?: {
|
|
5615
5450
|
input_tokens?: number;
|
|
@@ -5618,15 +5453,14 @@ declare const validateAnthropicStreamEvent: (data: unknown) => {
|
|
|
5618
5453
|
cache_read_input_tokens?: number;
|
|
5619
5454
|
};
|
|
5620
5455
|
stop_sequence?: string;
|
|
5621
|
-
stop_reason?: "
|
|
5456
|
+
stop_reason?: "max_tokens" | "tool_use" | "end_turn" | "stop_sequence";
|
|
5622
5457
|
};
|
|
5623
|
-
type?: "message_start";
|
|
5624
5458
|
} | {
|
|
5625
5459
|
type?: "content_block_start";
|
|
5626
5460
|
index?: number;
|
|
5627
5461
|
content_block?: {
|
|
5628
|
-
text?: string;
|
|
5629
5462
|
type?: "text";
|
|
5463
|
+
text?: string;
|
|
5630
5464
|
} | {
|
|
5631
5465
|
type?: "image";
|
|
5632
5466
|
source?: {
|
|
@@ -5640,9 +5474,10 @@ declare const validateAnthropicStreamEvent: (data: unknown) => {
|
|
|
5640
5474
|
id?: string;
|
|
5641
5475
|
input?: Record<string, unknown>;
|
|
5642
5476
|
} | {
|
|
5477
|
+
type?: "tool_result";
|
|
5643
5478
|
content?: string | ({
|
|
5644
|
-
text?: string;
|
|
5645
5479
|
type?: "text";
|
|
5480
|
+
text?: string;
|
|
5646
5481
|
} | {
|
|
5647
5482
|
type?: "image";
|
|
5648
5483
|
source?: {
|
|
@@ -5651,7 +5486,6 @@ declare const validateAnthropicStreamEvent: (data: unknown) => {
|
|
|
5651
5486
|
data?: string;
|
|
5652
5487
|
};
|
|
5653
5488
|
})[];
|
|
5654
|
-
type?: "tool_result";
|
|
5655
5489
|
tool_use_id?: string;
|
|
5656
5490
|
is_error?: boolean;
|
|
5657
5491
|
};
|
|
@@ -5659,8 +5493,8 @@ declare const validateAnthropicStreamEvent: (data: unknown) => {
|
|
|
5659
5493
|
type?: "content_block_delta";
|
|
5660
5494
|
index?: number;
|
|
5661
5495
|
delta?: {
|
|
5662
|
-
text?: string;
|
|
5663
5496
|
type?: "text_delta";
|
|
5497
|
+
text?: string;
|
|
5664
5498
|
} | {
|
|
5665
5499
|
type?: "input_json_delta";
|
|
5666
5500
|
partial_json?: string;
|
|
@@ -5672,7 +5506,7 @@ declare const validateAnthropicStreamEvent: (data: unknown) => {
|
|
|
5672
5506
|
type?: "message_delta";
|
|
5673
5507
|
delta?: {
|
|
5674
5508
|
stop_sequence?: string;
|
|
5675
|
-
stop_reason?: "
|
|
5509
|
+
stop_reason?: "max_tokens" | "tool_use" | "end_turn" | "stop_sequence";
|
|
5676
5510
|
};
|
|
5677
5511
|
usage?: {
|
|
5678
5512
|
input_tokens?: number;
|
|
@@ -5687,8 +5521,8 @@ declare const validateAnthropicStreamEvent: (data: unknown) => {
|
|
|
5687
5521
|
} | {
|
|
5688
5522
|
type?: "error";
|
|
5689
5523
|
error?: {
|
|
5690
|
-
message?: string;
|
|
5691
5524
|
type?: string;
|
|
5525
|
+
message?: string;
|
|
5692
5526
|
};
|
|
5693
5527
|
};
|
|
5694
5528
|
|
|
@@ -5714,7 +5548,7 @@ interface OpenAIResponse extends OpenAIResponse$1 {
|
|
|
5714
5548
|
/**
|
|
5715
5549
|
* 转换结果接口 - 增强版
|
|
5716
5550
|
*/
|
|
5717
|
-
interface ConversionResult$
|
|
5551
|
+
interface ConversionResult$2<T> {
|
|
5718
5552
|
success: boolean;
|
|
5719
5553
|
data?: T;
|
|
5720
5554
|
originalData?: unknown;
|
|
@@ -5729,70 +5563,6 @@ interface ConversionResult$1<T> {
|
|
|
5729
5563
|
};
|
|
5730
5564
|
}
|
|
5731
5565
|
|
|
5732
|
-
/**
|
|
5733
|
-
* 标准协议适配器 - 纯协议转换器
|
|
5734
|
-
* 只负责Anthropic和OpenAI格式之间的转换,不包含HTTP请求逻辑
|
|
5735
|
-
*/
|
|
5736
|
-
|
|
5737
|
-
interface StandardProtocolAdapterOptions {
|
|
5738
|
-
debugMode?: boolean;
|
|
5739
|
-
}
|
|
5740
|
-
interface ConvertedRequest {
|
|
5741
|
-
openaiRequest: OpenAIRequest;
|
|
5742
|
-
metadata: {
|
|
5743
|
-
hasImages: boolean;
|
|
5744
|
-
requiresVisionHeaders: boolean;
|
|
5745
|
-
};
|
|
5746
|
-
}
|
|
5747
|
-
interface ConvertedResponse {
|
|
5748
|
-
anthropicStandardResponse: any;
|
|
5749
|
-
success: boolean;
|
|
5750
|
-
error?: string;
|
|
5751
|
-
}
|
|
5752
|
-
/**
|
|
5753
|
-
* 标准协议适配器类 - 纯协议转换器
|
|
5754
|
-
* 只处理格式转换,不处理HTTP请求
|
|
5755
|
-
*/
|
|
5756
|
-
declare class StandardProtocolAdapter {
|
|
5757
|
-
private debugMode;
|
|
5758
|
-
private sseAdapter;
|
|
5759
|
-
constructor(options?: StandardProtocolAdapterOptions);
|
|
5760
|
-
/**
|
|
5761
|
-
* 转换Anthropic请求为OpenAI请求格式
|
|
5762
|
-
* @param anthropicRequest - Anthropic格式的请求
|
|
5763
|
-
* @returns 转换后的OpenAI请求和元数据
|
|
5764
|
-
*/
|
|
5765
|
-
convertRequest(anthropicRequest: any): ConvertedRequest;
|
|
5766
|
-
/**
|
|
5767
|
-
* 从OpenAI流式数据转换为Anthropic标准格式
|
|
5768
|
-
* 本质上是流式处理的"await"版本 - 等待整个流处理完成后提取最终结果
|
|
5769
|
-
*/
|
|
5770
|
-
convertFromStreamToStandard(openaiRawStream: string, modelName: string, messageId?: string): ClaudeStandardResponse;
|
|
5771
|
-
/**
|
|
5772
|
-
* 从SSE流式结果中提取标准格式响应
|
|
5773
|
-
*/
|
|
5774
|
-
private extractStandardResponseFromSSE;
|
|
5775
|
-
/**
|
|
5776
|
-
* 转换OpenAI响应为Anthropic标准格式
|
|
5777
|
-
*/
|
|
5778
|
-
convertResponse(openaiResponse: any, originalRequest: any): ConvertedResponse;
|
|
5779
|
-
/**
|
|
5780
|
-
* 映射OpenAI的finish_reason到Anthropic的stop_reason
|
|
5781
|
-
*/
|
|
5782
|
-
private mapFinishReasonToStopReason;
|
|
5783
|
-
/**
|
|
5784
|
-
* 检测Anthropic请求是否包含图片内容
|
|
5785
|
-
*/
|
|
5786
|
-
private hasImageContent;
|
|
5787
|
-
/**
|
|
5788
|
-
* 获取调试信息
|
|
5789
|
-
*/
|
|
5790
|
-
getDebugInfo(): {
|
|
5791
|
-
adapterType: string;
|
|
5792
|
-
supportedTools: string[];
|
|
5793
|
-
};
|
|
5794
|
-
}
|
|
5795
|
-
|
|
5796
5566
|
/**
|
|
5797
5567
|
* A2O请求适配器配置 - 增强版
|
|
5798
5568
|
*/
|
|
@@ -5836,6 +5606,11 @@ interface A2ORequestAdapterConfig {
|
|
|
5836
5606
|
logLevel: 'none' | 'error' | 'warn' | 'info' | 'debug';
|
|
5837
5607
|
enableMetrics: boolean;
|
|
5838
5608
|
};
|
|
5609
|
+
imageProxy: {
|
|
5610
|
+
enabled: boolean;
|
|
5611
|
+
timeout: number;
|
|
5612
|
+
maxSize: number;
|
|
5613
|
+
};
|
|
5839
5614
|
}
|
|
5840
5615
|
|
|
5841
5616
|
/**
|
|
@@ -5854,11 +5629,11 @@ declare class A2ORequestAdapter {
|
|
|
5854
5629
|
* 转换Anthropic请求格式为OpenAI兼容格式 - 增强版
|
|
5855
5630
|
* 集成校验、修复和错误恢复功能
|
|
5856
5631
|
*/
|
|
5857
|
-
convertAnthropicRequestToOpenAIEnhanced(anthropicRequest: unknown): Promise<ConversionResult$
|
|
5632
|
+
convertAnthropicRequestToOpenAIEnhanced(anthropicRequest: unknown): Promise<ConversionResult$2<OpenAIRequest>>;
|
|
5858
5633
|
/**
|
|
5859
|
-
*
|
|
5634
|
+
* 执行核心转换逻辑(支持图片代理)
|
|
5860
5635
|
*/
|
|
5861
|
-
|
|
5636
|
+
performCoreConversion(anthropicRequest: ClaudeRequest): Promise<any>;
|
|
5862
5637
|
/**
|
|
5863
5638
|
* 转换Anthropic请求格式为OpenAI兼容格式 - 原有方法保持兼容
|
|
5864
5639
|
*/
|
|
@@ -5869,6 +5644,7 @@ declare class A2ORequestAdapter {
|
|
|
5869
5644
|
convertOpenAIResponseToClaude(openaiResponse: OpenAIResponse): any;
|
|
5870
5645
|
/**
|
|
5871
5646
|
* 转换工具定义列表
|
|
5647
|
+
* 确保所有工具都有有效描述,无论是Anthropic还是OpenAI格式
|
|
5872
5648
|
*/
|
|
5873
5649
|
private convertToolDefinitions;
|
|
5874
5650
|
/**
|
|
@@ -5953,8 +5729,35 @@ declare const A2ORequestAdapterStatic: {
|
|
|
5953
5729
|
* 获取工具映射(静态方法,已弃用)
|
|
5954
5730
|
*/
|
|
5955
5731
|
getToolMapping: (claudeToolName: string) => string | undefined;
|
|
5732
|
+
/**
|
|
5733
|
+
* 转换Anthropic请求格式为OpenAI兼容格式(异步版本,支持图片URL自动下载)
|
|
5734
|
+
* 解决GitHub Copilot等API不支持外部图片URL的问题
|
|
5735
|
+
* @param anthropicRequest Claude格式的请求
|
|
5736
|
+
* @param downloadImageUrls 是否下载图片URL并转换为base64(默认true)
|
|
5737
|
+
*/
|
|
5738
|
+
convertAnthropicRequestToOpenAIAsync: (anthropicRequest: ClaudeRequest, downloadImageUrls?: boolean) => Promise<OpenAIRequest>;
|
|
5956
5739
|
};
|
|
5957
5740
|
|
|
5741
|
+
/**
|
|
5742
|
+
* 从URL下载图片并转换为base64 data URI
|
|
5743
|
+
* @param url 图片URL
|
|
5744
|
+
* @param options 下载选项
|
|
5745
|
+
* @returns base64 data URI (例如: "data:image/jpeg;base64,/9j/4AAQ...")
|
|
5746
|
+
*/
|
|
5747
|
+
declare function downloadImageAsBase64(url: string, options?: {
|
|
5748
|
+
timeout?: number;
|
|
5749
|
+
maxSize?: number;
|
|
5750
|
+
userAgent?: string;
|
|
5751
|
+
}): Promise<string>;
|
|
5752
|
+
/**
|
|
5753
|
+
* 判断URL是否是外部URL(http/https开头)
|
|
5754
|
+
*/
|
|
5755
|
+
declare function isExternalUrl(url: string): boolean;
|
|
5756
|
+
/**
|
|
5757
|
+
* 判断URL是否已经是base64 data URI
|
|
5758
|
+
*/
|
|
5759
|
+
declare function isBase64DataUri(url: string): boolean;
|
|
5760
|
+
|
|
5958
5761
|
/**
|
|
5959
5762
|
* A2O格式验证器
|
|
5960
5763
|
* 专门处理Claude和OpenAI请求格式的验证
|
|
@@ -6029,6 +5832,388 @@ declare class FormatValidator {
|
|
|
6029
5832
|
};
|
|
6030
5833
|
}
|
|
6031
5834
|
|
|
5835
|
+
interface ToolCallState {
|
|
5836
|
+
id: string;
|
|
5837
|
+
name: string;
|
|
5838
|
+
input: string;
|
|
5839
|
+
blockStartSent: boolean;
|
|
5840
|
+
blockStopSent: boolean;
|
|
5841
|
+
blockIndex?: number;
|
|
5842
|
+
pendingChunks: string[];
|
|
5843
|
+
}
|
|
5844
|
+
interface StreamingProtocolAdapterOptions {
|
|
5845
|
+
debugMode?: boolean;
|
|
5846
|
+
validateInput?: boolean;
|
|
5847
|
+
validateOutput?: boolean;
|
|
5848
|
+
autoHeal?: boolean;
|
|
5849
|
+
timeout?: number;
|
|
5850
|
+
retries?: number;
|
|
5851
|
+
bufferSize?: number;
|
|
5852
|
+
logger?: any;
|
|
5853
|
+
}
|
|
5854
|
+
interface ConversionState {
|
|
5855
|
+
processedLines: number;
|
|
5856
|
+
textContent: string;
|
|
5857
|
+
reasoningContent: string;
|
|
5858
|
+
toolCallsMap: Map<string, ToolCallState>;
|
|
5859
|
+
completedToolCalls: string[];
|
|
5860
|
+
allSSELines: string[];
|
|
5861
|
+
errors: any[];
|
|
5862
|
+
usage: {
|
|
5863
|
+
input_tokens: number;
|
|
5864
|
+
output_tokens: number;
|
|
5865
|
+
};
|
|
5866
|
+
thinkingBlockStarted: boolean;
|
|
5867
|
+
contentBlockStarted: boolean;
|
|
5868
|
+
toolCallCounter: number;
|
|
5869
|
+
nextToolBlockIndex: number;
|
|
5870
|
+
}
|
|
5871
|
+
interface ConversionResult$1 {
|
|
5872
|
+
success: boolean;
|
|
5873
|
+
error?: string;
|
|
5874
|
+
anthropicSSE: string;
|
|
5875
|
+
anthropicStandardResponse: any;
|
|
5876
|
+
}
|
|
5877
|
+
interface AnthropicToOpenAIChunkResult {
|
|
5878
|
+
buffer: string;
|
|
5879
|
+
chunks: OpenAIStreamChunk[];
|
|
5880
|
+
finishReason?: OpenAIFinishReason;
|
|
5881
|
+
streamStopped: boolean;
|
|
5882
|
+
}
|
|
5883
|
+
type OpenAIFinishReason = NonNullable<OpenAIStreamChunk['choices'][number]['finish_reason']>;
|
|
5884
|
+
declare class StreamingProtocolAdapter {
|
|
5885
|
+
private config;
|
|
5886
|
+
constructor(options?: StreamingProtocolAdapterOptions);
|
|
5887
|
+
private logDebug;
|
|
5888
|
+
/**
|
|
5889
|
+
* 转换Anthropic请求为OpenAI格式
|
|
5890
|
+
*/
|
|
5891
|
+
convertAnthropicToOpenAI(anthropicRequest: any): {
|
|
5892
|
+
openaiRequest: OpenAIRequest;
|
|
5893
|
+
metadata: {
|
|
5894
|
+
hasImages: boolean;
|
|
5895
|
+
requiresVisionHeaders: boolean;
|
|
5896
|
+
};
|
|
5897
|
+
};
|
|
5898
|
+
/**
|
|
5899
|
+
* 与StandardProtocolAdapter保持一致的API,用于集成测试和向后兼容。
|
|
5900
|
+
*/
|
|
5901
|
+
convertRequest(anthropicRequest: any): {
|
|
5902
|
+
openaiRequest: OpenAIRequest;
|
|
5903
|
+
metadata: {
|
|
5904
|
+
hasImages: boolean;
|
|
5905
|
+
requiresVisionHeaders: boolean;
|
|
5906
|
+
};
|
|
5907
|
+
};
|
|
5908
|
+
/**
|
|
5909
|
+
* 转换OpenAI流式响应为Anthropic SSE格式
|
|
5910
|
+
*/
|
|
5911
|
+
convertOpenAIStreamToAnthropic(openaiStream: string, originalRequest: any): ConversionResult$1;
|
|
5912
|
+
/**
|
|
5913
|
+
* 增量解析Anthropic SSE,转换为OpenAI流式chunk
|
|
5914
|
+
* 供 OpenAI Chat Completions 端点直接复用
|
|
5915
|
+
*/
|
|
5916
|
+
convertAnthropicSSEChunkToOpenAI(params: {
|
|
5917
|
+
buffer: string;
|
|
5918
|
+
chunk: string;
|
|
5919
|
+
model: string;
|
|
5920
|
+
flush?: boolean;
|
|
5921
|
+
}): AnthropicToOpenAIChunkResult;
|
|
5922
|
+
/**
|
|
5923
|
+
* 将OpenAI流转换为Anthropic SSE格式
|
|
5924
|
+
*/
|
|
5925
|
+
private convertToAnthropicSSE;
|
|
5926
|
+
/**
|
|
5927
|
+
* 处理单个流式数据块 - 支持thinking和content双模式
|
|
5928
|
+
*/
|
|
5929
|
+
private processStreamChunk;
|
|
5930
|
+
/**
|
|
5931
|
+
* 处理工具调用 - 支持OpenAI流式分块累积
|
|
5932
|
+
* OpenAI流式API会将tool_calls分多个chunk发送:
|
|
5933
|
+
* - Chunk 1: {index:0, id:"call_xxx", type:"function", function:{name:"web_search"}}
|
|
5934
|
+
* - Chunk 2: {index:0, function:{arguments:"{\"query\":\"xxx\"}"}}
|
|
5935
|
+
* - Chunk N: 继续累积arguments
|
|
5936
|
+
*/
|
|
5937
|
+
private processToolCalls;
|
|
5938
|
+
private getOrCreateToolCallState;
|
|
5939
|
+
private registerToolCallAlias;
|
|
5940
|
+
private maybeStartToolBlock;
|
|
5941
|
+
private flushPendingToolChunks;
|
|
5942
|
+
private coalesceContent;
|
|
5943
|
+
private appendThinkingContent;
|
|
5944
|
+
private appendTextContent;
|
|
5945
|
+
private updateUsageFromChunk;
|
|
5946
|
+
private isResponsesEvent;
|
|
5947
|
+
private processResponsesEvent;
|
|
5948
|
+
private resolveResponsesToolData;
|
|
5949
|
+
private handleResponsesOutputItemAdded;
|
|
5950
|
+
private handleResponsesFunctionArgumentsDelta;
|
|
5951
|
+
private handleResponsesFunctionArgumentsDone;
|
|
5952
|
+
private extractResponsesTextDelta;
|
|
5953
|
+
private extractResponsesThinkingDelta;
|
|
5954
|
+
private extractArgumentsDelta;
|
|
5955
|
+
/**
|
|
5956
|
+
* 在流结束时关闭所有未关闭的工具调用块
|
|
5957
|
+
*/
|
|
5958
|
+
private closeAllToolCallBlocks;
|
|
5959
|
+
/**
|
|
5960
|
+
* 添加最终事件 - 支持thinking+content双模式
|
|
5961
|
+
*/
|
|
5962
|
+
private addFinalEvents;
|
|
5963
|
+
/**
|
|
5964
|
+
* 构建标准响应格式
|
|
5965
|
+
*/
|
|
5966
|
+
private buildStandardResponse;
|
|
5967
|
+
/**
|
|
5968
|
+
* 创建转换状态对象
|
|
5969
|
+
*/
|
|
5970
|
+
private createConversionState;
|
|
5971
|
+
private parseAnthropicSSEEvent;
|
|
5972
|
+
private extractTextFromAnthropicDelta;
|
|
5973
|
+
private mapAnthropicStopReasonToOpenAI;
|
|
5974
|
+
private buildOpenAIStreamChunk;
|
|
5975
|
+
/**
|
|
5976
|
+
* 转换消息格式
|
|
5977
|
+
*/
|
|
5978
|
+
private convertMessages;
|
|
5979
|
+
/**
|
|
5980
|
+
* 映射Anthropic模型到OpenAI模型
|
|
5981
|
+
*/
|
|
5982
|
+
private mapAnthropicModelToOpenAI;
|
|
5983
|
+
/**
|
|
5984
|
+
* 检查请求是否包含图片内容
|
|
5985
|
+
*/
|
|
5986
|
+
private hasImageContent;
|
|
5987
|
+
/**
|
|
5988
|
+
* 转义JSON字符串
|
|
5989
|
+
*/
|
|
5990
|
+
private escapeJsonString;
|
|
5991
|
+
/**
|
|
5992
|
+
* 获取初始SSE事件(message_start + ping)
|
|
5993
|
+
*/
|
|
5994
|
+
getInitialSSEEvents(modelName?: string, messageId?: string): string[];
|
|
5995
|
+
/**
|
|
5996
|
+
* 增量转换单个OpenAI数据块为Anthropic SSE事件
|
|
5997
|
+
* 用于逐个处理流式数据片段
|
|
5998
|
+
*/
|
|
5999
|
+
convertIncrementalChunk(openaiDataLine: string, state: ConversionState): string[];
|
|
6000
|
+
/**
|
|
6001
|
+
* 暴露内部状态创建方法,供外部增量处理流程使用。
|
|
6002
|
+
*/
|
|
6003
|
+
createIncrementalState(): ConversionState;
|
|
6004
|
+
}
|
|
6005
|
+
|
|
6006
|
+
/**
|
|
6007
|
+
* O2A SSE适配器相关类型定义
|
|
6008
|
+
*/
|
|
6009
|
+
interface CaptureSession {
|
|
6010
|
+
[key: string]: any;
|
|
6011
|
+
}
|
|
6012
|
+
/**
|
|
6013
|
+
* 工具调用信息接口
|
|
6014
|
+
*/
|
|
6015
|
+
interface ToolCallInfo {
|
|
6016
|
+
index: number;
|
|
6017
|
+
name: string;
|
|
6018
|
+
hasArgs: boolean;
|
|
6019
|
+
}
|
|
6020
|
+
/**
|
|
6021
|
+
* 流式转换状态接口
|
|
6022
|
+
*/
|
|
6023
|
+
interface StreamingConversionState {
|
|
6024
|
+
hasContent: boolean;
|
|
6025
|
+
hasThinking: boolean;
|
|
6026
|
+
contentBlockIndex: number;
|
|
6027
|
+
thinkingBlockIndex: number;
|
|
6028
|
+
toolCallsMap: Map<string, ToolCallInfo>;
|
|
6029
|
+
completedToolCalls: Set<string>;
|
|
6030
|
+
accumulatedUsage: {
|
|
6031
|
+
input_tokens: number;
|
|
6032
|
+
output_tokens: number;
|
|
6033
|
+
cache_creation_input_tokens?: number;
|
|
6034
|
+
cache_read_input_tokens?: number;
|
|
6035
|
+
};
|
|
6036
|
+
processedLines: number;
|
|
6037
|
+
errors: string[];
|
|
6038
|
+
allSSELines: string[];
|
|
6039
|
+
}
|
|
6040
|
+
/**
|
|
6041
|
+
* 增量转换状态接口(扩展基础状态)
|
|
6042
|
+
*/
|
|
6043
|
+
interface IncrementalConversionState extends StreamingConversionState {
|
|
6044
|
+
captureSession?: CaptureSession;
|
|
6045
|
+
}
|
|
6046
|
+
/**
|
|
6047
|
+
* Claude标准响应格式
|
|
6048
|
+
*/
|
|
6049
|
+
interface ClaudeStandardResponse {
|
|
6050
|
+
id: string;
|
|
6051
|
+
model: string;
|
|
6052
|
+
role: 'assistant';
|
|
6053
|
+
content: ContentBlock[];
|
|
6054
|
+
type: 'message';
|
|
6055
|
+
stop_reason: 'end_turn' | 'max_tokens' | 'stop_sequence' | 'tool_use' | null;
|
|
6056
|
+
stop_sequence: string | null;
|
|
6057
|
+
usage: Usage;
|
|
6058
|
+
}
|
|
6059
|
+
interface ContentBlock {
|
|
6060
|
+
type: 'text' | 'tool_use' | 'tool_result' | 'image';
|
|
6061
|
+
}
|
|
6062
|
+
interface Usage {
|
|
6063
|
+
input_tokens: number;
|
|
6064
|
+
output_tokens: number;
|
|
6065
|
+
cache_creation_input_tokens?: number;
|
|
6066
|
+
cache_read_input_tokens?: number;
|
|
6067
|
+
}
|
|
6068
|
+
|
|
6069
|
+
/**
|
|
6070
|
+
* 标准协议适配器 - 纯协议转换器
|
|
6071
|
+
* 只负责Anthropic和OpenAI格式之间的转换,不包含HTTP请求逻辑
|
|
6072
|
+
*/
|
|
6073
|
+
|
|
6074
|
+
interface StandardProtocolAdapterOptions {
|
|
6075
|
+
debugMode?: boolean;
|
|
6076
|
+
}
|
|
6077
|
+
interface ConvertedRequest {
|
|
6078
|
+
openaiRequest: OpenAIRequest;
|
|
6079
|
+
metadata: {
|
|
6080
|
+
hasImages: boolean;
|
|
6081
|
+
requiresVisionHeaders: boolean;
|
|
6082
|
+
};
|
|
6083
|
+
}
|
|
6084
|
+
interface ConvertedResponse {
|
|
6085
|
+
anthropicStandardResponse: any;
|
|
6086
|
+
success: boolean;
|
|
6087
|
+
error?: string;
|
|
6088
|
+
}
|
|
6089
|
+
/**
|
|
6090
|
+
* 标准协议适配器类 - 纯协议转换器
|
|
6091
|
+
* 只处理格式转换,不处理HTTP请求
|
|
6092
|
+
*/
|
|
6093
|
+
declare class StandardProtocolAdapter {
|
|
6094
|
+
private debugMode;
|
|
6095
|
+
private sseAdapter;
|
|
6096
|
+
constructor(options?: StandardProtocolAdapterOptions);
|
|
6097
|
+
private logDebug;
|
|
6098
|
+
/**
|
|
6099
|
+
* 转换Anthropic请求为OpenAI请求格式
|
|
6100
|
+
* @param anthropicRequest - Anthropic格式的请求
|
|
6101
|
+
* @returns 转换后的OpenAI请求和元数据
|
|
6102
|
+
*/
|
|
6103
|
+
convertRequest(anthropicRequest: any): ConvertedRequest;
|
|
6104
|
+
/**
|
|
6105
|
+
* 从OpenAI流式数据转换为Anthropic标准格式
|
|
6106
|
+
* 本质上是流式处理的"await"版本 - 等待整个流处理完成后提取最终结果
|
|
6107
|
+
*/
|
|
6108
|
+
convertFromStreamToStandard(openaiRawStream: string, modelName: string, messageId?: string): ClaudeStandardResponse;
|
|
6109
|
+
/**
|
|
6110
|
+
* 从SSE流式结果中提取标准格式响应
|
|
6111
|
+
*/
|
|
6112
|
+
private extractStandardResponseFromSSE;
|
|
6113
|
+
/**
|
|
6114
|
+
* 转换OpenAI响应为Anthropic标准格式
|
|
6115
|
+
*/
|
|
6116
|
+
convertResponse(openaiResponse: any, originalRequest: any): ConvertedResponse;
|
|
6117
|
+
/**
|
|
6118
|
+
* 映射OpenAI的finish_reason到Anthropic的stop_reason
|
|
6119
|
+
*/
|
|
6120
|
+
private mapFinishReasonToStopReason;
|
|
6121
|
+
/**
|
|
6122
|
+
* 检测Anthropic请求是否包含图片内容
|
|
6123
|
+
*/
|
|
6124
|
+
private hasImageContent;
|
|
6125
|
+
/**
|
|
6126
|
+
* 获取调试信息
|
|
6127
|
+
*/
|
|
6128
|
+
getDebugInfo(): {
|
|
6129
|
+
adapterType: string;
|
|
6130
|
+
supportedTools: string[];
|
|
6131
|
+
};
|
|
6132
|
+
}
|
|
6133
|
+
|
|
6134
|
+
/**
|
|
6135
|
+
* 流式处理相关类型定义
|
|
6136
|
+
*/
|
|
6137
|
+
|
|
6138
|
+
/**
|
|
6139
|
+
* 流式转换配置选项
|
|
6140
|
+
*/
|
|
6141
|
+
interface StreamConversionOptions {
|
|
6142
|
+
/** 模型名称 */
|
|
6143
|
+
modelName?: string;
|
|
6144
|
+
/** 消息ID */
|
|
6145
|
+
messageId?: string;
|
|
6146
|
+
/** 缓冲区超时时间(毫秒) */
|
|
6147
|
+
bufferTimeout?: number;
|
|
6148
|
+
/** 是否启用错误恢复 */
|
|
6149
|
+
errorRecovery?: boolean;
|
|
6150
|
+
/** 最大重试次数 */
|
|
6151
|
+
maxRetries?: number;
|
|
6152
|
+
/** 块处理回调 */
|
|
6153
|
+
onChunkProcessed?: (chunk: string, events: string[]) => void;
|
|
6154
|
+
/** 错误回调 */
|
|
6155
|
+
onError?: (error: Error, context: StreamErrorContext) => void;
|
|
6156
|
+
/** 调试模式 */
|
|
6157
|
+
debug?: boolean;
|
|
6158
|
+
}
|
|
6159
|
+
/**
|
|
6160
|
+
* 流式错误上下文
|
|
6161
|
+
*/
|
|
6162
|
+
interface StreamErrorContext {
|
|
6163
|
+
chunk: string;
|
|
6164
|
+
state: IncrementalConversionState;
|
|
6165
|
+
attempt?: number;
|
|
6166
|
+
totalRetries?: number;
|
|
6167
|
+
}
|
|
6168
|
+
/**
|
|
6169
|
+
* 流式转换器接口
|
|
6170
|
+
*/
|
|
6171
|
+
interface IStreamConverter {
|
|
6172
|
+
/**
|
|
6173
|
+
* 获取初始事件
|
|
6174
|
+
*/
|
|
6175
|
+
getInitialEvents(): string[];
|
|
6176
|
+
/**
|
|
6177
|
+
* 处理单个数据块
|
|
6178
|
+
*/
|
|
6179
|
+
processChunk(chunk: string): string[];
|
|
6180
|
+
/**
|
|
6181
|
+
* 结束流处理
|
|
6182
|
+
*/
|
|
6183
|
+
finalize(): string[];
|
|
6184
|
+
/**
|
|
6185
|
+
* 获取当前状态
|
|
6186
|
+
*/
|
|
6187
|
+
getState(): IncrementalConversionState;
|
|
6188
|
+
/**
|
|
6189
|
+
* 重置状态
|
|
6190
|
+
*/
|
|
6191
|
+
reset(): void;
|
|
6192
|
+
/**
|
|
6193
|
+
* 获取统计信息
|
|
6194
|
+
*/
|
|
6195
|
+
getStats(): StreamStats;
|
|
6196
|
+
}
|
|
6197
|
+
/**
|
|
6198
|
+
* 流式处理统计信息
|
|
6199
|
+
*/
|
|
6200
|
+
interface StreamStats {
|
|
6201
|
+
/** 处理的块数量 */
|
|
6202
|
+
chunksProcessed: number;
|
|
6203
|
+
/** 生成的事件数量 */
|
|
6204
|
+
eventsGenerated: number;
|
|
6205
|
+
/** 错误数量 */
|
|
6206
|
+
errors: number;
|
|
6207
|
+
/** 重试次数 */
|
|
6208
|
+
retries: number;
|
|
6209
|
+
/** 处理开始时间 */
|
|
6210
|
+
startTime: number;
|
|
6211
|
+
/** 最后更新时间 */
|
|
6212
|
+
lastUpdateTime: number;
|
|
6213
|
+
/** 缓冲区大小 */
|
|
6214
|
+
bufferSize: number;
|
|
6215
|
+
}
|
|
6216
|
+
|
|
6032
6217
|
/**
|
|
6033
6218
|
* O2A SSE适配器配置
|
|
6034
6219
|
*/
|
|
@@ -6103,6 +6288,20 @@ declare class O2ASSEAdapter {
|
|
|
6103
6288
|
errors: string[];
|
|
6104
6289
|
warnings: string[];
|
|
6105
6290
|
};
|
|
6291
|
+
/**
|
|
6292
|
+
* 将 OpenAI Response 流直接转换为 Anthropic SSE 流
|
|
6293
|
+
* 这是新增的核心流式处理方法,支持实时转换
|
|
6294
|
+
*/
|
|
6295
|
+
convertResponseStream(openaiResponse: Response, options?: StreamConversionOptions): ReadableStream<string>;
|
|
6296
|
+
/**
|
|
6297
|
+
* 将 ReadableStream 转换为 Anthropic SSE 流
|
|
6298
|
+
*/
|
|
6299
|
+
convertReadableStream(openaiStream: ReadableStream<Uint8Array>, options?: StreamConversionOptions): ReadableStream<string>;
|
|
6300
|
+
/**
|
|
6301
|
+
* 创建流式转换器实例
|
|
6302
|
+
* 提供更精细的流处理控制
|
|
6303
|
+
*/
|
|
6304
|
+
createStreamConverter(options?: StreamConversionOptions): IStreamConverter;
|
|
6106
6305
|
/**
|
|
6107
6306
|
* 应用增强功能到SSE转换
|
|
6108
6307
|
* 包括输入验证、输出修复等
|
|
@@ -6135,6 +6334,21 @@ declare const O2ASSEAdapterStatic: {
|
|
|
6135
6334
|
errors: string[];
|
|
6136
6335
|
warnings: string[];
|
|
6137
6336
|
};
|
|
6337
|
+
/**
|
|
6338
|
+
* 转换 Response 流为 Anthropic SSE(静态方法)
|
|
6339
|
+
* 新增:直接处理 Response 对象的流式转换
|
|
6340
|
+
*/
|
|
6341
|
+
convertResponseStream: (openaiResponse: Response, options?: StreamConversionOptions) => ReadableStream<string>;
|
|
6342
|
+
/**
|
|
6343
|
+
* 转换 ReadableStream 为 Anthropic SSE(静态方法)
|
|
6344
|
+
* 新增:处理任意 ReadableStream<Uint8Array> 的流式转换
|
|
6345
|
+
*/
|
|
6346
|
+
convertReadableStream: (openaiStream: ReadableStream<Uint8Array>, options?: StreamConversionOptions) => ReadableStream<string>;
|
|
6347
|
+
/**
|
|
6348
|
+
* 创建流式转换器(静态方法)
|
|
6349
|
+
* 新增:提供更精细的流处理控制
|
|
6350
|
+
*/
|
|
6351
|
+
createStreamConverter: (options?: StreamConversionOptions) => IStreamConverter;
|
|
6138
6352
|
};
|
|
6139
6353
|
|
|
6140
6354
|
/**
|
|
@@ -6265,16 +6479,16 @@ declare const validateA2OConversion: (anthropicData: unknown, convertedData: unk
|
|
|
6265
6479
|
user?: string;
|
|
6266
6480
|
model?: string;
|
|
6267
6481
|
messages?: {
|
|
6268
|
-
|
|
6482
|
+
name?: string;
|
|
6483
|
+
role?: "system" | "user" | "assistant" | "tool";
|
|
6269
6484
|
content?: string | {
|
|
6270
|
-
text?: string;
|
|
6271
6485
|
type?: "text" | "image_url";
|
|
6486
|
+
text?: string;
|
|
6272
6487
|
image_url?: {
|
|
6273
6488
|
url?: string;
|
|
6274
6489
|
detail?: "low" | "high" | "auto";
|
|
6275
6490
|
};
|
|
6276
6491
|
}[];
|
|
6277
|
-
name?: string;
|
|
6278
6492
|
tool_calls?: {
|
|
6279
6493
|
function?: {
|
|
6280
6494
|
name?: string;
|
|
@@ -6321,10 +6535,12 @@ declare const validateA2OConversion: (anthropicData: unknown, convertedData: unk
|
|
|
6321
6535
|
top_logprobs?: number;
|
|
6322
6536
|
}>;
|
|
6323
6537
|
declare const validateO2AConversion: (openaiData: unknown, convertedData: unknown, useHealing?: boolean) => ConversionResult<{
|
|
6538
|
+
type?: "message";
|
|
6539
|
+
id?: string;
|
|
6324
6540
|
role?: "assistant";
|
|
6325
6541
|
content?: ({
|
|
6326
|
-
text?: string;
|
|
6327
6542
|
type?: "text";
|
|
6543
|
+
text?: string;
|
|
6328
6544
|
} | {
|
|
6329
6545
|
type?: "image";
|
|
6330
6546
|
source?: {
|
|
@@ -6338,9 +6554,10 @@ declare const validateO2AConversion: (openaiData: unknown, convertedData: unknow
|
|
|
6338
6554
|
id?: string;
|
|
6339
6555
|
input?: Record<string, unknown>;
|
|
6340
6556
|
} | {
|
|
6557
|
+
type?: "tool_result";
|
|
6341
6558
|
content?: string | ({
|
|
6342
|
-
text?: string;
|
|
6343
6559
|
type?: "text";
|
|
6560
|
+
text?: string;
|
|
6344
6561
|
} | {
|
|
6345
6562
|
type?: "image";
|
|
6346
6563
|
source?: {
|
|
@@ -6349,12 +6566,9 @@ declare const validateO2AConversion: (openaiData: unknown, convertedData: unknow
|
|
|
6349
6566
|
data?: string;
|
|
6350
6567
|
};
|
|
6351
6568
|
})[];
|
|
6352
|
-
type?: "tool_result";
|
|
6353
6569
|
tool_use_id?: string;
|
|
6354
6570
|
is_error?: boolean;
|
|
6355
6571
|
})[];
|
|
6356
|
-
type?: "message";
|
|
6357
|
-
id?: string;
|
|
6358
6572
|
model?: string;
|
|
6359
6573
|
usage?: {
|
|
6360
6574
|
input_tokens?: number;
|
|
@@ -6363,7 +6577,7 @@ declare const validateO2AConversion: (openaiData: unknown, convertedData: unknow
|
|
|
6363
6577
|
cache_read_input_tokens?: number;
|
|
6364
6578
|
};
|
|
6365
6579
|
stop_sequence?: string;
|
|
6366
|
-
stop_reason?: "
|
|
6580
|
+
stop_reason?: "max_tokens" | "tool_use" | "end_turn" | "stop_sequence";
|
|
6367
6581
|
}>;
|
|
6368
6582
|
declare const validateStreamConversion: (inputChunks: unknown[], outputEvents: unknown[], direction: "openai-to-anthropic" | "anthropic-to-openai", useHealing?: boolean) => ConversionResult<unknown[]>;
|
|
6369
6583
|
|
|
@@ -6454,16 +6668,16 @@ declare const healA2ORequest: (data: unknown, maxAttempts?: number) => Promise<H
|
|
|
6454
6668
|
user?: string;
|
|
6455
6669
|
model?: string;
|
|
6456
6670
|
messages?: {
|
|
6457
|
-
|
|
6671
|
+
name?: string;
|
|
6672
|
+
role?: "system" | "user" | "assistant" | "tool";
|
|
6458
6673
|
content?: string | {
|
|
6459
|
-
text?: string;
|
|
6460
6674
|
type?: "text" | "image_url";
|
|
6675
|
+
text?: string;
|
|
6461
6676
|
image_url?: {
|
|
6462
6677
|
url?: string;
|
|
6463
6678
|
detail?: "low" | "high" | "auto";
|
|
6464
6679
|
};
|
|
6465
6680
|
}[];
|
|
6466
|
-
name?: string;
|
|
6467
6681
|
tool_calls?: {
|
|
6468
6682
|
function?: {
|
|
6469
6683
|
name?: string;
|
|
@@ -6511,18 +6725,18 @@ declare const healA2ORequest: (data: unknown, maxAttempts?: number) => Promise<H
|
|
|
6511
6725
|
}>>;
|
|
6512
6726
|
declare const healO2ARequest: (data: unknown, maxAttempts?: number) => Promise<HealingResult<{
|
|
6513
6727
|
system?: string | {
|
|
6514
|
-
text?: string;
|
|
6515
6728
|
type?: "text";
|
|
6729
|
+
text?: string;
|
|
6516
6730
|
cache_control?: {
|
|
6517
6731
|
type?: "ephemeral";
|
|
6518
6732
|
};
|
|
6519
6733
|
}[];
|
|
6520
6734
|
model?: string;
|
|
6521
6735
|
messages?: {
|
|
6522
|
-
role?: "
|
|
6736
|
+
role?: "system" | "user" | "assistant";
|
|
6523
6737
|
content?: string | ({
|
|
6524
|
-
text?: string;
|
|
6525
6738
|
type?: "text";
|
|
6739
|
+
text?: string;
|
|
6526
6740
|
} | {
|
|
6527
6741
|
type?: "image";
|
|
6528
6742
|
source?: {
|
|
@@ -6536,9 +6750,10 @@ declare const healO2ARequest: (data: unknown, maxAttempts?: number) => Promise<H
|
|
|
6536
6750
|
id?: string;
|
|
6537
6751
|
input?: Record<string, unknown>;
|
|
6538
6752
|
} | {
|
|
6753
|
+
type?: "tool_result";
|
|
6539
6754
|
content?: string | ({
|
|
6540
|
-
text?: string;
|
|
6541
6755
|
type?: "text";
|
|
6756
|
+
text?: string;
|
|
6542
6757
|
} | {
|
|
6543
6758
|
type?: "image";
|
|
6544
6759
|
source?: {
|
|
@@ -6547,7 +6762,6 @@ declare const healO2ARequest: (data: unknown, maxAttempts?: number) => Promise<H
|
|
|
6547
6762
|
data?: string;
|
|
6548
6763
|
};
|
|
6549
6764
|
})[];
|
|
6550
|
-
type?: "tool_result";
|
|
6551
6765
|
tool_use_id?: string;
|
|
6552
6766
|
is_error?: boolean;
|
|
6553
6767
|
})[];
|
|
@@ -6582,10 +6796,12 @@ declare const healO2ARequest: (data: unknown, maxAttempts?: number) => Promise<H
|
|
|
6582
6796
|
top_k?: number;
|
|
6583
6797
|
}>>;
|
|
6584
6798
|
declare const healO2AResponse: (data: unknown, maxAttempts?: number) => Promise<HealingResult<{
|
|
6799
|
+
type?: "message";
|
|
6800
|
+
id?: string;
|
|
6585
6801
|
role?: "assistant";
|
|
6586
6802
|
content?: ({
|
|
6587
|
-
text?: string;
|
|
6588
6803
|
type?: "text";
|
|
6804
|
+
text?: string;
|
|
6589
6805
|
} | {
|
|
6590
6806
|
type?: "image";
|
|
6591
6807
|
source?: {
|
|
@@ -6599,9 +6815,10 @@ declare const healO2AResponse: (data: unknown, maxAttempts?: number) => Promise<
|
|
|
6599
6815
|
id?: string;
|
|
6600
6816
|
input?: Record<string, unknown>;
|
|
6601
6817
|
} | {
|
|
6818
|
+
type?: "tool_result";
|
|
6602
6819
|
content?: string | ({
|
|
6603
|
-
text?: string;
|
|
6604
6820
|
type?: "text";
|
|
6821
|
+
text?: string;
|
|
6605
6822
|
} | {
|
|
6606
6823
|
type?: "image";
|
|
6607
6824
|
source?: {
|
|
@@ -6610,12 +6827,9 @@ declare const healO2AResponse: (data: unknown, maxAttempts?: number) => Promise<
|
|
|
6610
6827
|
data?: string;
|
|
6611
6828
|
};
|
|
6612
6829
|
})[];
|
|
6613
|
-
type?: "tool_result";
|
|
6614
6830
|
tool_use_id?: string;
|
|
6615
6831
|
is_error?: boolean;
|
|
6616
6832
|
})[];
|
|
6617
|
-
type?: "message";
|
|
6618
|
-
id?: string;
|
|
6619
6833
|
model?: string;
|
|
6620
6834
|
usage?: {
|
|
6621
6835
|
input_tokens?: number;
|
|
@@ -6624,7 +6838,7 @@ declare const healO2AResponse: (data: unknown, maxAttempts?: number) => Promise<
|
|
|
6624
6838
|
cache_read_input_tokens?: number;
|
|
6625
6839
|
};
|
|
6626
6840
|
stop_sequence?: string;
|
|
6627
|
-
stop_reason?: "
|
|
6841
|
+
stop_reason?: "max_tokens" | "tool_use" | "end_turn" | "stop_sequence";
|
|
6628
6842
|
}>>;
|
|
6629
6843
|
|
|
6630
6844
|
/**
|
|
@@ -7155,7 +7369,7 @@ interface Logger {
|
|
|
7155
7369
|
declare function getGlobalLogger(): Logger;
|
|
7156
7370
|
|
|
7157
7371
|
/**
|
|
7158
|
-
*
|
|
7372
|
+
* ai-protocol-adapters - Universal AI Protocol Converter
|
|
7159
7373
|
* OpenAI ⇄ Anthropic with full TypeScript support
|
|
7160
7374
|
*/
|
|
7161
7375
|
|
|
@@ -7169,4 +7383,4 @@ declare const FEATURES: {
|
|
|
7169
7383
|
readonly externalPackageVerified: true;
|
|
7170
7384
|
};
|
|
7171
7385
|
|
|
7172
|
-
export { A2ORequestAdapter, A2ORequestAdapterStatic, ADAPTERS_VERSION, type AnthropicContentBlock, AnthropicContentBlockBaseSchema, AnthropicContentBlockDeltaEventSchema, AnthropicContentBlockSchema, AnthropicContentBlockStartEventSchema, AnthropicContentBlockStopEventSchema, AnthropicErrorEventSchema, type AnthropicImageContentBlock, AnthropicImageContentBlockSchema, AnthropicImageSourceSchema, type AnthropicMessage, AnthropicMessageDeltaEventSchema, AnthropicMessageSchema, AnthropicMessageStartEventSchema, AnthropicMessageStopEventSchema, AnthropicMetadataSchema, AnthropicPingEventSchema, type AnthropicRequest, AnthropicRequestSchema, type AnthropicResponse, AnthropicResponseSchema, type AnthropicSDKConfig, AnthropicSDKWrapper, type AnthropicStreamEvent, AnthropicStreamEventBaseSchema, AnthropicStreamEventSchema, AnthropicSystemMessageSchema, type AnthropicTextContentBlock, AnthropicTextContentBlockSchema, type AnthropicTool, AnthropicToolInputSchemaSchema, type AnthropicToolResultContentBlock, AnthropicToolResultContentBlockSchema, AnthropicToolSchema, type AnthropicToolUseContentBlock, AnthropicToolUseContentBlockSchema, type AnthropicUsage, AnthropicUsageSchema, type BaseSDKClient, A2ORequestAdapter as ClaudeToOpenAIConverter, type ConversionFixResult, ConversionFixer, type ConversionResult$
|
|
7386
|
+
export { A2ORequestAdapter, A2ORequestAdapterStatic, ADAPTERS_VERSION, type AnthropicContentBlock, AnthropicContentBlockBaseSchema, AnthropicContentBlockDeltaEventSchema, AnthropicContentBlockSchema, AnthropicContentBlockStartEventSchema, AnthropicContentBlockStopEventSchema, AnthropicErrorEventSchema, type AnthropicImageContentBlock, AnthropicImageContentBlockSchema, AnthropicImageSourceSchema, type AnthropicMessage, AnthropicMessageDeltaEventSchema, AnthropicMessageSchema, AnthropicMessageStartEventSchema, AnthropicMessageStopEventSchema, AnthropicMetadataSchema, AnthropicPingEventSchema, type AnthropicRequest, AnthropicRequestSchema, type AnthropicResponse, AnthropicResponseSchema, type AnthropicSDKConfig, AnthropicSDKWrapper, type AnthropicStreamEvent, AnthropicStreamEventBaseSchema, AnthropicStreamEventSchema, AnthropicSystemMessageSchema, type AnthropicTextContentBlock, AnthropicTextContentBlockSchema, type AnthropicToOpenAIChunkResult, type AnthropicTool, AnthropicToolInputSchemaSchema, type AnthropicToolResultContentBlock, AnthropicToolResultContentBlockSchema, AnthropicToolSchema, type AnthropicToolUseContentBlock, AnthropicToolUseContentBlockSchema, type AnthropicUsage, AnthropicUsageSchema, type BaseSDKClient, A2ORequestAdapter as ClaudeToOpenAIConverter, type ConversionFixResult, ConversionFixer, type ConversionResult$1 as ConversionResult, type ConversionState, ConversionValidator, type ConvertedRequest, type ConvertedResponse, EMERGENCY_HEALING_STRATEGIES, type EnhancedAdapterOptions, type EnhancedConversionResult, ErrorDetector, type ErrorInfo, ErrorRecovery, type ErrorSeverity, type ErrorType, FEATURES, FormatValidator, type HealingContext, type HealingResult, type HealingRule, StandardProtocolAdapter as NonStreamingIOConverter, O2ASSEAdapter, O2ASSEAdapterStatic, type OpenAIChoice, OpenAIChoiceSchema, OpenAIFunctionParametersSchema, OpenAIFunctionSchema, type OpenAIMessage, OpenAIMessageContentSchema, OpenAIMessageSchema, type OpenAIRequest$1 as OpenAIRequest, OpenAIRequestSchema, type OpenAIResponse$1 as OpenAIResponse, OpenAIResponseSchema, type OpenAISDKConfig, OpenAISDKWrapper, type OpenAIStreamChunk, OpenAIStreamChunkSchema, O2ASSEAdapter as OpenAIToClaudeSSEConverter, type OpenAITool, type OpenAIToolCall, OpenAIToolCallSchema, OpenAIToolSchema, type OpenAIUsage, OpenAIUsageSchema, ProtocolHealer, RECOVERY_STRATEGIES, REQUEST_HEALING_STRATEGIES, RESPONSE_HEALING_STRATEGIES, type RecoveryResult, type RecoveryStrategy, type RequestOptions, type SDKConfig, SDKFactory, type SDKProvider, type SDKResponse, type SDKStreamEvent, SSEEventGenerator, STREAM_HEALING_STRATEGIES, type ConversionResult as SchemaConversionResult, StandardProtocolAdapter as StandardGateway, StandardProtocolAdapter, type StandardProtocolAdapterOptions, StreamingProtocolAdapter as StreamingGateway, StreamingProtocolAdapter as StreamingIOConverter, StreamingProtocolAdapter, type StreamingProtocolAdapterOptions, type UnifiedSDKConfig, type ValidationResult, attemptRecovery, conversionValidator, createAnthropicSDK, createOpenAISDK, createValidator, downloadImageAsBase64, errorRecovery, getAllHealingStrategies, getGlobalLogger, getRecoveryRecommendations, getStrategiesForContext, healA2ORequest, healO2ARequest, healO2AResponse, healingValidate, isBase64DataUri, isExternalUrl, isRecoverable, protocolHealer, safeValidate, sdkFactory, selectSDKByModel, strictValidate, validateA2OConversion, validateAnthropicRequest, validateAnthropicResponse, validateAnthropicStreamEvent, validateBatch, validateO2AConversion, validateOpenAIRequest, validateOpenAIResponse, validateOpenAIStreamChunk, validateSDKConfig, validateStreamConversion };
|