diff --git a/python/langsmith/run_helpers.py b/python/langsmith/run_helpers.py index e09bdfc5e..b21185a16 100644 --- a/python/langsmith/run_helpers.py +++ b/python/langsmith/run_helpers.py @@ -287,7 +287,14 @@ async def async_generator_wrapper( *args, run_tree=run_container["new_run"], **kwargs ) else: + # TODO: Nesting is ambiguous if a nested traceable function is only + # called mid-generation. Need to explicitly accept run_tree to get + # around this. async_gen_result = func(*args, **kwargs) + _PARENT_RUN_TREE.set(run_container["new_run"].parent_run) + _PROJECT_NAME.set(run_container["outer_project"]) + _TAGS.set(run_container["outer_tags"]) + _METADATA.set(run_container["outer_metadata"]) async for item in async_gen_result: results.append(item) yield item @@ -398,7 +405,14 @@ def generator_wrapper( *args, run_tree=run_container["new_run"], **kwargs ) else: + # TODO: Nesting is ambiguous if a nested traceable function is only + # called mid-generation. Need to explicitly accept run_tree to get + # around this. generator_result = func(*args, **kwargs) + _PARENT_RUN_TREE.set(run_container["new_run"].parent_run) + _PROJECT_NAME.set(run_container["outer_project"]) + _TAGS.set(run_container["outer_tags"]) + _METADATA.set(run_container["outer_metadata"]) for item in generator_result: results.append(item) yield item diff --git a/python/pyproject.toml b/python/pyproject.toml index 9136db2c7..376a265ca 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "langsmith" -version = "0.0.45" +version = "0.0.46" description = "Client library to connect to the LangSmith LLM Tracing and Evaluation Platform." authors = ["LangChain "] license = "MIT"