diff --git a/js/src/client.ts b/js/src/client.ts index b7ef0bee..95d0216b 100644 --- a/js/src/client.ts +++ b/js/src/client.ts @@ -224,8 +224,8 @@ interface CreateRunParams { inputs: KVMap; run_type: string; id?: string; - start_time?: number; - end_time?: number; + start_time?: number | string; + end_time?: number | string; extra?: KVMap; error?: string; serialized?: object; diff --git a/js/src/langchain.ts b/js/src/langchain.ts index ce815de9..3cf20b01 100644 --- a/js/src/langchain.ts +++ b/js/src/langchain.ts @@ -71,7 +71,7 @@ export async function getLangchainCallbacks( if (!current || visited.has(current.id)) continue; visited.add(current.id); - runMap.set(current.id, current); + runMap.set(current.id, current as Run); if (current.child_runs) { queue.push(...current.child_runs); } diff --git a/js/src/run_trees.ts b/js/src/run_trees.ts index 64cc7fb2..ba0cc866 100644 --- a/js/src/run_trees.ts +++ b/js/src/run_trees.ts @@ -14,7 +14,7 @@ function stripNonAlphanumeric(input: string) { } export function convertToDottedOrderFormat( - epoch: number, + epoch: number | string, runId: string, executionOrder = 1 ) { @@ -154,8 +154,8 @@ export class RunTree implements BaseRun { project_name: string; parent_run?: RunTree; child_runs: RunTree[]; - start_time: number; - end_time?: number; + start_time: number | string; + end_time?: number | string; extra: KVMap; tags?: string[]; error?: string; diff --git a/js/src/schemas.ts b/js/src/schemas.ts index 274a76bb..641f0be9 100644 --- a/js/src/schemas.ts +++ b/js/src/schemas.ts @@ -75,13 +75,13 @@ export interface BaseRun { name: string; /** The epoch time at which the run started, if available. */ - start_time?: number; + start_time?: number | string; /** Specifies the type of run (tool, chain, llm, etc.). */ run_type: string; /** The epoch time at which the run ended, if applicable. */ - end_time?: number; + end_time?: number | string; /** Any additional metadata or settings for the run. */ extra?: KVMap; @@ -148,6 +148,10 @@ export interface Run extends BaseRun { /** The ID of the project that owns this run. */ session_id?: string; + start_time: string; + + end_time?: string; + /** IDs of any child runs spawned by this run. */ child_run_ids?: string[]; @@ -199,7 +203,7 @@ export interface RunCreate extends BaseRun { export interface RunUpdate { id?: string; - end_time?: number; + end_time?: number | string; extra?: KVMap; tags?: string[]; error?: string; @@ -501,4 +505,10 @@ export interface RunWithAnnotationQueueInfo extends BaseRun { /** The time this run was added to the queue. */ added_at?: string; + + /** The ISO 8601 formatted string representing the start time of the run. */ + start_time: string; + + /** The ISO 8601 formatted string representing the end time of the run, if available. */ + end_time?: string; } diff --git a/js/src/tests/client.int.test.ts b/js/src/tests/client.int.test.ts index ddf160fa..4ce6952e 100644 --- a/js/src/tests/client.int.test.ts +++ b/js/src/tests/client.int.test.ts @@ -490,6 +490,7 @@ test.concurrent( id: runId, name: "foo", run_type: "llm", + start_time: new Date().toISOString(), inputs: { input: "hello world" }, outputs: { output: "hi there" }, };