Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: apply ddtrace workaround to chat generator #1470

Merged
merged 3 commits into from
Mar 5, 2025

Conversation

mathislucka
Copy link
Member

Related Issues

  • fixes #issue-number

Proposed Changes:

How did you test it?

Notes for the reviewer

Checklist

@mathislucka mathislucka requested a review from a team as a code owner March 5, 2025 15:42
@mathislucka mathislucka requested review from anakin87 and removed request for a team March 5, 2025 15:42
@julian-risch julian-risch requested review from julian-risch and removed request for anakin87 March 5, 2025 15:48
Copy link
Member

@julian-risch julian-risch left a comment

Choose a reason for hiding this comment

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

LGTM! 👍

@@ -497,7 +497,7 @@ async def _process_response_async(
:returns:
A dictionary containing the processed response as a list of ChatMessage objects.
"""
if isinstance(response, AsyncStream):
if streaming_callback is not None:
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if streaming_callback is not None:
# workaround for https://github.com/DataDog/dd-trace-py/issues/12562
if streaming_callback is not None:

@@ -458,7 +458,7 @@ def _process_response(
:param streaming_callback: A callback function that is called when a new token is received from the stream.
:returns: A dictionary containing the processed response as a list of ChatMessage objects.
"""
if isinstance(response, Stream):
if streaming_callback is not None:
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if streaming_callback is not None:
# workaround for https://github.com/DataDog/dd-trace-py/issues/12562
if streaming_callback is not None:

@julian-risch julian-risch merged commit 85ef15d into main Mar 5, 2025
10 checks passed
@julian-risch julian-risch deleted the fix/streaming-anthropic-chat-generator branch March 5, 2025 16:11
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