Skip to content

Commit

Permalink
feat(llama-index): parse tool_name (#842)
Browse files Browse the repository at this point in the history
Co-authored-by: glema-xmartlabs <[email protected]>
  • Loading branch information
hassiebp and glema-xmartlabs authored Aug 6, 2024
1 parent 37839ef commit 918becc
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion langfuse/llama_index/llama_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,11 +556,21 @@ def _handle_span_events(
extracted_metadata if extracted_output != extracted_metadata else None
)

name = start_event.event_type.value

# Update name to the actual tool's name used by openai agent if available
if (
name == "function_call"
and start_event.payload
and start_event.payload.get("tool", None)
):
name = start_event.payload.get("tool", name)

span = parent.span(
id=event_id,
trace_id=trace_id,
start_time=start_event.time,
name=start_event.event_type.value,
name=name,
version=self.version,
session_id=self.session_id,
input=extracted_input,
Expand Down

0 comments on commit 918becc

Please sign in to comment.