Skip to content

Commit

Permalink
feat: format llm workflow trace
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhouhaoJiang committed Jun 21, 2024
1 parent 16617ff commit 900b5ea
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion api/services/ops_trace/langfuse_trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,10 @@ def workflow_trace(self, workflow_run: WorkflowRun, **kwargs):
node_name = node_execution.title
node_type = node_execution.node_type
status = node_execution.status
inputs = json.loads(node_execution.inputs) if node_execution.inputs else {}
if node_type == "llm":
inputs = json.loads(node_execution.process_data).get("prompts", {})
else:
inputs = json.loads(node_execution.inputs) if node_execution.inputs else {}
outputs = (
json.loads(node_execution.outputs) if node_execution.outputs else {}
)
Expand Down
5 changes: 4 additions & 1 deletion api/services/ops_trace/langsmith_trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,10 @@ def workflow_trace(self, workflow_run: WorkflowRun, **kwargs):
node_name = node_execution.title
node_type = node_execution.node_type
status = node_execution.status
inputs = json.loads(node_execution.inputs) if node_execution.inputs else {}
if node_type == "llm":
inputs = json.loads(node_execution.process_data).get("prompts", {})
else:
inputs = json.loads(node_execution.inputs) if node_execution.inputs else {}
outputs = (
json.loads(node_execution.outputs) if node_execution.outputs else {}
)
Expand Down

0 comments on commit 900b5ea

Please sign in to comment.