Skip to content

Conversation

@hassiebp
Copy link
Contributor

@hassiebp hassiebp commented May 15, 2025

Important

Adds usage_details key to _create_langfuse_update() in langfuse/openai.py for detailed usage data.

  • Behavior:
    • In langfuse/openai.py, _create_langfuse_update() now adds usage_details key with parsed usage data, in addition to usage key.
  • Misc:
    • No other changes or refactoring in the code.

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

Greptile Summary

Disclaimer: Experimental PR review

Updates OpenAI integration to fix usage parsing for streamed responses, ensuring consistent token tracking across different response types and maintaining backward compatibility.

  • Modified langfuse/openai.py to store usage data in both 'usage' and 'usage_details' fields for backward compatibility
  • Added support for token details in OpenAiCompletionUsageSchema and OpenAiResponseUsageSchema
  • Updated usage parsing logic in _create_langfuse_update function to handle streamed responses correctly

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 0b52066 into main May 15, 2025
8 of 10 checks passed
@hassiebp hassiebp deleted the fix-openai-streamed-token-parsing branch May 15, 2025 12:36
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