@cellaware/utils 7.0.3 → 7.0.5
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/llm/chain-store.js +7 -7
- package/package.json +1 -1
package/dist/llm/chain-store.js
CHANGED
|
@@ -70,11 +70,12 @@ export class SingleActionChain extends BaseChain {
|
|
|
70
70
|
for (const inputKey of this._inputKeys) {
|
|
71
71
|
llmInputs[inputKey] = values[inputKey];
|
|
72
72
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
let callbacks = undefined;
|
|
74
|
+
if (!!runManager && !!runManager.getChild()) {
|
|
75
|
+
callbacks = runManager.getChild().handlers;
|
|
76
|
+
}
|
|
76
77
|
const llmAnswer = await llmChain.invoke(llmInputs, {
|
|
77
|
-
callbacks
|
|
78
|
+
callbacks
|
|
78
79
|
});
|
|
79
80
|
output[this._outputKey] = llmAnswer;
|
|
80
81
|
return output;
|
|
@@ -236,8 +237,7 @@ Your translation here:
|
|
|
236
237
|
return chain.invoke(args, {
|
|
237
238
|
callbacks: [
|
|
238
239
|
{
|
|
239
|
-
handleLLMEnd: (output) => {
|
|
240
|
-
console.log(output);
|
|
240
|
+
handleLLMEnd: async (output) => {
|
|
241
241
|
const usage = output?.llmOutput?.tokenUsage;
|
|
242
242
|
tokenUsages.push(ChainStore.getTokenUsage(chain._chainType(), chain.getModelName(), usage));
|
|
243
243
|
},
|
|
@@ -261,7 +261,7 @@ Your translation here:
|
|
|
261
261
|
*/
|
|
262
262
|
const AI_PREFIX = 'AI: ';
|
|
263
263
|
if (translationAnswerStr.includes(AI_PREFIX)) {
|
|
264
|
-
console.log(`
|
|
264
|
+
console.log(`CHAIN_STORE: Removing AI indicator from translation answer`);
|
|
265
265
|
translationAnswerStr = translationAnswerStr.substring(translationAnswerStr.indexOf(AI_PREFIX) + AI_PREFIX.length);
|
|
266
266
|
}
|
|
267
267
|
// Remove 'Your translation here:' if it is there.
|