@bedrockio/ai 0.9.7 → 0.10.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/CHANGELOG.md +4 -0
- package/README.md +38 -0
- package/dist/cjs/BaseClient.js +97 -24
- package/dist/cjs/anthropic.js +6 -0
- package/dist/cjs/openai.js +49 -0
- package/dist/esm/BaseClient.js +97 -24
- package/dist/esm/anthropic.js +6 -0
- package/dist/esm/openai.js +49 -0
- package/package.json +1 -1
- package/types/BaseClient.d.ts +7 -2
- package/types/BaseClient.d.ts.map +1 -1
- package/types/anthropic.d.ts +2 -0
- package/types/anthropic.d.ts.map +1 -1
- package/types/openai.d.ts +12 -0
- package/types/openai.d.ts.map +1 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -6,6 +6,7 @@ usage.
|
|
|
6
6
|
|
|
7
7
|
- [Install](#install)
|
|
8
8
|
- [Usage](#usage)
|
|
9
|
+
- [Files](#files)
|
|
9
10
|
- [Streaming](#stream)
|
|
10
11
|
- [Templates](#templates)
|
|
11
12
|
- [Platforms](#platforms)
|
|
@@ -54,6 +55,43 @@ const response = await client.prompt({
|
|
|
54
55
|
});
|
|
55
56
|
```
|
|
56
57
|
|
|
58
|
+
## Files
|
|
59
|
+
|
|
60
|
+
Files can be passed directly in the options object and follow the same input
|
|
61
|
+
type as the Anthropic API:
|
|
62
|
+
|
|
63
|
+
```js
|
|
64
|
+
await client.prompt({
|
|
65
|
+
files: [
|
|
66
|
+
// By URL
|
|
67
|
+
{
|
|
68
|
+
type: 'document',
|
|
69
|
+
source: {
|
|
70
|
+
type: 'url',
|
|
71
|
+
url: 'https://example.com/my-file.pdf',
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
// By base64
|
|
75
|
+
{
|
|
76
|
+
type: 'document',
|
|
77
|
+
source: {
|
|
78
|
+
type: 'base64',
|
|
79
|
+
media_type: 'application/pdf',
|
|
80
|
+
data: 'bXl1cmw=',
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
// By uploaded ID
|
|
84
|
+
{
|
|
85
|
+
type: 'document',
|
|
86
|
+
source: {
|
|
87
|
+
type: 'file',
|
|
88
|
+
file_id: 'file_01',
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
],
|
|
92
|
+
});
|
|
93
|
+
```
|
|
94
|
+
|
|
57
95
|
## Streaming
|
|
58
96
|
|
|
59
97
|
Responses may be streamed:
|
package/dist/cjs/BaseClient.js
CHANGED
|
@@ -117,11 +117,44 @@ class BaseClient {
|
|
|
117
117
|
}
|
|
118
118
|
getFilteredMessages(options) {
|
|
119
119
|
const { messages = [] } = options;
|
|
120
|
-
return messages
|
|
121
|
-
|
|
122
|
-
|
|
120
|
+
return messages
|
|
121
|
+
.map((message) => {
|
|
122
|
+
const { content } = message;
|
|
123
|
+
return {
|
|
124
|
+
...message,
|
|
125
|
+
content: this.getFilteredContent(content),
|
|
126
|
+
};
|
|
127
|
+
})
|
|
128
|
+
.filter((message) => {
|
|
129
|
+
const { content } = message;
|
|
130
|
+
if (typeof content === 'string') {
|
|
131
|
+
return !!content;
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
return content.length > 0;
|
|
135
|
+
}
|
|
123
136
|
});
|
|
124
137
|
}
|
|
138
|
+
getFilteredContent(content) {
|
|
139
|
+
if (typeof content === 'string') {
|
|
140
|
+
return this.isEmptyContent(content) ? '' : content;
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
return content.filter((block) => {
|
|
144
|
+
const { type, text } = block;
|
|
145
|
+
if (type === 'text') {
|
|
146
|
+
return !this.isEmptyContent(text);
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
return true;
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
isEmptyContent(str) {
|
|
155
|
+
str = str.trim();
|
|
156
|
+
return !str || str === '.';
|
|
157
|
+
}
|
|
125
158
|
// Protected
|
|
126
159
|
runPrompt(options) {
|
|
127
160
|
void options;
|
|
@@ -158,6 +191,14 @@ class BaseClient {
|
|
|
158
191
|
void options;
|
|
159
192
|
throw new Error('Method not implemented.');
|
|
160
193
|
}
|
|
194
|
+
normalizeContentBlock(block) {
|
|
195
|
+
void block;
|
|
196
|
+
throw new Error('Method not implemented.');
|
|
197
|
+
}
|
|
198
|
+
normalizeFileBlock(block) {
|
|
199
|
+
void block;
|
|
200
|
+
throw new Error('Method not implemented.');
|
|
201
|
+
}
|
|
161
202
|
// Private
|
|
162
203
|
/**
|
|
163
204
|
* @returns {Object}
|
|
@@ -224,18 +265,13 @@ class BaseClient {
|
|
|
224
265
|
};
|
|
225
266
|
}
|
|
226
267
|
normalizeMessages(options) {
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
if (Array.isArray(input) && !input.length) {
|
|
230
|
-
input = '';
|
|
231
|
-
}
|
|
232
|
-
let result = [];
|
|
268
|
+
const { files = [] } = options;
|
|
269
|
+
let { input, messages = [] } = options;
|
|
233
270
|
if (Array.isArray(input)) {
|
|
234
|
-
|
|
271
|
+
messages = input;
|
|
235
272
|
}
|
|
236
|
-
else {
|
|
237
|
-
|
|
238
|
-
result = [
|
|
273
|
+
else if (typeof input === 'string') {
|
|
274
|
+
messages = [
|
|
239
275
|
...messages,
|
|
240
276
|
{
|
|
241
277
|
role: 'user',
|
|
@@ -243,18 +279,55 @@ class BaseClient {
|
|
|
243
279
|
},
|
|
244
280
|
];
|
|
245
281
|
}
|
|
246
|
-
if (
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
282
|
+
else if (!input && !messages.length) {
|
|
283
|
+
messages = [
|
|
284
|
+
{
|
|
285
|
+
role: 'user',
|
|
286
|
+
},
|
|
287
|
+
];
|
|
288
|
+
}
|
|
289
|
+
return messages.map((message) => {
|
|
290
|
+
let { content } = message;
|
|
291
|
+
if (files.length) {
|
|
292
|
+
content = [
|
|
293
|
+
...this.expandContentBlocks(content),
|
|
294
|
+
...files.map((block) => {
|
|
295
|
+
return this.normalizeFileBlock(block);
|
|
296
|
+
}),
|
|
297
|
+
];
|
|
298
|
+
}
|
|
299
|
+
else if (!content) {
|
|
300
|
+
// If no user input is passed, coerce it to a single period.
|
|
301
|
+
// Combined with getFilteredMessages below this allows
|
|
302
|
+
// a chatbot the ability to "speak first" by prompting it with empty
|
|
303
|
+
// content. The empty message will be filtered out of the final result
|
|
304
|
+
// appearing as if the chatbot went first.
|
|
305
|
+
// Note that:
|
|
306
|
+
// GPT will fail on an empty string but on whitespace
|
|
307
|
+
// Anthropic will fail on all whitespace
|
|
308
|
+
content = '.';
|
|
309
|
+
}
|
|
310
|
+
return {
|
|
311
|
+
...message,
|
|
312
|
+
content,
|
|
313
|
+
};
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
expandContentBlocks(content) {
|
|
317
|
+
if (typeof content === 'string') {
|
|
318
|
+
content = [
|
|
319
|
+
{
|
|
320
|
+
type: 'text',
|
|
321
|
+
text: content,
|
|
322
|
+
},
|
|
323
|
+
];
|
|
256
324
|
}
|
|
257
|
-
|
|
325
|
+
else if (!content) {
|
|
326
|
+
content = [];
|
|
327
|
+
}
|
|
328
|
+
return content.map((block) => {
|
|
329
|
+
return this.normalizeContentBlock(block);
|
|
330
|
+
});
|
|
258
331
|
}
|
|
259
332
|
normalizeSchema(options) {
|
|
260
333
|
let { schema } = options;
|
package/dist/cjs/anthropic.js
CHANGED
|
@@ -56,6 +56,12 @@ class AnthropicClient extends BaseClient_js_1.default {
|
|
|
56
56
|
});
|
|
57
57
|
return toolBlock?.input || null;
|
|
58
58
|
}
|
|
59
|
+
normalizeContentBlock(block) {
|
|
60
|
+
return block;
|
|
61
|
+
}
|
|
62
|
+
normalizeFileBlock(block) {
|
|
63
|
+
return block;
|
|
64
|
+
}
|
|
59
65
|
normalizeResponse(response, options) {
|
|
60
66
|
return {
|
|
61
67
|
messages: [
|
package/dist/cjs/openai.js
CHANGED
|
@@ -90,6 +90,55 @@ class OpenAiClient extends BaseClient_js_1.default {
|
|
|
90
90
|
const last = outputs[outputs.length - 1];
|
|
91
91
|
return JSON.parse(last.text);
|
|
92
92
|
}
|
|
93
|
+
normalizeContentBlock(block) {
|
|
94
|
+
const { type, text } = block;
|
|
95
|
+
if (type === 'text') {
|
|
96
|
+
block = {
|
|
97
|
+
type: 'input_text',
|
|
98
|
+
text,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
return block;
|
|
102
|
+
}
|
|
103
|
+
normalizeFileBlock(block) {
|
|
104
|
+
const { type, source } = block;
|
|
105
|
+
if (type === 'image') {
|
|
106
|
+
block = {
|
|
107
|
+
type: 'input_image',
|
|
108
|
+
...this.normalizeSourceParams(source, 'image'),
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
else if (type === 'document') {
|
|
112
|
+
block = {
|
|
113
|
+
type: 'input_file',
|
|
114
|
+
...this.normalizeSourceParams(source, 'file'),
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
return block;
|
|
118
|
+
}
|
|
119
|
+
normalizeSourceParams(source, prefix) {
|
|
120
|
+
const { type } = source;
|
|
121
|
+
if (type === 'url') {
|
|
122
|
+
return {
|
|
123
|
+
[`${prefix}_url`]: source.url,
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
else if (type === 'base64') {
|
|
127
|
+
const { filename, data } = source;
|
|
128
|
+
const mimeType = source.mimeType || source.media_type;
|
|
129
|
+
return {
|
|
130
|
+
file_data: `data:${mimeType};base64,${data}`,
|
|
131
|
+
...(filename && {
|
|
132
|
+
filename,
|
|
133
|
+
}),
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
else if (type === 'file') {
|
|
137
|
+
return {
|
|
138
|
+
file_id: source.id || source.file_id,
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
}
|
|
93
142
|
normalizeResponse(response, options) {
|
|
94
143
|
return {
|
|
95
144
|
messages: [
|
package/dist/esm/BaseClient.js
CHANGED
|
@@ -115,11 +115,44 @@ export default class BaseClient {
|
|
|
115
115
|
}
|
|
116
116
|
getFilteredMessages(options) {
|
|
117
117
|
const { messages = [] } = options;
|
|
118
|
-
return messages
|
|
119
|
-
|
|
120
|
-
|
|
118
|
+
return messages
|
|
119
|
+
.map((message) => {
|
|
120
|
+
const { content } = message;
|
|
121
|
+
return {
|
|
122
|
+
...message,
|
|
123
|
+
content: this.getFilteredContent(content),
|
|
124
|
+
};
|
|
125
|
+
})
|
|
126
|
+
.filter((message) => {
|
|
127
|
+
const { content } = message;
|
|
128
|
+
if (typeof content === 'string') {
|
|
129
|
+
return !!content;
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
return content.length > 0;
|
|
133
|
+
}
|
|
121
134
|
});
|
|
122
135
|
}
|
|
136
|
+
getFilteredContent(content) {
|
|
137
|
+
if (typeof content === 'string') {
|
|
138
|
+
return this.isEmptyContent(content) ? '' : content;
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
return content.filter((block) => {
|
|
142
|
+
const { type, text } = block;
|
|
143
|
+
if (type === 'text') {
|
|
144
|
+
return !this.isEmptyContent(text);
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
return true;
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
isEmptyContent(str) {
|
|
153
|
+
str = str.trim();
|
|
154
|
+
return !str || str === '.';
|
|
155
|
+
}
|
|
123
156
|
// Protected
|
|
124
157
|
runPrompt(options) {
|
|
125
158
|
void options;
|
|
@@ -156,6 +189,14 @@ export default class BaseClient {
|
|
|
156
189
|
void options;
|
|
157
190
|
throw new Error('Method not implemented.');
|
|
158
191
|
}
|
|
192
|
+
normalizeContentBlock(block) {
|
|
193
|
+
void block;
|
|
194
|
+
throw new Error('Method not implemented.');
|
|
195
|
+
}
|
|
196
|
+
normalizeFileBlock(block) {
|
|
197
|
+
void block;
|
|
198
|
+
throw new Error('Method not implemented.');
|
|
199
|
+
}
|
|
159
200
|
// Private
|
|
160
201
|
/**
|
|
161
202
|
* @returns {Object}
|
|
@@ -222,18 +263,13 @@ export default class BaseClient {
|
|
|
222
263
|
};
|
|
223
264
|
}
|
|
224
265
|
normalizeMessages(options) {
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
if (Array.isArray(input) && !input.length) {
|
|
228
|
-
input = '';
|
|
229
|
-
}
|
|
230
|
-
let result = [];
|
|
266
|
+
const { files = [] } = options;
|
|
267
|
+
let { input, messages = [] } = options;
|
|
231
268
|
if (Array.isArray(input)) {
|
|
232
|
-
|
|
269
|
+
messages = input;
|
|
233
270
|
}
|
|
234
|
-
else {
|
|
235
|
-
|
|
236
|
-
result = [
|
|
271
|
+
else if (typeof input === 'string') {
|
|
272
|
+
messages = [
|
|
237
273
|
...messages,
|
|
238
274
|
{
|
|
239
275
|
role: 'user',
|
|
@@ -241,18 +277,55 @@ export default class BaseClient {
|
|
|
241
277
|
},
|
|
242
278
|
];
|
|
243
279
|
}
|
|
244
|
-
if (
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
280
|
+
else if (!input && !messages.length) {
|
|
281
|
+
messages = [
|
|
282
|
+
{
|
|
283
|
+
role: 'user',
|
|
284
|
+
},
|
|
285
|
+
];
|
|
286
|
+
}
|
|
287
|
+
return messages.map((message) => {
|
|
288
|
+
let { content } = message;
|
|
289
|
+
if (files.length) {
|
|
290
|
+
content = [
|
|
291
|
+
...this.expandContentBlocks(content),
|
|
292
|
+
...files.map((block) => {
|
|
293
|
+
return this.normalizeFileBlock(block);
|
|
294
|
+
}),
|
|
295
|
+
];
|
|
296
|
+
}
|
|
297
|
+
else if (!content) {
|
|
298
|
+
// If no user input is passed, coerce it to a single period.
|
|
299
|
+
// Combined with getFilteredMessages below this allows
|
|
300
|
+
// a chatbot the ability to "speak first" by prompting it with empty
|
|
301
|
+
// content. The empty message will be filtered out of the final result
|
|
302
|
+
// appearing as if the chatbot went first.
|
|
303
|
+
// Note that:
|
|
304
|
+
// GPT will fail on an empty string but on whitespace
|
|
305
|
+
// Anthropic will fail on all whitespace
|
|
306
|
+
content = '.';
|
|
307
|
+
}
|
|
308
|
+
return {
|
|
309
|
+
...message,
|
|
310
|
+
content,
|
|
311
|
+
};
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
expandContentBlocks(content) {
|
|
315
|
+
if (typeof content === 'string') {
|
|
316
|
+
content = [
|
|
317
|
+
{
|
|
318
|
+
type: 'text',
|
|
319
|
+
text: content,
|
|
320
|
+
},
|
|
321
|
+
];
|
|
254
322
|
}
|
|
255
|
-
|
|
323
|
+
else if (!content) {
|
|
324
|
+
content = [];
|
|
325
|
+
}
|
|
326
|
+
return content.map((block) => {
|
|
327
|
+
return this.normalizeContentBlock(block);
|
|
328
|
+
});
|
|
256
329
|
}
|
|
257
330
|
normalizeSchema(options) {
|
|
258
331
|
let { schema } = options;
|
package/dist/esm/anthropic.js
CHANGED
|
@@ -50,6 +50,12 @@ export class AnthropicClient extends BaseClient {
|
|
|
50
50
|
});
|
|
51
51
|
return toolBlock?.input || null;
|
|
52
52
|
}
|
|
53
|
+
normalizeContentBlock(block) {
|
|
54
|
+
return block;
|
|
55
|
+
}
|
|
56
|
+
normalizeFileBlock(block) {
|
|
57
|
+
return block;
|
|
58
|
+
}
|
|
53
59
|
normalizeResponse(response, options) {
|
|
54
60
|
return {
|
|
55
61
|
messages: [
|
package/dist/esm/openai.js
CHANGED
|
@@ -84,6 +84,55 @@ export class OpenAiClient extends BaseClient {
|
|
|
84
84
|
const last = outputs[outputs.length - 1];
|
|
85
85
|
return JSON.parse(last.text);
|
|
86
86
|
}
|
|
87
|
+
normalizeContentBlock(block) {
|
|
88
|
+
const { type, text } = block;
|
|
89
|
+
if (type === 'text') {
|
|
90
|
+
block = {
|
|
91
|
+
type: 'input_text',
|
|
92
|
+
text,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
return block;
|
|
96
|
+
}
|
|
97
|
+
normalizeFileBlock(block) {
|
|
98
|
+
const { type, source } = block;
|
|
99
|
+
if (type === 'image') {
|
|
100
|
+
block = {
|
|
101
|
+
type: 'input_image',
|
|
102
|
+
...this.normalizeSourceParams(source, 'image'),
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
else if (type === 'document') {
|
|
106
|
+
block = {
|
|
107
|
+
type: 'input_file',
|
|
108
|
+
...this.normalizeSourceParams(source, 'file'),
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
return block;
|
|
112
|
+
}
|
|
113
|
+
normalizeSourceParams(source, prefix) {
|
|
114
|
+
const { type } = source;
|
|
115
|
+
if (type === 'url') {
|
|
116
|
+
return {
|
|
117
|
+
[`${prefix}_url`]: source.url,
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
else if (type === 'base64') {
|
|
121
|
+
const { filename, data } = source;
|
|
122
|
+
const mimeType = source.mimeType || source.media_type;
|
|
123
|
+
return {
|
|
124
|
+
file_data: `data:${mimeType};base64,${data}`,
|
|
125
|
+
...(filename && {
|
|
126
|
+
filename,
|
|
127
|
+
}),
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
else if (type === 'file') {
|
|
131
|
+
return {
|
|
132
|
+
file_id: source.id || source.file_id,
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
}
|
|
87
136
|
normalizeResponse(response, options) {
|
|
88
137
|
return {
|
|
89
138
|
messages: [
|
package/package.json
CHANGED
package/types/BaseClient.d.ts
CHANGED
|
@@ -24,6 +24,8 @@ export default class BaseClient {
|
|
|
24
24
|
*/
|
|
25
25
|
getTemplateSource(name: string): any;
|
|
26
26
|
getFilteredMessages(options: any): any;
|
|
27
|
+
getFilteredContent(content: any): any;
|
|
28
|
+
isEmptyContent(str: any): boolean;
|
|
27
29
|
runPrompt(options: any): void;
|
|
28
30
|
runStream(options: any): void;
|
|
29
31
|
getTextResponse(response: any): void;
|
|
@@ -39,16 +41,19 @@ export default class BaseClient {
|
|
|
39
41
|
* @returns {Object}
|
|
40
42
|
*/
|
|
41
43
|
normalizeStreamEvent(event: any, options: any): any;
|
|
44
|
+
normalizeContentBlock(block: any): void;
|
|
45
|
+
normalizeFileBlock(block: any): void;
|
|
42
46
|
/**
|
|
43
47
|
* @returns {Object}
|
|
44
48
|
*/
|
|
45
49
|
normalizeOptions(options: any): any;
|
|
46
50
|
normalizeInputs(options: any): {
|
|
47
|
-
messages: any
|
|
51
|
+
messages: any;
|
|
48
52
|
instructions: any;
|
|
49
53
|
};
|
|
50
54
|
normalizeTemplateOptions(options: any): any;
|
|
51
|
-
normalizeMessages(options: any): any
|
|
55
|
+
normalizeMessages(options: any): any;
|
|
56
|
+
expandContentBlocks(content: any): any;
|
|
52
57
|
normalizeSchema(options: any): {
|
|
53
58
|
schema: any;
|
|
54
59
|
hasWrappedSchema: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseClient.d.ts","sourceRoot":"","sources":["../src/BaseClient.js"],"names":[],"mappings":"AAOA;IACE,0BAUC;IATC,aAIC;IACD,2BAEE;IAIJ,2BAKC;IAID;;;;;OAKG;IACH,gBAFW,aAAa,gBAiCvB;IAED;;;;;OAKG;IACH,gBAHW,aAAa,GAAG,aAAa,gCAsDvC;IAED;;;;OAIG;IACH,wBAFW,MAAM,OAIhB;IAED,
|
|
1
|
+
{"version":3,"file":"BaseClient.d.ts","sourceRoot":"","sources":["../src/BaseClient.js"],"names":[],"mappings":"AAOA;IACE,0BAUC;IATC,aAIC;IACD,2BAEE;IAIJ,2BAKC;IAID;;;;;OAKG;IACH,gBAFW,aAAa,gBAiCvB;IAED;;;;;OAKG;IACH,gBAHW,aAAa,GAAG,aAAa,gCAsDvC;IAED;;;;OAIG;IACH,wBAFW,MAAM,OAIhB;IAED,uCAkBC;IAED,sCAaC;IAED,kCAGC;IAID,8BAGC;IAED,8BAGC;IAED,qCAGC;IAED;;OAEG;IACH,0CAGC;IAED;;OAEG;IACH,oDAIC;IAED;;OAEG;IACH,oDAIC;IAED,wCAGC;IAED,qCAGC;IAID;;OAEG;IACH,oCAOC;IAED;;;MAeC;IAED,4CAiDC;IAED,qCAkDC;IAED,uCAcC;IAED;;;MA4BC;IAED,uDAWC;IAED,kDAMC;CACF;;;;;WAIa,MAAM;kBACN,MAAM;;;;cACN,aAAa,EAAE;;;;YACf,MAAM;;;;YACN,OAAO;;;;;;;;aAEP,MAAM,GAAG,MAAM;;;;;;;;;;;sBAOf,MAAM;;;UAKN,QAAQ,GAAG,MAAM,GAAG,WAAW;aAC/B,MAAM;;iCAlca,sBAAsB"}
|
package/types/anthropic.d.ts
CHANGED
|
@@ -13,6 +13,8 @@ export class AnthropicClient extends BaseClient {
|
|
|
13
13
|
_request_id?: string | null;
|
|
14
14
|
} & import("@anthropic-ai/sdk/core/streaming.js").Stream<Anthropic.Messages.RawMessageStreamEvent>>;
|
|
15
15
|
getTextResponse(response: any): any;
|
|
16
|
+
normalizeContentBlock(block: any): any;
|
|
17
|
+
normalizeFileBlock(block: any): any;
|
|
16
18
|
normalizeResponse(response: any, options: any): {
|
|
17
19
|
messages: any[];
|
|
18
20
|
usage: {
|
package/types/anthropic.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anthropic.d.ts","sourceRoot":"","sources":["../src/anthropic.js"],"names":[],"mappings":"AAMA;IACE,6BAA2C;IAIzC,kBAAoC;IAGtC;;;OAGG;IACH,4BAGC;IAED;;wGA2BC;IAED;;wGAKC;IAED,oCAKC;IASD;;;;;;MAiBC;IAED;;;MAKC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAuCC;IAID;;;;;;;;;;MA0CC;IAED,oCAKC;IAUD;;;;MAOC;IAID;;;;MAOC;IAED;;;;MAQC;CACF;
|
|
1
|
+
{"version":3,"file":"anthropic.d.ts","sourceRoot":"","sources":["../src/anthropic.js"],"names":[],"mappings":"AAMA;IACE,6BAA2C;IAIzC,kBAAoC;IAGtC;;;OAGG;IACH,4BAGC;IAED;;wGA2BC;IAED;;wGAKC;IAED,oCAKC;IASD,uCAEC;IAED,oCAEC;IAED;;;;;;MAiBC;IAED;;;MAKC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAuCC;IAID;;;;;;;;;;MA0CC;IAED,oCAKC;IAUD;;;;MAOC;IAID;;;;MAOC;IAED;;;;MAQC;CACF;uBA5OsB,iBAAiB;sBAFlB,mBAAmB"}
|
package/types/openai.d.ts
CHANGED
|
@@ -14,6 +14,18 @@ export class OpenAiClient extends BaseClient {
|
|
|
14
14
|
_request_id?: string | null;
|
|
15
15
|
} & import("openai/core/streaming.js").Stream<OpenAI.Responses.ResponseStreamEvent>>;
|
|
16
16
|
getTextResponse(response: any): any;
|
|
17
|
+
normalizeContentBlock(block: any): any;
|
|
18
|
+
normalizeFileBlock(block: any): any;
|
|
19
|
+
normalizeSourceParams(source: any, prefix: any): {
|
|
20
|
+
[x: string]: any;
|
|
21
|
+
file_id?: undefined;
|
|
22
|
+
} | {
|
|
23
|
+
filename: any;
|
|
24
|
+
file_data: string;
|
|
25
|
+
file_id?: undefined;
|
|
26
|
+
} | {
|
|
27
|
+
file_id: any;
|
|
28
|
+
};
|
|
17
29
|
normalizeResponse(response: any, options: any): {
|
|
18
30
|
messages: any[];
|
|
19
31
|
prevResponseId: any;
|
package/types/openai.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openai.d.ts","sourceRoot":"","sources":["../src/openai.js"],"names":[],"mappings":"AAIA;IACE,6BAAoC;IAIlC,eAAiC;IAGnC;;;;OAIG;IACH,kBAHW,cAAc,qBAgCxB;IAED;;yFAiCC;IAED;;yFAKC;IAED,oCAEC;IAwBD;;;;;;;MAcC;IAED;;;MAKC;IAID;;;;;;;;;;MAmBC;CA2CF;6BAQA,GAAC,GAAK,KAAK,GACL,SAAS,GACT,WAAW,GACX,aAAa,GACb,YAAY,GACZ,WAAW,GACX,QAAQ,GACR,OAAO,GACP,OAAO,GACP,MAAM,GACN,QAAQ;
|
|
1
|
+
{"version":3,"file":"openai.d.ts","sourceRoot":"","sources":["../src/openai.js"],"names":[],"mappings":"AAIA;IACE,6BAAoC;IAIlC,eAAiC;IAGnC;;;;OAIG;IACH,kBAHW,cAAc,qBAgCxB;IAED;;yFAiCC;IAED;;yFAKC;IAED,oCAEC;IAwBD,uCAUC;IAED,oCAgBC;IAED;;;;;;;;;MAoBC;IAED;;;;;;;MAcC;IAED;;;MAKC;IAID;;;;;;;;;;MAmBC;CA2CF;6BAQA,GAAC,GAAK,KAAK,GACL,SAAS,GACT,WAAW,GACX,aAAa,GACb,YAAY,GACZ,WAAW,GACX,QAAQ,GACR,OAAO,GACP,OAAO,GACP,MAAM,GACN,QAAQ;uBA/QQ,iBAAiB;mBAFrB,QAAQ"}
|