From c373ffbb5360b3513b3016acde69640cce8a5cd0 Mon Sep 17 00:00:00 2001 From: William FH <13333726+hinthornw@users.noreply.github.com> Date: Mon, 6 Nov 2023 10:21:09 -0800 Subject: [PATCH] Fix run info type (#284) --- python/langsmith/client.py | 12 +++++++++--- python/pyproject.toml | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/python/langsmith/client.py b/python/langsmith/client.py index 76c5fb6c0..92bd26540 100644 --- a/python/langsmith/client.py +++ b/python/langsmith/client.py @@ -2036,9 +2036,15 @@ def create_feedback( feedback_source.metadata["__run"] = {"run_id": str(source_run_id)} if feedback_source.metadata and "__run" in feedback_source.metadata: # Validate that the linked run ID is a valid UUID - feedback_source.metadata["__run"]["run_id"] = str( - _as_uuid(feedback_source.metadata["__run"]["run_id"]) - ) + # Run info may be a base model or dict. + _run_meta: Union[dict, Any] = feedback_source.metadata["__run"] + if hasattr(_run_meta, "dict") and callable(_run_meta): + _run_meta = _run_meta.dict() + if "run_id" in _run_meta: + _run_meta["run_id"] = str( + _as_uuid(feedback_source.metadata["__run"]["run_id"]) + ) + feedback_source.metadata["__run"] = _run_meta feedback = ls_schemas.FeedbackCreate( id=feedback_id or uuid.uuid4(), run_id=run_id, diff --git a/python/pyproject.toml b/python/pyproject.toml index c59cef81c..2fab8a999 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "langsmith" -version = "0.0.57" +version = "0.0.58" description = "Client library to connect to the LangSmith LLM Tracing and Evaluation Platform." authors = ["LangChain "] license = "MIT"