@adaline/anthropic 0.7.0

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.
@@ -0,0 +1,994 @@
1
+ import * as zod from 'zod';
2
+ import { z } from 'zod';
3
+ import { ChatModelSchemaType, ChatModelV1, UrlType, HeadersType, ParamsType, EmbeddingModelSchemaType, EmbeddingModelV1, ProviderV1 } from '@adaline/provider';
4
+ import { MessageType, ConfigType, ToolType, ChatResponseType, PartialChatResponseType, EmbeddingRequestsType, EmbeddingResponseType } from '@adaline/types';
5
+
6
+ declare const ChatModelBaseConfigSchema: (maxOutputTokens: number, maxSequences: number) => z.ZodObject<{
7
+ temperature: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
8
+ maxTokens: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
9
+ stop: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString, "many">>>;
10
+ topP: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
11
+ topK: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
12
+ toolChoice: z.ZodOptional<z.ZodDefault<z.ZodEnum<[string, ...string[]]>>>;
13
+ }, "strip", z.ZodTypeAny, {
14
+ temperature?: number | undefined;
15
+ maxTokens?: number | undefined;
16
+ stop?: string[] | undefined;
17
+ topP?: number | undefined;
18
+ topK?: number | undefined;
19
+ toolChoice?: string | undefined;
20
+ }, {
21
+ temperature?: number | undefined;
22
+ maxTokens?: number | undefined;
23
+ stop?: string[] | undefined;
24
+ topP?: number | undefined;
25
+ topK?: number | undefined;
26
+ toolChoice?: string | undefined;
27
+ }>;
28
+ declare const ChatModelBaseConfigDef: (maxOutputTokens: number, maxSequences: number) => {
29
+ readonly temperature: {
30
+ type: "range";
31
+ param: string;
32
+ title: string;
33
+ description: string;
34
+ max: number;
35
+ min: number;
36
+ step: number;
37
+ default: number;
38
+ };
39
+ readonly maxTokens: {
40
+ type: "range";
41
+ param: string;
42
+ title: string;
43
+ description: string;
44
+ max: number;
45
+ min: number;
46
+ step: number;
47
+ default: number;
48
+ };
49
+ readonly stop: {
50
+ type: "multi-string";
51
+ param: string;
52
+ title: string;
53
+ description: string;
54
+ max: number;
55
+ };
56
+ readonly topP: {
57
+ type: "range";
58
+ param: string;
59
+ title: string;
60
+ description: string;
61
+ max: number;
62
+ min: number;
63
+ step: number;
64
+ default: number;
65
+ };
66
+ readonly topK: {
67
+ type: "range";
68
+ param: string;
69
+ title: string;
70
+ description: string;
71
+ max: number;
72
+ min: number;
73
+ step: number;
74
+ default: number;
75
+ };
76
+ readonly toolChoice: {
77
+ type: "select-string";
78
+ param: string;
79
+ title: string;
80
+ description: string;
81
+ default: string;
82
+ choices: string[];
83
+ };
84
+ };
85
+
86
+ declare const temperature: {
87
+ def: {
88
+ type: "range";
89
+ param: string;
90
+ title: string;
91
+ description: string;
92
+ max: number;
93
+ min: number;
94
+ step: number;
95
+ default: number;
96
+ };
97
+ schema: zod.ZodOptional<zod.ZodDefault<zod.ZodNumber>>;
98
+ };
99
+ declare const maxTokens: (maxOutputTokens: number) => {
100
+ def: {
101
+ type: "range";
102
+ param: string;
103
+ title: string;
104
+ description: string;
105
+ max: number;
106
+ min: number;
107
+ step: number;
108
+ default: number;
109
+ };
110
+ schema: zod.ZodOptional<zod.ZodDefault<zod.ZodNumber>>;
111
+ };
112
+ declare const stop: (maxSequences: number) => {
113
+ def: {
114
+ type: "multi-string";
115
+ param: string;
116
+ title: string;
117
+ description: string;
118
+ max: number;
119
+ };
120
+ schema: zod.ZodOptional<zod.ZodDefault<zod.ZodArray<zod.ZodString, "many">>>;
121
+ };
122
+ declare const topP: {
123
+ def: {
124
+ type: "range";
125
+ param: string;
126
+ title: string;
127
+ description: string;
128
+ max: number;
129
+ min: number;
130
+ step: number;
131
+ default: number;
132
+ };
133
+ schema: zod.ZodOptional<zod.ZodDefault<zod.ZodNumber>>;
134
+ };
135
+ declare const topK: {
136
+ def: {
137
+ type: "range";
138
+ param: string;
139
+ title: string;
140
+ description: string;
141
+ max: number;
142
+ min: number;
143
+ step: number;
144
+ default: number;
145
+ };
146
+ schema: zod.ZodOptional<zod.ZodDefault<zod.ZodNumber>>;
147
+ };
148
+ declare const toolChoice: {
149
+ def: {
150
+ type: "select-string";
151
+ param: string;
152
+ title: string;
153
+ description: string;
154
+ default: string;
155
+ choices: string[];
156
+ };
157
+ schema: zod.ZodOptional<zod.ZodDefault<zod.ZodEnum<[string, ...string[]]>>>;
158
+ };
159
+
160
+ declare const ChatModelAnthropicConfigs: {
161
+ readonly base: (maxOutputTokens: number, maxSequences: number) => {
162
+ def: {
163
+ readonly temperature: {
164
+ type: "range";
165
+ param: string;
166
+ title: string;
167
+ description: string;
168
+ max: number;
169
+ min: number;
170
+ step: number;
171
+ default: number;
172
+ };
173
+ readonly maxTokens: {
174
+ type: "range";
175
+ param: string;
176
+ title: string;
177
+ description: string;
178
+ max: number;
179
+ min: number;
180
+ step: number;
181
+ default: number;
182
+ };
183
+ readonly stop: {
184
+ type: "multi-string";
185
+ param: string;
186
+ title: string;
187
+ description: string;
188
+ max: number;
189
+ };
190
+ readonly topP: {
191
+ type: "range";
192
+ param: string;
193
+ title: string;
194
+ description: string;
195
+ max: number;
196
+ min: number;
197
+ step: number;
198
+ default: number;
199
+ };
200
+ readonly topK: {
201
+ type: "range";
202
+ param: string;
203
+ title: string;
204
+ description: string;
205
+ max: number;
206
+ min: number;
207
+ step: number;
208
+ default: number;
209
+ };
210
+ readonly toolChoice: {
211
+ type: "select-string";
212
+ param: string;
213
+ title: string;
214
+ description: string;
215
+ default: string;
216
+ choices: string[];
217
+ };
218
+ };
219
+ schema: zod.ZodObject<{
220
+ temperature: zod.ZodOptional<zod.ZodDefault<zod.ZodNumber>>;
221
+ maxTokens: zod.ZodOptional<zod.ZodDefault<zod.ZodNumber>>;
222
+ stop: zod.ZodOptional<zod.ZodDefault<zod.ZodArray<zod.ZodString, "many">>>;
223
+ topP: zod.ZodOptional<zod.ZodDefault<zod.ZodNumber>>;
224
+ topK: zod.ZodOptional<zod.ZodDefault<zod.ZodNumber>>;
225
+ toolChoice: zod.ZodOptional<zod.ZodDefault<zod.ZodEnum<[string, ...string[]]>>>;
226
+ }, "strip", zod.ZodTypeAny, {
227
+ temperature?: number | undefined;
228
+ maxTokens?: number | undefined;
229
+ stop?: string[] | undefined;
230
+ topP?: number | undefined;
231
+ topK?: number | undefined;
232
+ toolChoice?: string | undefined;
233
+ }, {
234
+ temperature?: number | undefined;
235
+ maxTokens?: number | undefined;
236
+ stop?: string[] | undefined;
237
+ topP?: number | undefined;
238
+ topK?: number | undefined;
239
+ toolChoice?: string | undefined;
240
+ }>;
241
+ };
242
+ };
243
+ declare const EmbeddingModelAnthropicConfigs: {
244
+ readonly base: () => {
245
+ def: {
246
+ encodingFormat: {
247
+ type: "select-string";
248
+ param: string;
249
+ title: string;
250
+ description: string;
251
+ default: string;
252
+ choices: string[];
253
+ };
254
+ inputType: {
255
+ type: "select-string";
256
+ param: string;
257
+ title: string;
258
+ description: string;
259
+ default: string;
260
+ choices: string[];
261
+ };
262
+ truncation: {
263
+ type: "select-string";
264
+ param: string;
265
+ title: string;
266
+ description: string;
267
+ default: string;
268
+ choices: string[];
269
+ };
270
+ };
271
+ schema: zod.ZodObject<{
272
+ encodingFormat: zod.ZodOptional<zod.ZodDefault<zod.ZodEnum<[string, ...string[]]>>>;
273
+ inputType: zod.ZodOptional<zod.ZodDefault<zod.ZodEnum<[string, ...string[]]>>>;
274
+ truncation: zod.ZodOptional<zod.ZodDefault<zod.ZodEnum<[string, ...string[]]>>>;
275
+ }, "strip", zod.ZodTypeAny, {
276
+ truncation?: string | undefined;
277
+ encodingFormat?: string | undefined;
278
+ inputType?: string | undefined;
279
+ }, {
280
+ truncation?: string | undefined;
281
+ encodingFormat?: string | undefined;
282
+ inputType?: string | undefined;
283
+ }>;
284
+ };
285
+ };
286
+
287
+ declare const EmbeddingModelBaseConfigSchema: () => z.ZodObject<{
288
+ encodingFormat: z.ZodOptional<z.ZodDefault<z.ZodEnum<[string, ...string[]]>>>;
289
+ inputType: z.ZodOptional<z.ZodDefault<z.ZodEnum<[string, ...string[]]>>>;
290
+ truncation: z.ZodOptional<z.ZodDefault<z.ZodEnum<[string, ...string[]]>>>;
291
+ }, "strip", z.ZodTypeAny, {
292
+ truncation?: string | undefined;
293
+ encodingFormat?: string | undefined;
294
+ inputType?: string | undefined;
295
+ }, {
296
+ truncation?: string | undefined;
297
+ encodingFormat?: string | undefined;
298
+ inputType?: string | undefined;
299
+ }>;
300
+ declare const EmbeddingModelBaseConfigDef: () => {
301
+ encodingFormat: {
302
+ type: "select-string";
303
+ param: string;
304
+ title: string;
305
+ description: string;
306
+ default: string;
307
+ choices: string[];
308
+ };
309
+ inputType: {
310
+ type: "select-string";
311
+ param: string;
312
+ title: string;
313
+ description: string;
314
+ default: string;
315
+ choices: string[];
316
+ };
317
+ truncation: {
318
+ type: "select-string";
319
+ param: string;
320
+ title: string;
321
+ description: string;
322
+ default: string;
323
+ choices: string[];
324
+ };
325
+ };
326
+
327
+ declare const encodingFormat: {
328
+ def: {
329
+ type: "select-string";
330
+ param: string;
331
+ title: string;
332
+ description: string;
333
+ default: string;
334
+ choices: string[];
335
+ };
336
+ schema: zod.ZodOptional<zod.ZodDefault<zod.ZodEnum<[string, ...string[]]>>>;
337
+ };
338
+ declare const inputType: {
339
+ def: {
340
+ type: "select-string";
341
+ param: string;
342
+ title: string;
343
+ description: string;
344
+ default: string;
345
+ choices: string[];
346
+ };
347
+ schema: zod.ZodOptional<zod.ZodDefault<zod.ZodEnum<[string, ...string[]]>>>;
348
+ };
349
+ declare const truncation: {
350
+ def: {
351
+ type: "select-string";
352
+ param: string;
353
+ title: string;
354
+ description: string;
355
+ default: string;
356
+ choices: string[];
357
+ };
358
+ schema: zod.ZodOptional<zod.ZodDefault<zod.ZodEnum<[string, ...string[]]>>>;
359
+ };
360
+
361
+ declare const AnthropicChatModelRoles: z.ZodEnum<["system", "user", "assistant"]>;
362
+ declare const AnthropicChatModelRolesMap: {
363
+ readonly system: "system";
364
+ readonly user: "user";
365
+ readonly assistant: "assistant";
366
+ };
367
+
368
+ declare const AnthropicChatModelModalities: ChatModelSchemaType["modalities"];
369
+ declare const AnthropicChatModelModalitiesEnum: z.ZodEnum<["text", "image", "tool-call", "tool-response"]>;
370
+
371
+ declare const AnthropicCompleteChatResponse: z.ZodObject<{
372
+ content: z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
373
+ type: z.ZodLiteral<"text">;
374
+ text: z.ZodString;
375
+ }, "strip", z.ZodTypeAny, {
376
+ type: "text";
377
+ text: string;
378
+ }, {
379
+ type: "text";
380
+ text: string;
381
+ }>, z.ZodObject<{
382
+ type: z.ZodLiteral<"tool_use">;
383
+ id: z.ZodString;
384
+ name: z.ZodString;
385
+ input: z.ZodRecord<z.ZodString, z.ZodAny>;
386
+ }, "strip", z.ZodTypeAny, {
387
+ type: "tool_use";
388
+ name: string;
389
+ id: string;
390
+ input: Record<string, any>;
391
+ }, {
392
+ type: "tool_use";
393
+ name: string;
394
+ id: string;
395
+ input: Record<string, any>;
396
+ }>]>, "many">;
397
+ id: z.ZodString;
398
+ model: z.ZodString;
399
+ role: z.ZodString;
400
+ stop_reason: z.ZodString;
401
+ stop_sequence: z.ZodNull;
402
+ type: z.ZodLiteral<"message">;
403
+ usage: z.ZodObject<{
404
+ input_tokens: z.ZodNumber;
405
+ output_tokens: z.ZodNumber;
406
+ cache_creation_input_tokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
407
+ cache_read_input_tokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
408
+ }, "strip", z.ZodTypeAny, {
409
+ input_tokens: number;
410
+ output_tokens: number;
411
+ cache_creation_input_tokens?: number | null | undefined;
412
+ cache_read_input_tokens?: number | null | undefined;
413
+ }, {
414
+ input_tokens: number;
415
+ output_tokens: number;
416
+ cache_creation_input_tokens?: number | null | undefined;
417
+ cache_read_input_tokens?: number | null | undefined;
418
+ }>;
419
+ }, "strip", z.ZodTypeAny, {
420
+ type: "message";
421
+ id: string;
422
+ content: ({
423
+ type: "text";
424
+ text: string;
425
+ } | {
426
+ type: "tool_use";
427
+ name: string;
428
+ id: string;
429
+ input: Record<string, any>;
430
+ })[];
431
+ model: string;
432
+ role: string;
433
+ stop_reason: string;
434
+ stop_sequence: null;
435
+ usage: {
436
+ input_tokens: number;
437
+ output_tokens: number;
438
+ cache_creation_input_tokens?: number | null | undefined;
439
+ cache_read_input_tokens?: number | null | undefined;
440
+ };
441
+ }, {
442
+ type: "message";
443
+ id: string;
444
+ content: ({
445
+ type: "text";
446
+ text: string;
447
+ } | {
448
+ type: "tool_use";
449
+ name: string;
450
+ id: string;
451
+ input: Record<string, any>;
452
+ })[];
453
+ model: string;
454
+ role: string;
455
+ stop_reason: string;
456
+ stop_sequence: null;
457
+ usage: {
458
+ input_tokens: number;
459
+ output_tokens: number;
460
+ cache_creation_input_tokens?: number | null | undefined;
461
+ cache_read_input_tokens?: number | null | undefined;
462
+ };
463
+ }>;
464
+ type AnthropicCompleteChatResponseType = z.infer<typeof AnthropicCompleteChatResponse>;
465
+ declare const AnthropicStreamChatMessageStartResponse: z.ZodObject<{
466
+ type: z.ZodLiteral<"message_start">;
467
+ message: z.ZodObject<{
468
+ id: z.ZodString;
469
+ type: z.ZodLiteral<"message">;
470
+ role: z.ZodString;
471
+ model: z.ZodString;
472
+ stop_reason: z.ZodNullable<z.ZodString>;
473
+ stop_sequence: z.ZodNullable<z.ZodString>;
474
+ content: z.ZodArray<z.ZodAny, "many">;
475
+ usage: z.ZodObject<{
476
+ input_tokens: z.ZodNumber;
477
+ output_tokens: z.ZodNumber;
478
+ }, "strip", z.ZodTypeAny, {
479
+ input_tokens: number;
480
+ output_tokens: number;
481
+ }, {
482
+ input_tokens: number;
483
+ output_tokens: number;
484
+ }>;
485
+ }, "strip", z.ZodTypeAny, {
486
+ type: "message";
487
+ id: string;
488
+ content: any[];
489
+ model: string;
490
+ role: string;
491
+ stop_reason: string | null;
492
+ stop_sequence: string | null;
493
+ usage: {
494
+ input_tokens: number;
495
+ output_tokens: number;
496
+ };
497
+ }, {
498
+ type: "message";
499
+ id: string;
500
+ content: any[];
501
+ model: string;
502
+ role: string;
503
+ stop_reason: string | null;
504
+ stop_sequence: string | null;
505
+ usage: {
506
+ input_tokens: number;
507
+ output_tokens: number;
508
+ };
509
+ }>;
510
+ }, "strip", z.ZodTypeAny, {
511
+ type: "message_start";
512
+ message: {
513
+ type: "message";
514
+ id: string;
515
+ content: any[];
516
+ model: string;
517
+ role: string;
518
+ stop_reason: string | null;
519
+ stop_sequence: string | null;
520
+ usage: {
521
+ input_tokens: number;
522
+ output_tokens: number;
523
+ };
524
+ };
525
+ }, {
526
+ type: "message_start";
527
+ message: {
528
+ type: "message";
529
+ id: string;
530
+ content: any[];
531
+ model: string;
532
+ role: string;
533
+ stop_reason: string | null;
534
+ stop_sequence: string | null;
535
+ usage: {
536
+ input_tokens: number;
537
+ output_tokens: number;
538
+ };
539
+ };
540
+ }>;
541
+ declare const AnthropicStreamChatMessageDeltaResponse: z.ZodObject<{
542
+ type: z.ZodLiteral<"message_delta">;
543
+ delta: z.ZodObject<{
544
+ stop_reason: z.ZodNullable<z.ZodString>;
545
+ stop_sequence: z.ZodNullable<z.ZodString>;
546
+ }, "strip", z.ZodTypeAny, {
547
+ stop_reason: string | null;
548
+ stop_sequence: string | null;
549
+ }, {
550
+ stop_reason: string | null;
551
+ stop_sequence: string | null;
552
+ }>;
553
+ usage: z.ZodObject<{
554
+ output_tokens: z.ZodNumber;
555
+ }, "strip", z.ZodTypeAny, {
556
+ output_tokens: number;
557
+ }, {
558
+ output_tokens: number;
559
+ }>;
560
+ }, "strip", z.ZodTypeAny, {
561
+ type: "message_delta";
562
+ usage: {
563
+ output_tokens: number;
564
+ };
565
+ delta: {
566
+ stop_reason: string | null;
567
+ stop_sequence: string | null;
568
+ };
569
+ }, {
570
+ type: "message_delta";
571
+ usage: {
572
+ output_tokens: number;
573
+ };
574
+ delta: {
575
+ stop_reason: string | null;
576
+ stop_sequence: string | null;
577
+ };
578
+ }>;
579
+ declare const AnthropicStreamChatContentBlockStartResponse: z.ZodObject<{
580
+ type: z.ZodLiteral<"content_block_start">;
581
+ index: z.ZodNumber;
582
+ content_block: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
583
+ type: z.ZodLiteral<"text">;
584
+ text: z.ZodString;
585
+ }, "strip", z.ZodTypeAny, {
586
+ type: "text";
587
+ text: string;
588
+ }, {
589
+ type: "text";
590
+ text: string;
591
+ }>, z.ZodObject<{
592
+ type: z.ZodLiteral<"tool_use">;
593
+ id: z.ZodString;
594
+ name: z.ZodString;
595
+ input: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
596
+ }, "strip", z.ZodTypeAny, {
597
+ type: "tool_use";
598
+ name: string;
599
+ id: string;
600
+ input: {};
601
+ }, {
602
+ type: "tool_use";
603
+ name: string;
604
+ id: string;
605
+ input: {};
606
+ }>]>;
607
+ }, "strip", z.ZodTypeAny, {
608
+ type: "content_block_start";
609
+ index: number;
610
+ content_block: {
611
+ type: "text";
612
+ text: string;
613
+ } | {
614
+ type: "tool_use";
615
+ name: string;
616
+ id: string;
617
+ input: {};
618
+ };
619
+ }, {
620
+ type: "content_block_start";
621
+ index: number;
622
+ content_block: {
623
+ type: "text";
624
+ text: string;
625
+ } | {
626
+ type: "tool_use";
627
+ name: string;
628
+ id: string;
629
+ input: {};
630
+ };
631
+ }>;
632
+ declare const AnthropicStreamChatContentBlockDeltaResponse: z.ZodObject<{
633
+ type: z.ZodLiteral<"content_block_delta">;
634
+ index: z.ZodNumber;
635
+ delta: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
636
+ type: z.ZodLiteral<"text_delta">;
637
+ text: z.ZodString;
638
+ }, "strip", z.ZodTypeAny, {
639
+ type: "text_delta";
640
+ text: string;
641
+ }, {
642
+ type: "text_delta";
643
+ text: string;
644
+ }>, z.ZodObject<{
645
+ type: z.ZodLiteral<"input_json_delta">;
646
+ partial_json: z.ZodString;
647
+ }, "strip", z.ZodTypeAny, {
648
+ type: "input_json_delta";
649
+ partial_json: string;
650
+ }, {
651
+ type: "input_json_delta";
652
+ partial_json: string;
653
+ }>]>;
654
+ }, "strip", z.ZodTypeAny, {
655
+ type: "content_block_delta";
656
+ delta: {
657
+ type: "text_delta";
658
+ text: string;
659
+ } | {
660
+ type: "input_json_delta";
661
+ partial_json: string;
662
+ };
663
+ index: number;
664
+ }, {
665
+ type: "content_block_delta";
666
+ delta: {
667
+ type: "text_delta";
668
+ text: string;
669
+ } | {
670
+ type: "input_json_delta";
671
+ partial_json: string;
672
+ };
673
+ index: number;
674
+ }>;
675
+
676
+ declare const BaseChatModelOptions: z.ZodObject<{
677
+ apiKey: z.ZodString;
678
+ baseUrl: z.ZodString;
679
+ completeChatUrl: z.ZodOptional<z.ZodString>;
680
+ streamChatUrl: z.ZodOptional<z.ZodString>;
681
+ }, "strip", z.ZodTypeAny, {
682
+ apiKey: string;
683
+ baseUrl: string;
684
+ completeChatUrl?: string | undefined;
685
+ streamChatUrl?: string | undefined;
686
+ }, {
687
+ apiKey: string;
688
+ baseUrl: string;
689
+ completeChatUrl?: string | undefined;
690
+ streamChatUrl?: string | undefined;
691
+ }>;
692
+ type BaseChatModelOptionsType = z.infer<typeof BaseChatModelOptions>;
693
+ declare class BaseChatModel implements ChatModelV1<ChatModelSchemaType> {
694
+ readonly version: "v1";
695
+ modelSchema: ChatModelSchemaType;
696
+ private readonly apiKey;
697
+ private readonly baseUrl;
698
+ private readonly completeChatUrl;
699
+ private readonly streamChatUrl;
700
+ constructor(modelSchema: ChatModelSchemaType, options: BaseChatModelOptionsType);
701
+ getDefaultBaseUrl(): UrlType;
702
+ getDefaultHeaders(): HeadersType;
703
+ getDefaultParams(): ParamsType;
704
+ getRetryDelay(responseHeaders: HeadersType): {
705
+ shouldRetry: boolean;
706
+ delayMs: number;
707
+ };
708
+ getTokenCount(messages: MessageType[]): number;
709
+ transformModelRequest(request: any): {
710
+ modelName: string | undefined;
711
+ config: ConfigType | undefined;
712
+ messages: MessageType[] | undefined;
713
+ tools: ToolType[] | undefined;
714
+ };
715
+ transformConfig(config: ConfigType, messages?: MessageType[], tools?: ToolType[]): ParamsType;
716
+ transformMessages(messages: MessageType[]): ParamsType;
717
+ transformTools(tools: ToolType[]): ParamsType;
718
+ getCompleteChatUrl(config?: ConfigType, messages?: MessageType[], tools?: ToolType[]): Promise<UrlType>;
719
+ getCompleteChatHeaders(config?: ConfigType, messages?: MessageType[], tools?: ToolType[]): Promise<HeadersType>;
720
+ getCompleteChatData(config: ConfigType, messages: MessageType[], tools?: ToolType[]): Promise<ParamsType>;
721
+ transformCompleteChatResponse(response: any): ChatResponseType;
722
+ getStreamChatUrl(config?: ConfigType, messages?: MessageType[], tools?: ToolType[]): Promise<UrlType>;
723
+ getStreamChatHeaders(config?: ConfigType, messages?: MessageType[], tools?: ToolType[]): Promise<HeadersType>;
724
+ getStreamChatData(config: ConfigType, messages: MessageType[], tools?: ToolType[]): Promise<ParamsType>;
725
+ transformStreamChatResponseChunk(chunk: string, buffer: string): AsyncGenerator<{
726
+ partialResponse: PartialChatResponseType;
727
+ buffer: string;
728
+ }>;
729
+ }
730
+
731
+ declare const Claude3Haiku20240307Schema: {
732
+ description: string;
733
+ name: string;
734
+ roles: Partial<Record<"system" | "user" | "assistant", string | undefined>>;
735
+ modalities: ["text" | "image" | "tool-call" | "tool-response", ...("text" | "image" | "tool-call" | "tool-response")[]];
736
+ maxInputTokens: number;
737
+ maxOutputTokens: number;
738
+ config: {
739
+ def: Record<string, {
740
+ type: "multi-string";
741
+ param: string;
742
+ title: string;
743
+ description: string;
744
+ max: number;
745
+ } | {
746
+ type: "range";
747
+ param: string;
748
+ title: string;
749
+ description: string;
750
+ max: number;
751
+ min: number;
752
+ step: number;
753
+ default: number;
754
+ } | {
755
+ type: "select-string";
756
+ param: string;
757
+ title: string;
758
+ description: string;
759
+ default: string;
760
+ choices: string[];
761
+ } | {
762
+ type: "object-schema";
763
+ param: string;
764
+ title: string;
765
+ description: string;
766
+ objectSchema?: any;
767
+ } | {
768
+ type: "select-boolean";
769
+ param: string;
770
+ title: string;
771
+ description: string;
772
+ default: boolean | null;
773
+ }>;
774
+ schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
775
+ };
776
+ };
777
+ declare const Claude3Haiku20240307Options: z.ZodObject<{
778
+ apiKey: z.ZodString;
779
+ baseUrl: z.ZodString;
780
+ completeChatUrl: z.ZodOptional<z.ZodString>;
781
+ streamChatUrl: z.ZodOptional<z.ZodString>;
782
+ }, "strip", z.ZodTypeAny, {
783
+ apiKey: string;
784
+ baseUrl: string;
785
+ completeChatUrl?: string | undefined;
786
+ streamChatUrl?: string | undefined;
787
+ }, {
788
+ apiKey: string;
789
+ baseUrl: string;
790
+ completeChatUrl?: string | undefined;
791
+ streamChatUrl?: string | undefined;
792
+ }>;
793
+ type Claude3Haiku20240307OptionsType = z.infer<typeof Claude3Haiku20240307Options>;
794
+ declare class Claude3Haiku20240307 extends BaseChatModel {
795
+ constructor(options: Claude3Haiku20240307OptionsType);
796
+ }
797
+
798
+ declare const AnthropicEmbeddingModelModalities: EmbeddingModelSchemaType["modalities"];
799
+ declare const AnthropicEmbeddingModelModalitiesEnum: z.ZodEnum<["text"]>;
800
+
801
+ declare const AnthropicGetEmbeddingsResponse: z.ZodObject<{
802
+ object: z.ZodLiteral<"list">;
803
+ model: z.ZodString;
804
+ data: z.ZodArray<z.ZodObject<{
805
+ index: z.ZodNumber;
806
+ object: z.ZodLiteral<"embedding">;
807
+ embedding: z.ZodUnion<[z.ZodArray<z.ZodNumber, "many">, z.ZodString]>;
808
+ }, "strip", z.ZodTypeAny, {
809
+ object: "embedding";
810
+ index: number;
811
+ embedding: string | number[];
812
+ }, {
813
+ object: "embedding";
814
+ index: number;
815
+ embedding: string | number[];
816
+ }>, "many">;
817
+ usage: z.ZodObject<{
818
+ total_tokens: z.ZodNumber;
819
+ }, "strip", z.ZodTypeAny, {
820
+ total_tokens: number;
821
+ }, {
822
+ total_tokens: number;
823
+ }>;
824
+ }, "strip", z.ZodTypeAny, {
825
+ object: "list";
826
+ model: string;
827
+ usage: {
828
+ total_tokens: number;
829
+ };
830
+ data: {
831
+ object: "embedding";
832
+ index: number;
833
+ embedding: string | number[];
834
+ }[];
835
+ }, {
836
+ object: "list";
837
+ model: string;
838
+ usage: {
839
+ total_tokens: number;
840
+ };
841
+ data: {
842
+ object: "embedding";
843
+ index: number;
844
+ embedding: string | number[];
845
+ }[];
846
+ }>;
847
+
848
+ declare const AnthropicEmbeddingRequestInput: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>;
849
+ type AnthropicEmbeddingRequestInputType = z.infer<typeof AnthropicEmbeddingRequestInput>;
850
+ declare const AnthropicEmbeddingRequest: z.ZodObject<{
851
+ model: z.ZodOptional<z.ZodString>;
852
+ input: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
853
+ encoding_format: z.ZodOptional<z.ZodNullable<z.ZodEnum<["base64"]>>>;
854
+ input_type: z.ZodOptional<z.ZodNullable<z.ZodEnum<["query", "document"]>>>;
855
+ truncation: z.ZodOptional<z.ZodBoolean>;
856
+ }, "strip", z.ZodTypeAny, {
857
+ encoding_format?: "base64" | null | undefined;
858
+ input_type?: "query" | "document" | null | undefined;
859
+ truncation?: boolean | undefined;
860
+ input?: string | string[] | undefined;
861
+ model?: string | undefined;
862
+ }, {
863
+ encoding_format?: "base64" | null | undefined;
864
+ input_type?: "query" | "document" | null | undefined;
865
+ truncation?: boolean | undefined;
866
+ input?: string | string[] | undefined;
867
+ model?: string | undefined;
868
+ }>;
869
+ type AnthropicEmbeddingRequestType = z.infer<typeof AnthropicEmbeddingRequest>;
870
+
871
+ declare const BaseEmbeddingModelOptions: z.ZodObject<{
872
+ apiKey: z.ZodString;
873
+ baseUrl: z.ZodString;
874
+ getEmbeddingsUrl: z.ZodOptional<z.ZodString>;
875
+ }, "strip", z.ZodTypeAny, {
876
+ apiKey: string;
877
+ baseUrl: string;
878
+ getEmbeddingsUrl?: string | undefined;
879
+ }, {
880
+ apiKey: string;
881
+ baseUrl: string;
882
+ getEmbeddingsUrl?: string | undefined;
883
+ }>;
884
+ type BaseEmbeddingModelOptionsType = z.infer<typeof BaseEmbeddingModelOptions>;
885
+ declare class BaseEmbeddingModel implements EmbeddingModelV1<EmbeddingModelSchemaType> {
886
+ readonly version: "v1";
887
+ modelSchema: EmbeddingModelSchemaType;
888
+ private readonly apiKey;
889
+ private readonly baseUrl;
890
+ private readonly getEmbeddingsUrl;
891
+ constructor(modelSchema: EmbeddingModelSchemaType, options: BaseEmbeddingModelOptionsType);
892
+ getDefaultBaseUrl(): UrlType;
893
+ getDefaultHeaders(): HeadersType;
894
+ getDefaultParams(): ParamsType;
895
+ getTokenCount(requests: EmbeddingRequestsType): number;
896
+ getRetryDelay(responseHeaders: HeadersType): {
897
+ shouldRetry: boolean;
898
+ delayMs: number;
899
+ };
900
+ transformModelRequest(request: any): {
901
+ modelName: string | undefined;
902
+ config: ConfigType | undefined;
903
+ embeddingRequests: EmbeddingRequestsType | undefined;
904
+ };
905
+ transformConfig(config: ConfigType, requests?: EmbeddingRequestsType): ParamsType;
906
+ transformEmbeddingRequests(requests: EmbeddingRequestsType): ParamsType;
907
+ getGetEmbeddingsUrl(config?: ConfigType, requests?: EmbeddingRequestsType): Promise<UrlType>;
908
+ getGetEmbeddingsHeaders(config?: ConfigType, requests?: EmbeddingRequestsType): Promise<HeadersType>;
909
+ getGetEmbeddingsData(config: ConfigType, requests: EmbeddingRequestsType): Promise<ParamsType>;
910
+ transformGetEmbeddingsResponse(response: any): EmbeddingResponseType;
911
+ }
912
+
913
+ declare const Voyage2Schema: {
914
+ description: string;
915
+ name: string;
916
+ modalities: ["text", ..."text"[]];
917
+ maxInputTokens: number;
918
+ maxOutputTokens: number;
919
+ config: {
920
+ def: Record<string, {
921
+ type: "multi-string";
922
+ param: string;
923
+ title: string;
924
+ description: string;
925
+ max: number;
926
+ } | {
927
+ type: "range";
928
+ param: string;
929
+ title: string;
930
+ description: string;
931
+ max: number;
932
+ min: number;
933
+ step: number;
934
+ default: number;
935
+ } | {
936
+ type: "select-string";
937
+ param: string;
938
+ title: string;
939
+ description: string;
940
+ default: string;
941
+ choices: string[];
942
+ } | {
943
+ type: "object-schema";
944
+ param: string;
945
+ title: string;
946
+ description: string;
947
+ objectSchema?: any;
948
+ } | {
949
+ type: "select-boolean";
950
+ param: string;
951
+ title: string;
952
+ description: string;
953
+ default: boolean | null;
954
+ }>;
955
+ schema: z.ZodObject<z.ZodRawShape, z.UnknownKeysParam, z.ZodTypeAny, unknown, unknown>;
956
+ };
957
+ };
958
+ declare const Voyage2Options: z.ZodObject<{
959
+ apiKey: z.ZodString;
960
+ baseUrl: z.ZodString;
961
+ getEmbeddingsUrl: z.ZodOptional<z.ZodString>;
962
+ }, "strip", z.ZodTypeAny, {
963
+ apiKey: string;
964
+ baseUrl: string;
965
+ getEmbeddingsUrl?: string | undefined;
966
+ }, {
967
+ apiKey: string;
968
+ baseUrl: string;
969
+ getEmbeddingsUrl?: string | undefined;
970
+ }>;
971
+ type Voyage2OptionsType = z.infer<typeof Voyage2Options>;
972
+ declare class Voyage2 extends BaseEmbeddingModel {
973
+ constructor(options: Voyage2OptionsType);
974
+ }
975
+
976
+ declare const ProviderLiteral = "anthropic";
977
+ declare class Anthropic<O extends Record<string, any> = Record<string, any>> implements ProviderV1<O> {
978
+ readonly version: "v1";
979
+ readonly name = "anthropic";
980
+ private readonly chatBaseUrl;
981
+ private readonly embeddingBaseUrl;
982
+ private readonly chatModelFactories;
983
+ private readonly embeddingModelFactories;
984
+ chatModelLiterals(): string[];
985
+ chatModel(name: string, options: O): ChatModelV1;
986
+ chatModelSchema(name: string): ChatModelSchemaType;
987
+ chatModelSchemas(): Record<string, ChatModelSchemaType>;
988
+ embeddingModelLiterals(): string[];
989
+ embeddingModel(name: string, options: O): EmbeddingModelV1;
990
+ embeddingModelSchema(name: string): EmbeddingModelSchemaType;
991
+ embeddingModelSchemas(): Record<string, EmbeddingModelSchemaType>;
992
+ }
993
+
994
+ export { Anthropic, AnthropicChatModelModalities, AnthropicChatModelModalitiesEnum, AnthropicChatModelRoles, AnthropicChatModelRolesMap, AnthropicCompleteChatResponse, type AnthropicCompleteChatResponseType, AnthropicEmbeddingModelModalities, AnthropicEmbeddingModelModalitiesEnum, AnthropicEmbeddingRequest, AnthropicEmbeddingRequestInput, type AnthropicEmbeddingRequestInputType, type AnthropicEmbeddingRequestType, AnthropicGetEmbeddingsResponse, AnthropicStreamChatContentBlockDeltaResponse, AnthropicStreamChatContentBlockStartResponse, AnthropicStreamChatMessageDeltaResponse, AnthropicStreamChatMessageStartResponse, BaseChatModel, BaseChatModelOptions, type BaseChatModelOptionsType, BaseEmbeddingModel, BaseEmbeddingModelOptions, type BaseEmbeddingModelOptionsType, ChatModelAnthropicConfigs, ChatModelBaseConfigDef, ChatModelBaseConfigSchema, Claude3Haiku20240307, Claude3Haiku20240307Options, type Claude3Haiku20240307OptionsType, Claude3Haiku20240307Schema, EmbeddingModelAnthropicConfigs, EmbeddingModelBaseConfigDef, EmbeddingModelBaseConfigSchema, ProviderLiteral, Voyage2, Voyage2Options, type Voyage2OptionsType, Voyage2Schema, encodingFormat, inputType, maxTokens, stop, temperature, toolChoice, topK, topP, truncation };