Skip to content

Conversation

@hassiebp
Copy link
Contributor

@hassiebp hassiebp commented Nov 20, 2024

Important

Fixes JSON serialization of output in _handle_call_result in langfuse_decorator.py and updates test_media in test_decorators.py to verify media handling.

  • Behavior:
    • In langfuse_decorator.py, _handle_call_result now directly serializes result using json.dumps and json.loads with EventSerializer to ensure proper JSON serialization.
  • Tests:
    • In test_decorators.py, test_media is updated to check that media references in input, output, and metadata are correctly serialized and deserialized.

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

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.

Disclaimer: Experimental PR review

PR Summary

Improved media object handling in the Python SDK's decorator system by consolidating JSON serialization of outputs for more reliable media object processing.

  • Modified _handle_call_result in /langfuse/decorators/langfuse_decorator.py to use single-step JSON serialization for outputs
  • Added media object support tests in /tests/test_decorators.py to verify nested media handling within input/output/metadata dictionaries
  • Enhanced decorator update functionality to properly handle LangfuseMedia objects in trace updates

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

@hassiebp hassiebp enabled auto-merge (squash) November 20, 2024 12:48
@hassiebp hassiebp merged commit 91231ea into main Nov 20, 2024
11 checks passed
@hassiebp hassiebp deleted the fix-media-decorator-output branch November 20, 2024 13:06
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.

2 participants