From 45058c9253a3f457367e07c51bc3a5a2c7a1a379 Mon Sep 17 00:00:00 2001 From: William FH <13333726+hinthornw@users.noreply.github.com> Date: Wed, 20 Sep 2023 20:31:47 -0700 Subject: [PATCH] 0.0.39 (#230) --- js/package.json | 2 +- js/src/client.ts | 5 ++++- js/src/schemas.ts | 4 ++-- python/langsmith/client.py | 6 +++++- python/langsmith/schemas.py | 2 +- python/pyproject.toml | 2 +- 6 files changed, 14 insertions(+), 7 deletions(-) diff --git a/js/package.json b/js/package.json index 6df25fd13..56bc56701 100644 --- a/js/package.json +++ b/js/package.json @@ -1,6 +1,6 @@ { "name": "langsmith", - "version": "0.0.38", + "version": "0.0.39", "description": "Client library to connect to the LangSmith LLM Tracing and Evaluation Platform.", "files": [ "dist/", diff --git a/js/src/client.ts b/js/src/client.ts index 823a34b39..659bb6e78 100644 --- a/js/src/client.ts +++ b/js/src/client.ts @@ -348,7 +348,10 @@ export class Client { const childRuns = await toArray(this.listRuns({ id: run.child_run_ids })); const treemap: { [key: string]: Run[] } = {}; const runs: { [key: string]: Run } = {}; - childRuns.sort((a, b) => a.dotted_order.localeCompare(b.dotted_order)); + // TODO: make dotted order required when the migration finishes + childRuns.sort((a, b) => + (a?.dotted_order ?? "").localeCompare(b?.dotted_order ?? "") + ); for (const childRun of childRuns) { if ( childRun.parent_run_id === null || diff --git a/js/src/schemas.ts b/js/src/schemas.ts index 51c608144..168175bca 100644 --- a/js/src/schemas.ts +++ b/js/src/schemas.ts @@ -149,7 +149,7 @@ export interface Run extends BaseRun { /** IDs of parent runs, if multiple exist. */ parent_run_ids?: string[]; /**Unique ID assigned to every run within this nested trace.**/ - trace_id: string; + trace_id?: string; /** * The dotted order for the run. @@ -163,7 +163,7 @@ export interface Run extends BaseRun { * - 20230914T223155647Z1b64098b-4ab7-43f6-afee-992304f198d8.20230914T223155649Z809ed3a2-0172-4f4d-8a02-a64e9b7a0f8a * - 20230915T223155647Z1b64098b-4ab7-43f6-afee-992304f198d8.20230914T223155650Zc8d9f4c5-6c5a-4b2d-9b1c-3d9d7a7c5c7c */ - dotted_order: string; + dotted_order?: string; } export interface RunCreate extends BaseRun { diff --git a/python/langsmith/client.py b/python/langsmith/client.py index b5789406a..66b13ac0b 100644 --- a/python/langsmith/client.py +++ b/python/langsmith/client.py @@ -719,7 +719,11 @@ def _load_child_runs(self, run: ls_schemas.Run) -> ls_schemas.Run: list ) runs: Dict[uuid.UUID, ls_schemas.Run] = {} - for child_run in sorted(child_runs, key=lambda r: r.dotted_order): + for child_run in sorted( + # TODO: Remove execution_order once it's no longer used + child_runs, + key=lambda r: r.dotted_order or str(r.execution_order), + ): if child_run.parent_run_id is None: raise ls_utils.LangSmithError(f"Child run {child_run.id} has no parent") treemap[child_run.parent_run_id].append(child_run) diff --git a/python/langsmith/schemas.py b/python/langsmith/schemas.py index 1a39d3f52..a13cb80ef 100644 --- a/python/langsmith/schemas.py +++ b/python/langsmith/schemas.py @@ -211,7 +211,7 @@ class Run(RunBase): """List of parent run IDs.""" trace_id: Optional[UUID] = None """Unique ID assigned to every run within this nested trace.""" - dotted_order: str = "" + dotted_order: Optional[str] = None """Dotted order for the run. This is a string composed of {time}{run-uuid}.* so that a trace can be diff --git a/python/pyproject.toml b/python/pyproject.toml index 40d969616..0871a63b2 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "langsmith" -version = "0.0.38" +version = "0.0.39" description = "Client library to connect to the LangSmith LLM Tracing and Evaluation Platform." authors = ["LangChain "] license = "MIT"