feat: Add streaming support to Cohere instrumentation#4421
Draft
Nik-Reddy wants to merge 2 commits intoopen-telemetry:mainfrom
Draft
feat: Add streaming support to Cohere instrumentation#4421Nik-Reddy wants to merge 2 commits intoopen-telemetry:mainfrom
Nik-Reddy wants to merge 2 commits intoopen-telemetry:mainfrom
Conversation
952becc to
1ceb6f4
Compare
Author
Implements initial Cohere instrumentation following the GenAI semantic conventions. Supports sync and async chat completions with token usage, content capture, and error handling. Streaming support will follow in a separate PR. Ref open-telemetry#3050
Extends the Cohere instrumentation with streaming chat support. Adds CohereStreamWrapper and AsyncCohereStreamWrapper for chat_stream operations. Ref open-telemetry#3050
1ceb6f4 to
8f9740c
Compare
Author
|
Hi @lzchen (issue #3050 assignee), @lmolkova, @MikeGoldsmith - this PR adds streaming support ( |
Member
|
As this depends on #4418 - let's move this PR into draft until that one is accepted and merged so you don't have to rework this PR with any subsequent changes. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds streaming support to the Cohere instrumentation introduced in #4418. This PR wraps
V2Client.chat_streamandAsyncV2Client.chat_streamwithCohereStreamWrapper/AsyncCohereStreamWrapper.Split from #4418 per reviewer feedback from @JWinermaSplunk.
Depends on #4418 (chat completions base).
Ref #3050
Changes
patch.py: AddedCohereStreamWrapperandAsyncCohereStreamWrapperfor streaming chat responses__init__.py: Addedchat_streamwrapping for bothV2ClientandAsyncV2Clientchat_streamType of change
How Has This Been Tested?
All 23 tests pass (21 from base chat + 2 streaming tests).
Does This PR Require a Core Repo Change?
Checklist: