@bedrockio/ai 0.9.5 → 0.9.6
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/cjs/BaseClient.js
CHANGED
|
@@ -118,7 +118,8 @@ class BaseClient {
|
|
|
118
118
|
getFilteredMessages(options) {
|
|
119
119
|
const { messages = [] } = options;
|
|
120
120
|
return messages.filter((message) => {
|
|
121
|
-
|
|
121
|
+
const trimmed = message.content.trim();
|
|
122
|
+
return trimmed && trimmed !== '.';
|
|
122
123
|
});
|
|
123
124
|
}
|
|
124
125
|
// Protected
|
|
@@ -244,12 +245,14 @@ class BaseClient {
|
|
|
244
245
|
}
|
|
245
246
|
if (result.length === 1 && !result[0].content) {
|
|
246
247
|
// If a single user input is passed and is nullish, coerce it to a
|
|
247
|
-
// single
|
|
248
|
+
// single period. Combined with getFilteredMessages below this allows
|
|
248
249
|
// a chatbot the ability to "speak first" by prompting it with empty
|
|
249
250
|
// content. The empty message will be filtered out of the final result
|
|
250
|
-
// appearing as if the chatbot went first.
|
|
251
|
-
//
|
|
252
|
-
|
|
251
|
+
// appearing as if the chatbot went first.
|
|
252
|
+
// Note that:
|
|
253
|
+
// GPT will fail on an empty string but on whitespace
|
|
254
|
+
// Anthropic will fail on all whitespace
|
|
255
|
+
result[0].content = '.';
|
|
253
256
|
}
|
|
254
257
|
return result;
|
|
255
258
|
}
|
package/dist/esm/BaseClient.js
CHANGED
|
@@ -116,7 +116,8 @@ export default class BaseClient {
|
|
|
116
116
|
getFilteredMessages(options) {
|
|
117
117
|
const { messages = [] } = options;
|
|
118
118
|
return messages.filter((message) => {
|
|
119
|
-
|
|
119
|
+
const trimmed = message.content.trim();
|
|
120
|
+
return trimmed && trimmed !== '.';
|
|
120
121
|
});
|
|
121
122
|
}
|
|
122
123
|
// Protected
|
|
@@ -242,12 +243,14 @@ export default class BaseClient {
|
|
|
242
243
|
}
|
|
243
244
|
if (result.length === 1 && !result[0].content) {
|
|
244
245
|
// If a single user input is passed and is nullish, coerce it to a
|
|
245
|
-
// single
|
|
246
|
+
// single period. Combined with getFilteredMessages below this allows
|
|
246
247
|
// a chatbot the ability to "speak first" by prompting it with empty
|
|
247
248
|
// content. The empty message will be filtered out of the final result
|
|
248
|
-
// appearing as if the chatbot went first.
|
|
249
|
-
//
|
|
250
|
-
|
|
249
|
+
// appearing as if the chatbot went first.
|
|
250
|
+
// Note that:
|
|
251
|
+
// GPT will fail on an empty string but on whitespace
|
|
252
|
+
// Anthropic will fail on all whitespace
|
|
253
|
+
result[0].content = '.';
|
|
251
254
|
}
|
|
252
255
|
return result;
|
|
253
256
|
}
|
package/package.json
CHANGED
|
@@ -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,uCAMC;IAID,8BAGC;IAED,8BAGC;IAED,qCAGC;IAED;;OAEG;IACH,0CAGC;IAED;;OAEG;IACH,oDAIC;IAED;;OAEG;IACH,oDAIC;IAID;;OAEG;IACH,oCAOC;IAED;;;MAeC;IAED,4CAiDC;IAED,uCAoCC;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;;iCA1Xa,sBAAsB"}
|