@bedrockio/ai 0.7.2 → 0.7.3
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/dist/cjs/BaseClient.js +5 -5
- package/dist/cjs/anthropic.js +2 -2
- package/dist/cjs/openai.js +1 -1
- package/dist/esm/BaseClient.js +5 -5
- package/dist/esm/anthropic.js +2 -2
- package/dist/esm/openai.js +1 -1
- package/package.json +1 -1
- package/types/BaseClient.d.ts +1 -1
- package/types/BaseClient.d.ts.map +1 -1
package/CHANGELOG.md
CHANGED
package/dist/cjs/BaseClient.js
CHANGED
|
@@ -26,7 +26,7 @@ class BaseClient {
|
|
|
26
26
|
const { output, stream, schema } = options;
|
|
27
27
|
const response = await this.runPrompt(options);
|
|
28
28
|
if (!stream) {
|
|
29
|
-
this.debug('Response:', response);
|
|
29
|
+
this.debug('Response:', response, options);
|
|
30
30
|
}
|
|
31
31
|
if (output === 'raw') {
|
|
32
32
|
return response;
|
|
@@ -68,7 +68,7 @@ class BaseClient {
|
|
|
68
68
|
const stream = await this.runStream(options);
|
|
69
69
|
// @ts-ignore
|
|
70
70
|
for await (let event of stream) {
|
|
71
|
-
this.debug('Event:', event);
|
|
71
|
+
this.debug('Event:', event, options);
|
|
72
72
|
event = this.normalizeStreamEvent(event);
|
|
73
73
|
if (event) {
|
|
74
74
|
yield event;
|
|
@@ -91,7 +91,7 @@ class BaseClient {
|
|
|
91
91
|
key,
|
|
92
92
|
};
|
|
93
93
|
}
|
|
94
|
-
this.debug('Extract:', extractEvent);
|
|
94
|
+
this.debug('Extract:', extractEvent, options);
|
|
95
95
|
yield extractEvent;
|
|
96
96
|
}
|
|
97
97
|
}
|
|
@@ -237,8 +237,8 @@ class BaseClient {
|
|
|
237
237
|
}
|
|
238
238
|
};
|
|
239
239
|
}
|
|
240
|
-
debug(message, arg) {
|
|
241
|
-
if (
|
|
240
|
+
debug(message, arg, options) {
|
|
241
|
+
if (options.debug) {
|
|
242
242
|
// TODO: replace with logger when opentelemetry is removed
|
|
243
243
|
// eslint-disable-next-line
|
|
244
244
|
console.debug(`${message}\n${JSON.stringify(arg, null, 2)}\n`);
|
package/dist/cjs/anthropic.js
CHANGED
|
@@ -33,8 +33,8 @@ class AnthropicClient extends BaseClient_js_1.default {
|
|
|
33
33
|
...this.getToolOptions(options),
|
|
34
34
|
};
|
|
35
35
|
const clientOptions = this.getClientOptions(params);
|
|
36
|
-
this.debug('Params:', params);
|
|
37
|
-
this.debug('Options:', options);
|
|
36
|
+
this.debug('Params:', params, options);
|
|
37
|
+
this.debug('Options:', options, options);
|
|
38
38
|
// @ts-ignore
|
|
39
39
|
return await this.client.messages.create(params, clientOptions);
|
|
40
40
|
}
|
package/dist/cjs/openai.js
CHANGED
package/dist/esm/BaseClient.js
CHANGED
|
@@ -24,7 +24,7 @@ export default class BaseClient {
|
|
|
24
24
|
const { output, stream, schema } = options;
|
|
25
25
|
const response = await this.runPrompt(options);
|
|
26
26
|
if (!stream) {
|
|
27
|
-
this.debug('Response:', response);
|
|
27
|
+
this.debug('Response:', response, options);
|
|
28
28
|
}
|
|
29
29
|
if (output === 'raw') {
|
|
30
30
|
return response;
|
|
@@ -66,7 +66,7 @@ export default class BaseClient {
|
|
|
66
66
|
const stream = await this.runStream(options);
|
|
67
67
|
// @ts-ignore
|
|
68
68
|
for await (let event of stream) {
|
|
69
|
-
this.debug('Event:', event);
|
|
69
|
+
this.debug('Event:', event, options);
|
|
70
70
|
event = this.normalizeStreamEvent(event);
|
|
71
71
|
if (event) {
|
|
72
72
|
yield event;
|
|
@@ -89,7 +89,7 @@ export default class BaseClient {
|
|
|
89
89
|
key,
|
|
90
90
|
};
|
|
91
91
|
}
|
|
92
|
-
this.debug('Extract:', extractEvent);
|
|
92
|
+
this.debug('Extract:', extractEvent, options);
|
|
93
93
|
yield extractEvent;
|
|
94
94
|
}
|
|
95
95
|
}
|
|
@@ -235,8 +235,8 @@ export default class BaseClient {
|
|
|
235
235
|
}
|
|
236
236
|
};
|
|
237
237
|
}
|
|
238
|
-
debug(message, arg) {
|
|
239
|
-
if (
|
|
238
|
+
debug(message, arg, options) {
|
|
239
|
+
if (options.debug) {
|
|
240
240
|
// TODO: replace with logger when opentelemetry is removed
|
|
241
241
|
// eslint-disable-next-line
|
|
242
242
|
console.debug(`${message}\n${JSON.stringify(arg, null, 2)}\n`);
|
package/dist/esm/anthropic.js
CHANGED
|
@@ -27,8 +27,8 @@ export class AnthropicClient extends BaseClient {
|
|
|
27
27
|
...this.getToolOptions(options),
|
|
28
28
|
};
|
|
29
29
|
const clientOptions = this.getClientOptions(params);
|
|
30
|
-
this.debug('Params:', params);
|
|
31
|
-
this.debug('Options:', options);
|
|
30
|
+
this.debug('Params:', params, options);
|
|
31
|
+
this.debug('Options:', options, options);
|
|
32
32
|
// @ts-ignore
|
|
33
33
|
return await this.client.messages.create(params, clientOptions);
|
|
34
34
|
}
|
package/dist/esm/openai.js
CHANGED
package/package.json
CHANGED
package/types/BaseClient.d.ts
CHANGED
|
@@ -54,7 +54,7 @@ export default class BaseClient {
|
|
|
54
54
|
hasWrappedSchema: boolean;
|
|
55
55
|
};
|
|
56
56
|
getMessageExtractor(options: any): (event: any) => any;
|
|
57
|
-
debug(message: any, arg: any): void;
|
|
57
|
+
debug(message: any, arg: any, options: any): void;
|
|
58
58
|
}
|
|
59
59
|
export type PromptOptions = {
|
|
60
60
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseClient.d.ts","sourceRoot":"","sources":["../src/BaseClient.js"],"names":[],"mappings":"AAKA;IACE,0BASC;IARC,aAIC;IACD,2BAEE;IAKJ;;;;;OAKG;IACH,gBAFW,aAAa,gBAuCvB;IAED;;;;;OAKG;IACH,gBAHW,aAAa,GAAG,aAAa,gCAsDvC;IAED;;;;OAIG;IACH,wBAFW,MAAM,OAIhB;IAID,8BAGC;IAED,8BAGC;IAED,qCAGC;IAED;;OAEG;IACH,0CAGC;IAED;;OAEG;IACH,oDAGC;IAED;;OAEG;IACH,sCAGC;IAID;;OAEG;IACH,oCAOC;IAED;;;MAuCC;IAED;;;QAQC;IAED;;;MA4BC;IAED,uDAWC;IAED,
|
|
1
|
+
{"version":3,"file":"BaseClient.d.ts","sourceRoot":"","sources":["../src/BaseClient.js"],"names":[],"mappings":"AAKA;IACE,0BASC;IARC,aAIC;IACD,2BAEE;IAKJ;;;;;OAKG;IACH,gBAFW,aAAa,gBAuCvB;IAED;;;;;OAKG;IACH,gBAHW,aAAa,GAAG,aAAa,gCAsDvC;IAED;;;;OAIG;IACH,wBAFW,MAAM,OAIhB;IAID,8BAGC;IAED,8BAGC;IAED,qCAGC;IAED;;OAEG;IACH,0CAGC;IAED;;OAEG;IACH,oDAGC;IAED;;OAEG;IACH,sCAGC;IAID;;OAEG;IACH,oCAOC;IAED;;;MAuCC;IAED;;;QAQC;IAED;;;MA4BC;IAED,uDAWC;IAED,kDAMC;CACF;;;;;WAIa,MAAM,GAAC,aAAa,EAAE;;;;YACtB,MAAM;;;;YACN,OAAO;;;;;;;;aAEP,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,UAAU;;;;;;;;;;;sBAOpC,MAAM;;;UAKN,QAAQ,GAAG,MAAM,GAAG,WAAW;aAC/B,MAAM;;iCArTa,sBAAsB"}
|