Skip to content

Commit

Permalink
Merge pull request #923 from parea-ai/langchain-identify-root-fix
Browse files Browse the repository at this point in the history
handle older langchain version
  • Loading branch information
jalexanderII committed Jun 4, 2024
2 parents 82f32f0 + dd5d976 commit 2d1d331
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions parea/utils/trace_integrations/langchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ 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)

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():
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>"]
Expand Down

0 comments on commit 2d1d331

Please sign in to comment.