@adaline/bedrock 0.18.0 → 0.19.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.
package/dist/index.d.mts CHANGED
@@ -1,21 +1,219 @@
1
- import { ChatModelSchemaType, UrlType, HeadersType, ParamsType, ProviderV1, ChatModelV1, EmbeddingModelSchemaType, EmbeddingModelV1 } from '@adaline/provider';
1
+ import * as zod from 'zod';
2
2
  import { z } from 'zod';
3
3
  import { BaseChatModel } from '@adaline/anthropic';
4
+ import { ChatModelSchemaType, UrlType, HeadersType, ParamsType, ProviderV1, ChatModelV1, EmbeddingModelSchemaType, EmbeddingModelV1 } from '@adaline/provider';
4
5
  import { ConfigType, MessageType, ToolType, PartialChatResponseType } from '@adaline/types';
5
6
 
7
+ declare const BedrockAnthropicChatModelBaseConfigSchema: (maxOutputTokens: number, maxSequences: number) => zod.ZodObject<zod.objectUtil.extendShape<{
8
+ temperature: zod.ZodOptional<zod.ZodDefault<zod.ZodNumber>>;
9
+ maxTokens: zod.ZodOptional<zod.ZodDefault<zod.ZodNumber>>;
10
+ stop: zod.ZodOptional<zod.ZodDefault<zod.ZodArray<zod.ZodString, "many">>>;
11
+ topP: zod.ZodOptional<zod.ZodDefault<zod.ZodNumber>>;
12
+ topK: zod.ZodOptional<zod.ZodDefault<zod.ZodNumber>>;
13
+ toolChoice: zod.ZodOptional<zod.ZodDefault<zod.ZodNullable<zod.ZodEnum<[string, ...string[]]>>>>;
14
+ }, {
15
+ awsRegion: zod.ZodOptional<zod.ZodDefault<zod.ZodNullable<zod.ZodEnum<[string, ...string[]]>>>>;
16
+ }>, "strip", zod.ZodTypeAny, {
17
+ awsRegion?: string | null | undefined;
18
+ temperature?: number | undefined;
19
+ maxTokens?: number | undefined;
20
+ stop?: string[] | undefined;
21
+ topP?: number | undefined;
22
+ topK?: number | undefined;
23
+ toolChoice?: string | null | undefined;
24
+ }, {
25
+ awsRegion?: string | null | undefined;
26
+ temperature?: number | undefined;
27
+ maxTokens?: number | undefined;
28
+ stop?: string[] | undefined;
29
+ topP?: number | undefined;
30
+ topK?: number | undefined;
31
+ toolChoice?: string | null | undefined;
32
+ }>;
33
+ declare const BedrockAnthropicChatModelBaseConfigDef: (maxOutputTokens: number, maxSequences: number) => {
34
+ readonly awsRegion: {
35
+ type: "select-string";
36
+ param: string;
37
+ title: string;
38
+ description: string;
39
+ default: string | null;
40
+ choices: string[];
41
+ };
42
+ readonly temperature: {
43
+ type: "range";
44
+ param: string;
45
+ title: string;
46
+ description: string;
47
+ max: number;
48
+ default: number;
49
+ min: number;
50
+ step: number;
51
+ };
52
+ readonly maxTokens: {
53
+ type: "range";
54
+ param: string;
55
+ title: string;
56
+ description: string;
57
+ max: number;
58
+ default: number;
59
+ min: number;
60
+ step: number;
61
+ };
62
+ readonly stop: {
63
+ type: "multi-string";
64
+ param: string;
65
+ title: string;
66
+ description: string;
67
+ max: number;
68
+ };
69
+ readonly topP: {
70
+ type: "range";
71
+ param: string;
72
+ title: string;
73
+ description: string;
74
+ max: number;
75
+ default: number;
76
+ min: number;
77
+ step: number;
78
+ };
79
+ readonly topK: {
80
+ type: "range";
81
+ param: string;
82
+ title: string;
83
+ description: string;
84
+ max: number;
85
+ default: number;
86
+ min: number;
87
+ step: number;
88
+ };
89
+ readonly toolChoice: {
90
+ type: "select-string";
91
+ param: string;
92
+ title: string;
93
+ description: string;
94
+ default: string | null;
95
+ choices: string[];
96
+ };
97
+ };
98
+
99
+ declare const awsRegionChoice: {
100
+ def: {
101
+ type: "select-string";
102
+ param: string;
103
+ title: string;
104
+ description: string;
105
+ default: string | null;
106
+ choices: string[];
107
+ };
108
+ schema: zod.ZodOptional<zod.ZodDefault<zod.ZodNullable<zod.ZodEnum<[string, ...string[]]>>>>;
109
+ };
110
+
111
+ declare const BedrockAnthropicChatModelConfigs: {
112
+ readonly base: (maxOutputTokens: number, maxSequences: number) => {
113
+ def: {
114
+ readonly awsRegion: {
115
+ type: "select-string";
116
+ param: string;
117
+ title: string;
118
+ description: string;
119
+ default: string | null;
120
+ choices: string[];
121
+ };
122
+ readonly temperature: {
123
+ type: "range";
124
+ param: string;
125
+ title: string;
126
+ description: string;
127
+ max: number;
128
+ default: number;
129
+ min: number;
130
+ step: number;
131
+ };
132
+ readonly maxTokens: {
133
+ type: "range";
134
+ param: string;
135
+ title: string;
136
+ description: string;
137
+ max: number;
138
+ default: number;
139
+ min: number;
140
+ step: number;
141
+ };
142
+ readonly stop: {
143
+ type: "multi-string";
144
+ param: string;
145
+ title: string;
146
+ description: string;
147
+ max: number;
148
+ };
149
+ readonly topP: {
150
+ type: "range";
151
+ param: string;
152
+ title: string;
153
+ description: string;
154
+ max: number;
155
+ default: number;
156
+ min: number;
157
+ step: number;
158
+ };
159
+ readonly topK: {
160
+ type: "range";
161
+ param: string;
162
+ title: string;
163
+ description: string;
164
+ max: number;
165
+ default: number;
166
+ min: number;
167
+ step: number;
168
+ };
169
+ readonly toolChoice: {
170
+ type: "select-string";
171
+ param: string;
172
+ title: string;
173
+ description: string;
174
+ default: string | null;
175
+ choices: string[];
176
+ };
177
+ };
178
+ schema: zod.ZodObject<zod.objectUtil.extendShape<{
179
+ temperature: zod.ZodOptional<zod.ZodDefault<zod.ZodNumber>>;
180
+ maxTokens: zod.ZodOptional<zod.ZodDefault<zod.ZodNumber>>;
181
+ stop: zod.ZodOptional<zod.ZodDefault<zod.ZodArray<zod.ZodString, "many">>>;
182
+ topP: zod.ZodOptional<zod.ZodDefault<zod.ZodNumber>>;
183
+ topK: zod.ZodOptional<zod.ZodDefault<zod.ZodNumber>>;
184
+ toolChoice: zod.ZodOptional<zod.ZodDefault<zod.ZodNullable<zod.ZodEnum<[string, ...string[]]>>>>;
185
+ }, {
186
+ awsRegion: zod.ZodOptional<zod.ZodDefault<zod.ZodNullable<zod.ZodEnum<[string, ...string[]]>>>>;
187
+ }>, "strip", zod.ZodTypeAny, {
188
+ awsRegion?: string | null | undefined;
189
+ temperature?: number | undefined;
190
+ maxTokens?: number | undefined;
191
+ stop?: string[] | undefined;
192
+ topP?: number | undefined;
193
+ topK?: number | undefined;
194
+ toolChoice?: string | null | undefined;
195
+ }, {
196
+ awsRegion?: string | null | undefined;
197
+ temperature?: number | undefined;
198
+ maxTokens?: number | undefined;
199
+ stop?: string[] | undefined;
200
+ topP?: number | undefined;
201
+ topK?: number | undefined;
202
+ toolChoice?: string | null | undefined;
203
+ }>;
204
+ };
205
+ };
206
+
6
207
  declare const BaseChatModelOptions: z.ZodObject<{
7
208
  modelName: z.ZodString;
8
- awsRegion: z.ZodString;
9
209
  awsAccessKeyId: z.ZodString;
10
210
  awsSecretAccessKey: z.ZodString;
11
211
  }, "strip", z.ZodTypeAny, {
12
212
  modelName: string;
13
- awsRegion: string;
14
213
  awsAccessKeyId: string;
15
214
  awsSecretAccessKey: string;
16
215
  }, {
17
216
  modelName: string;
18
- awsRegion: string;
19
217
  awsAccessKeyId: string;
20
218
  awsSecretAccessKey: string;
21
219
  }>;
@@ -25,9 +223,7 @@ declare class BaseChatModelAnthropic extends BaseChatModel {
25
223
  readonly version: "v1";
26
224
  modelSchema: ChatModelSchemaType;
27
225
  modelName: string;
28
- private readonly awsUrl;
29
226
  private readonly awsService;
30
- private readonly awsRegion;
31
227
  private readonly awsAccessKeyId;
32
228
  private readonly awsSecretAccessKey;
33
229
  constructor(modelSchema: ChatModelSchemaType, options: BaseChatModelOptionsType);
@@ -35,6 +231,7 @@ declare class BaseChatModelAnthropic extends BaseChatModel {
35
231
  getDefaultHeaders(): HeadersType;
36
232
  getDefaultParams(): ParamsType;
37
233
  getCompleteChatUrl(config?: ConfigType, messages?: MessageType[], tools?: ToolType[]): Promise<UrlType>;
234
+ transformConfig(config: ConfigType, messages?: MessageType[], tools?: ToolType[]): ParamsType;
38
235
  getCompleteChatHeaders(config?: ConfigType, messages?: MessageType[], tools?: ToolType[]): Promise<HeadersType>;
39
236
  getCompleteChatData(config: ConfigType, messages: MessageType[], tools?: ToolType[]): Promise<ParamsType>;
40
237
  getStreamChatUrl(config?: ConfigType, messages?: MessageType[], tools?: ToolType[]): Promise<UrlType>;
@@ -58,8 +255,8 @@ declare class BaseChatModelAnthropic extends BaseChatModel {
58
255
 
59
256
  declare const BedrockClaude3_5Haiku20241022Literal = "anthropic.claude-3-5-haiku-20241022-v1:0";
60
257
  declare const BedrockClaude3_5Haiku20241022Schema: {
61
- name: string;
62
258
  description: string;
259
+ name: string;
63
260
  roles: Partial<Record<"system" | "user" | "assistant" | "tool", string | undefined>>;
64
261
  modalities: ["text" | "image" | "tool-call" | "tool-response", ...("text" | "image" | "tool-call" | "tool-response")[]];
65
262
  maxInputTokens: number;
@@ -105,17 +302,14 @@ declare const BedrockClaude3_5Haiku20241022Schema: {
105
302
  };
106
303
  declare const BedrockClaude3_5Haiku20241022Options: z.ZodObject<{
107
304
  modelName: z.ZodString;
108
- awsRegion: z.ZodString;
109
305
  awsAccessKeyId: z.ZodString;
110
306
  awsSecretAccessKey: z.ZodString;
111
307
  }, "strip", z.ZodTypeAny, {
112
308
  modelName: string;
113
- awsRegion: string;
114
309
  awsAccessKeyId: string;
115
310
  awsSecretAccessKey: string;
116
311
  }, {
117
312
  modelName: string;
118
- awsRegion: string;
119
313
  awsAccessKeyId: string;
120
314
  awsSecretAccessKey: string;
121
315
  }>;
@@ -126,8 +320,8 @@ declare class BedrockClaude3_5Haiku20241022 extends BaseChatModelAnthropic {
126
320
 
127
321
  declare const BedrockClaude3_5Sonnet20240620Literal = "anthropic.claude-3-5-sonnet-20240620-v1:0";
128
322
  declare const BedrockClaude3_5Sonnet20240620Schema: {
129
- name: string;
130
323
  description: string;
324
+ name: string;
131
325
  roles: Partial<Record<"system" | "user" | "assistant" | "tool", string | undefined>>;
132
326
  modalities: ["text" | "image" | "tool-call" | "tool-response", ...("text" | "image" | "tool-call" | "tool-response")[]];
133
327
  maxInputTokens: number;
@@ -173,17 +367,14 @@ declare const BedrockClaude3_5Sonnet20240620Schema: {
173
367
  };
174
368
  declare const BedrockClaude3_5Sonnet20240620Options: z.ZodObject<{
175
369
  modelName: z.ZodString;
176
- awsRegion: z.ZodString;
177
370
  awsAccessKeyId: z.ZodString;
178
371
  awsSecretAccessKey: z.ZodString;
179
372
  }, "strip", z.ZodTypeAny, {
180
373
  modelName: string;
181
- awsRegion: string;
182
374
  awsAccessKeyId: string;
183
375
  awsSecretAccessKey: string;
184
376
  }, {
185
377
  modelName: string;
186
- awsRegion: string;
187
378
  awsAccessKeyId: string;
188
379
  awsSecretAccessKey: string;
189
380
  }>;
@@ -194,8 +385,8 @@ declare class BedrockClaude3_5Sonnet20240620 extends BaseChatModelAnthropic {
194
385
 
195
386
  declare const BedrockClaude3_5Sonnet20241022Literal = "anthropic.claude-3-5-sonnet-20241022-v2:0";
196
387
  declare const BedrockClaude3_5Sonnet20241022Schema: {
197
- name: string;
198
388
  description: string;
389
+ name: string;
199
390
  roles: Partial<Record<"system" | "user" | "assistant" | "tool", string | undefined>>;
200
391
  modalities: ["text" | "image" | "tool-call" | "tool-response", ...("text" | "image" | "tool-call" | "tool-response")[]];
201
392
  maxInputTokens: number;
@@ -241,17 +432,14 @@ declare const BedrockClaude3_5Sonnet20241022Schema: {
241
432
  };
242
433
  declare const BedrockClaude3_5Sonnet20241022Options: z.ZodObject<{
243
434
  modelName: z.ZodString;
244
- awsRegion: z.ZodString;
245
435
  awsAccessKeyId: z.ZodString;
246
436
  awsSecretAccessKey: z.ZodString;
247
437
  }, "strip", z.ZodTypeAny, {
248
438
  modelName: string;
249
- awsRegion: string;
250
439
  awsAccessKeyId: string;
251
440
  awsSecretAccessKey: string;
252
441
  }, {
253
442
  modelName: string;
254
- awsRegion: string;
255
443
  awsAccessKeyId: string;
256
444
  awsSecretAccessKey: string;
257
445
  }>;
@@ -262,8 +450,8 @@ declare class BedrockClaude3_5Sonnet20241022 extends BaseChatModelAnthropic {
262
450
 
263
451
  declare const BedrockClaude3Haiku20240307Literal = "anthropic.claude-3-haiku-20240307-v1:0";
264
452
  declare const BedrockClaude3Haiku20240307Schema: {
265
- name: string;
266
453
  description: string;
454
+ name: string;
267
455
  roles: Partial<Record<"system" | "user" | "assistant" | "tool", string | undefined>>;
268
456
  modalities: ["text" | "image" | "tool-call" | "tool-response", ...("text" | "image" | "tool-call" | "tool-response")[]];
269
457
  maxInputTokens: number;
@@ -309,17 +497,14 @@ declare const BedrockClaude3Haiku20240307Schema: {
309
497
  };
310
498
  declare const BedrockClaude3Haiku20240307Options: z.ZodObject<{
311
499
  modelName: z.ZodString;
312
- awsRegion: z.ZodString;
313
500
  awsAccessKeyId: z.ZodString;
314
501
  awsSecretAccessKey: z.ZodString;
315
502
  }, "strip", z.ZodTypeAny, {
316
503
  modelName: string;
317
- awsRegion: string;
318
504
  awsAccessKeyId: string;
319
505
  awsSecretAccessKey: string;
320
506
  }, {
321
507
  modelName: string;
322
- awsRegion: string;
323
508
  awsAccessKeyId: string;
324
509
  awsSecretAccessKey: string;
325
510
  }>;
@@ -330,8 +515,8 @@ declare class BedrockClaude3Haiku20240307 extends BaseChatModelAnthropic {
330
515
 
331
516
  declare const BedrockClaude3Opus20240229Literal = "anthropic.claude-3-opus-20240229-v1:0";
332
517
  declare const BedrockClaude3Opus20240229Schema: {
333
- name: string;
334
518
  description: string;
519
+ name: string;
335
520
  roles: Partial<Record<"system" | "user" | "assistant" | "tool", string | undefined>>;
336
521
  modalities: ["text" | "image" | "tool-call" | "tool-response", ...("text" | "image" | "tool-call" | "tool-response")[]];
337
522
  maxInputTokens: number;
@@ -377,17 +562,14 @@ declare const BedrockClaude3Opus20240229Schema: {
377
562
  };
378
563
  declare const BedrockClaude3Opus20240229Options: z.ZodObject<{
379
564
  modelName: z.ZodString;
380
- awsRegion: z.ZodString;
381
565
  awsAccessKeyId: z.ZodString;
382
566
  awsSecretAccessKey: z.ZodString;
383
567
  }, "strip", z.ZodTypeAny, {
384
568
  modelName: string;
385
- awsRegion: string;
386
569
  awsAccessKeyId: string;
387
570
  awsSecretAccessKey: string;
388
571
  }, {
389
572
  modelName: string;
390
- awsRegion: string;
391
573
  awsAccessKeyId: string;
392
574
  awsSecretAccessKey: string;
393
575
  }>;
@@ -398,8 +580,8 @@ declare class BedrockClaude3Opus20240229 extends BaseChatModelAnthropic {
398
580
 
399
581
  declare const BedrockClaude3Sonnet20240229Literal = "anthropic.claude-3-sonnet-20240229-v1:0";
400
582
  declare const BedrockClaude3Sonnet20240229Schema: {
401
- name: string;
402
583
  description: string;
584
+ name: string;
403
585
  roles: Partial<Record<"system" | "user" | "assistant" | "tool", string | undefined>>;
404
586
  modalities: ["text" | "image" | "tool-call" | "tool-response", ...("text" | "image" | "tool-call" | "tool-response")[]];
405
587
  maxInputTokens: number;
@@ -445,17 +627,14 @@ declare const BedrockClaude3Sonnet20240229Schema: {
445
627
  };
446
628
  declare const BedrockClaude3Sonnet20240229Options: z.ZodObject<{
447
629
  modelName: z.ZodString;
448
- awsRegion: z.ZodString;
449
630
  awsAccessKeyId: z.ZodString;
450
631
  awsSecretAccessKey: z.ZodString;
451
632
  }, "strip", z.ZodTypeAny, {
452
633
  modelName: string;
453
- awsRegion: string;
454
634
  awsAccessKeyId: string;
455
635
  awsSecretAccessKey: string;
456
636
  }, {
457
637
  modelName: string;
458
- awsRegion: string;
459
638
  awsAccessKeyId: string;
460
639
  awsSecretAccessKey: string;
461
640
  }>;
@@ -468,7 +647,8 @@ declare class Bedrock<C extends BaseChatModelOptionsType, E extends Record<strin
468
647
  readonly version: "v1";
469
648
  readonly name = "bedrock";
470
649
  static readonly awsService = "bedrock";
471
- static readonly awsUrl: (awsRegion: string) => string;
650
+ static readonly awsDefaultRegion = "us-east-1";
651
+ static readonly awsUrl: (awsRegion?: string) => string;
472
652
  private readonly chatModelFactories;
473
653
  private readonly embeddingModelFactories;
474
654
  chatModelLiterals(): string[];
@@ -479,4 +659,4 @@ declare class Bedrock<C extends BaseChatModelOptionsType, E extends Record<strin
479
659
  embeddingModel(options: E): EmbeddingModelV1;
480
660
  }
481
661
 
482
- export { BaseChatModelAnthropic, BaseChatModelOptions, type BaseChatModelOptionsType, Bedrock, BedrockClaude3Haiku20240307, BedrockClaude3Haiku20240307Literal, BedrockClaude3Haiku20240307Options, type BedrockClaude3Haiku20240307OptionsType, BedrockClaude3Haiku20240307Schema, BedrockClaude3Opus20240229, BedrockClaude3Opus20240229Literal, BedrockClaude3Opus20240229Options, type BedrockClaude3Opus20240229OptionsType, BedrockClaude3Opus20240229Schema, BedrockClaude3Sonnet20240229, BedrockClaude3Sonnet20240229Literal, BedrockClaude3Sonnet20240229Options, type BedrockClaude3Sonnet20240229OptionsType, BedrockClaude3Sonnet20240229Schema, BedrockClaude3_5Haiku20241022, BedrockClaude3_5Haiku20241022Literal, BedrockClaude3_5Haiku20241022Options, type BedrockClaude3_5Haiku20241022OptionsType, BedrockClaude3_5Haiku20241022Schema, BedrockClaude3_5Sonnet20240620, BedrockClaude3_5Sonnet20240620Literal, BedrockClaude3_5Sonnet20240620Options, type BedrockClaude3_5Sonnet20240620OptionsType, BedrockClaude3_5Sonnet20240620Schema, BedrockClaude3_5Sonnet20241022, BedrockClaude3_5Sonnet20241022Literal, BedrockClaude3_5Sonnet20241022Options, type BedrockClaude3_5Sonnet20241022OptionsType, BedrockClaude3_5Sonnet20241022Schema };
662
+ export { BaseChatModelAnthropic, BaseChatModelOptions, type BaseChatModelOptionsType, Bedrock, BedrockAnthropicChatModelBaseConfigDef, BedrockAnthropicChatModelBaseConfigSchema, BedrockAnthropicChatModelConfigs, BedrockClaude3Haiku20240307, BedrockClaude3Haiku20240307Literal, BedrockClaude3Haiku20240307Options, type BedrockClaude3Haiku20240307OptionsType, BedrockClaude3Haiku20240307Schema, BedrockClaude3Opus20240229, BedrockClaude3Opus20240229Literal, BedrockClaude3Opus20240229Options, type BedrockClaude3Opus20240229OptionsType, BedrockClaude3Opus20240229Schema, BedrockClaude3Sonnet20240229, BedrockClaude3Sonnet20240229Literal, BedrockClaude3Sonnet20240229Options, type BedrockClaude3Sonnet20240229OptionsType, BedrockClaude3Sonnet20240229Schema, BedrockClaude3_5Haiku20241022, BedrockClaude3_5Haiku20241022Literal, BedrockClaude3_5Haiku20241022Options, type BedrockClaude3_5Haiku20241022OptionsType, BedrockClaude3_5Haiku20241022Schema, BedrockClaude3_5Sonnet20240620, BedrockClaude3_5Sonnet20240620Literal, BedrockClaude3_5Sonnet20240620Options, type BedrockClaude3_5Sonnet20240620OptionsType, BedrockClaude3_5Sonnet20240620Schema, BedrockClaude3_5Sonnet20241022, BedrockClaude3_5Sonnet20241022Literal, BedrockClaude3_5Sonnet20241022Options, type BedrockClaude3_5Sonnet20241022OptionsType, BedrockClaude3_5Sonnet20241022Schema, awsRegionChoice };