diff --git a/parea/utils/trace_integrations/langchain.py b/parea/utils/trace_integrations/langchain.py index 879adce8..df529674 100644 --- a/parea/utils/trace_integrations/langchain.py +++ b/parea/utils/trace_integrations/langchain.py @@ -28,7 +28,7 @@ def _persist_run(self, run: Union[Run, LLMRun, ChainRun, ToolRun]) -> None: data = run.dict() data["_parea_root_trace_id"] = self._parea_root_trace_id or None # check if run has an attribute execution order - if hasattr(run, "execution_order") and run.execution_order == 1: + if (hasattr(run, "execution_order") and run.execution_order == 1) or run.parent_run_id is None: data["_parea_parent_trace_id"] = self._parea_parent_trace_id or None parea_logger.record_vendor_log(data, TraceIntegrations.LANGCHAIN) @@ -36,7 +36,7 @@ def get_parent_trace_id(self) -> UUID: return self.parent_trace_id def _on_run_create(self, run: Run) -> None: - if hasattr(run, "execution_order") and run.execution_order == 1: + if (hasattr(run, "execution_order") and run.execution_order == 1) or run.parent_run_id is None: # need to check if any traces already exist self._parea_root_trace_id = get_root_trace_id() if parent_trace_id := get_current_trace_id(): diff --git a/pyproject.toml b/pyproject.toml index 47c60a0c..1f7f2aef 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "poetry.core.masonry.api" [tool.poetry] name = "parea-ai" packages = [{ include = "parea" }] -version = "0.2.166" +version = "0.2.167a0" description = "Parea python sdk" readme = "README.md" authors = ["joel-parea-ai "]