From c3053e63d0905b562066f2fcd0d24cb9d69d1f93 Mon Sep 17 00:00:00 2001 From: William FH <13333726+hinthornw@users.noreply.github.com> Date: Fri, 22 Nov 2024 15:06:13 -0800 Subject: [PATCH] Refrain from overwriting experiment metadata (#1250) --- python/langsmith/evaluation/_arunner.py | 8 ++++++-- python/langsmith/evaluation/_runner.py | 8 ++++++-- python/pyproject.toml | 2 +- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/python/langsmith/evaluation/_arunner.py b/python/langsmith/evaluation/_arunner.py index a8799b083..073014970 100644 --- a/python/langsmith/evaluation/_arunner.py +++ b/python/langsmith/evaluation/_arunner.py @@ -843,8 +843,12 @@ async def _aend(self) -> None: project_metadata["dataset_splits"] = await self._get_dataset_splits() self.client.update_project( experiment.id, - end_time=datetime.datetime.now(datetime.timezone.utc), - metadata=project_metadata, + end_time=experiment.end_time + or datetime.datetime.now(datetime.timezone.utc), + metadata={ + **experiment.metadata, + **project_metadata, + }, ) diff --git a/python/langsmith/evaluation/_runner.py b/python/langsmith/evaluation/_runner.py index 2339601c6..f4e2076ec 100644 --- a/python/langsmith/evaluation/_runner.py +++ b/python/langsmith/evaluation/_runner.py @@ -1587,8 +1587,12 @@ def _end(self) -> None: project_metadata["dataset_splits"] = self._get_dataset_splits() self.client.update_project( experiment.id, - end_time=datetime.datetime.now(datetime.timezone.utc), - metadata=project_metadata, + end_time=experiment.end_time + or datetime.datetime.now(datetime.timezone.utc), + metadata={ + **experiment.metadata, + **project_metadata, + }, ) diff --git a/python/pyproject.toml b/python/pyproject.toml index d6425e255..12e89ba74 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "langsmith" -version = "0.1.144" +version = "0.1.145" description = "Client library to connect to the LangSmith LLM Tracing and Evaluation Platform." authors = ["LangChain "] license = "MIT"