From ca2326a258a01310102be61ca38d705fd847e251 Mon Sep 17 00:00:00 2001 From: Travis Fischer Date: Mon, 12 Jun 2023 17:25:19 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=8C=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- legacy/src/task.ts | 5 +++-- legacy/src/types.ts | 1 + legacy/test/calculator.test.ts | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/legacy/src/task.ts b/legacy/src/task.ts index e6c04782..8e08637d 100644 --- a/legacy/src/task.ts +++ b/legacy/src/task.ts @@ -54,7 +54,7 @@ export abstract class BaseTask { throw new Error(`clone not implemented for task "${this.name}"`) } - public retryConfig(retryConfig: types.RetryConfig) { + public retryConfig(retryConfig: types.RetryConfig): this { this._retryConfig = retryConfig return this } @@ -82,7 +82,8 @@ export abstract class BaseTask { attemptNumber: 0, metadata: { taskName: this.name, - taskId: this.id + taskId: this.id, + callId: this._agentic.idGeneratorFn() } } diff --git a/legacy/src/types.ts b/legacy/src/types.ts index b757b43d..f8665475 100644 --- a/legacy/src/types.ts +++ b/legacy/src/types.ts @@ -104,6 +104,7 @@ export interface TaskResponseMetadata extends Record { success?: boolean error?: Error numRetries?: number + callId?: string } export interface LLMTaskResponseMetadata< diff --git a/legacy/test/calculator.test.ts b/legacy/test/calculator.test.ts index f16f39f6..a12e0f5c 100644 --- a/legacy/test/calculator.test.ts +++ b/legacy/test/calculator.test.ts @@ -17,8 +17,9 @@ test('CalculatorTool', async (t) => { t.is(res2.result, 1) expectTypeOf(res2.result).toMatchTypeOf() - const { taskId, ...metadata } = res2.metadata + const { taskId, callId, ...metadata } = res2.metadata t.true(typeof taskId === 'string') + t.true(typeof callId === 'string') t.deepEqual(metadata, { success: true, taskName: 'calculator',