Skip to content

Conversation

@hassiebp
Copy link
Contributor

@hassiebp hassiebp commented Jul 4, 2025

Important

Fixes metadata validation in _get_langfuse_data_from_kwargs to handle NotGiven type in langfuse/openai.py.

  • Behavior:
    • In langfuse/openai.py, _get_langfuse_data_from_kwargs now checks if metadata is an instance of NotGiven before validating it as a dictionary.
    • Prevents TypeError when metadata is not provided in kwargs.

This description was created by Ellipsis for 0959b2b. You can customize this summary. It will automatically update as commits are pushed.

Greptile Summary

Disclaimer: Experimental PR review

Improves OpenAI SDK compatibility by fixing metadata validation to handle NotGiven type, particularly important for OpenAI Agent SDK integration.

  • Modified langfuse/openai.py to properly handle NotGiven sentinel value in metadata parameter validation
  • Prevents incorrect validation errors when metadata is legitimately NotGiven by OpenAI SDK
  • Enhances compatibility with OpenAI Agent SDK and similar features that use NotGiven as a valid state

@hassiebp hassiebp enabled auto-merge (squash) July 4, 2025 12:35
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 reviewed, no comments
Edit PR Review Bot Settings | Greptile

if metadata is not None and not isinstance(metadata, dict):
if (
metadata is not None
and not isinstance(metadata, NotGiven)
Copy link
Contributor

Choose a reason for hiding this comment

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

The new check for NotGiven is good; consider adding an inline comment explaining why NotGiven is skipped in type validation.

Suggested change
and not isinstance(metadata, NotGiven)
and not isinstance(metadata, NotGiven) # NotGiven is a sentinel for missing values, not a dict

@hassiebp hassiebp disabled auto-merge July 4, 2025 12:53
@hassiebp hassiebp merged commit 9c6a71d into main Jul 4, 2025
10 checks passed
@hassiebp hassiebp deleted the fix-oai-agentsdk-metadata branch July 4, 2025 12:53
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