@cellaware/utils 7.0.0 → 7.0.2

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.
@@ -5,7 +5,7 @@ import { ModelName, ModelOptions } from './model.js';
5
5
  * output key is allowed. Output key is defaulted to `answer`.
6
6
  */
7
7
  export declare class SingleActionChain extends BaseChain {
8
- private displayName;
8
+ private _name;
9
9
  private llm;
10
10
  private _inputKeys;
11
11
  private _outputKey;
@@ -13,7 +13,7 @@ const TRANSLATION_CHAIN_NAME = 'translation_chain';
13
13
  export class SingleActionChain extends BaseChain {
14
14
  constructor(fields, name, inputKeys) {
15
15
  super(fields);
16
- Object.defineProperty(this, "displayName", {
16
+ Object.defineProperty(this, "_name", {
17
17
  enumerable: true,
18
18
  configurable: true,
19
19
  writable: true,
@@ -52,7 +52,7 @@ export class SingleActionChain extends BaseChain {
52
52
  if (inputKeys.length == 0) {
53
53
  throw new Error(`SINGLE_ACTION_CHAIN: Chain '${name}' needs at least one input key!`);
54
54
  }
55
- this.displayName = name;
55
+ this._name = name;
56
56
  this.llm = fields.llm;
57
57
  this._inputKeys = inputKeys;
58
58
  this._outputKey = 'answer';
@@ -77,7 +77,7 @@ export class SingleActionChain extends BaseChain {
77
77
  return output;
78
78
  }
79
79
  _chainType() {
80
- return this.displayName;
80
+ return this._name;
81
81
  }
82
82
  get inputKeys() {
83
83
  return this._inputKeys;
@@ -233,8 +233,10 @@ Your translation here:
233
233
  return chain.invoke(args, {
234
234
  callbacks: [
235
235
  {
236
- handleLLMEnd: async (cbOutput) => {
237
- tokenUsages.push(ChainStore.getTokenUsage(chain._chainType(), chain.getModelName(), cbOutput.llmOutput?.tokenUsage));
236
+ handleLLMEnd: (output) => {
237
+ console.log(output);
238
+ const usage = output?.llmOutput?.tokenUsage;
239
+ tokenUsages.push(ChainStore.getTokenUsage(chain._chainType(), chain.getModelName(), usage));
238
240
  },
239
241
  }
240
242
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cellaware/utils",
3
- "version": "7.0.0",
3
+ "version": "7.0.2",
4
4
  "description": "Cellaware Utilities for Node.js",
5
5
  "author": "Cellaware Technologies",
6
6
  "type": "module",