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

VertexAI handle streaming requests #3331

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

aabmass
Copy link
Member

@aabmass aabmass commented Mar 5, 2025

Fixes #3297

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • New tests copied from non streaming test cases

Does This PR Require a Core Repo Change?

  • No.

Checklist:

See contributing.md for styleguide, changelog guidelines, and more.

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

WIP using shared context manager

Properly implement uninstrument

Shared code with a contextmanager

tmp
@aabmass aabmass changed the title Vertex stream VertexAI handle streaming requests Mar 6, 2025
@aabmass aabmass marked this pull request as ready for review March 6, 2025 17:47
@aabmass aabmass requested a review from a team as a code owner March 6, 2025 17:47
get_genai_response_attributes(response)
)

for event in response_to_events(
Copy link
Contributor

@xrmx xrmx Mar 10, 2025

Choose a reason for hiding this comment

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

I'm not sure this is the case for vertexai too but in other instrumentations we pass the span explicitly to the code sending events. This is because at the time we evaluate the stream response the span has been already closed

Copy link
Member Author

@aabmass aabmass Mar 11, 2025

Choose a reason for hiding this comment

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

This is because at the time we evaluate the stream response the span has been already closed

Isn't the span supposed to remain un-finished until the last response is received?

Anyways, calls to this function happen under the yield stmt on L148 before the "with" block from L117 exits. So the span should be accessible in Context even if it were ended.

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.

opentelemetry-instrumentation-vertexai: support StreamGenerateContent
9 participants