Skip to content

Conversation

@hassiebp
Copy link
Contributor

@hassiebp hassiebp commented Jan 31, 2025

Important

Fix serialization issues in LlamaIndexSpanHandler by handling BaseModel and removing Context instances from arguments.

  • Behavior:
    • In _parse_output_metadata(), handle BaseModel instances by converting them to dictionaries.
    • In _parse_input(), remove Context instances from arguments to avoid serialization issues.
  • Imports:
    • Add BaseModel import from pydantic.
    • Add Context import from llama_index.core.workflow.

This description was created by Ellipsis for d4c0df1. It will automatically update as commits are pushed.

Greptile Summary

Disclaimer: Experimental PR review

Enhanced LlamaIndex integration by improving serialization handling for Pydantic BaseModel results and Context objects in the span handler.

  • Added proper serialization support for Pydantic BaseModel results in langfuse/llama_index/_span_handler.py
  • Added filtering for llama_index Context objects to prevent serialization errors
  • Improved type safety by explicitly importing BaseModel from pydantic
  • Added handling for raw dictionary and BaseModel usage data in token usage parsing

fix llamaindex-workflow integration
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile

@hassiebp hassiebp merged commit 8547164 into main Jan 31, 2025
10 checks passed
@hassiebp hassiebp deleted the fix-llama-workflows branch January 31, 2025 10:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants