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

feat(client): add ._request_id property to object responses #1707

Merged
merged 2 commits into from
Sep 17, 2024

Conversation

RobertCraigie
Copy link
Collaborator

No description provided.

@stainless-bot stainless-bot force-pushed the next branch 2 times, most recently from c6d1822 to 06bd42e Compare September 12, 2024 17:03
@stainless-bot stainless-bot force-pushed the robert/add-request-id branch 3 times, most recently from 58eeaf2 to e3493e2 Compare September 16, 2024 11:59
@RobertCraigie RobertCraigie changed the base branch from next to main September 16, 2024 11:59
@RobertCraigie RobertCraigie marked this pull request as ready for review September 16, 2024 12:23
@RobertCraigie RobertCraigie requested a review from a team as a code owner September 16, 2024 12:23
@RobertCraigie RobertCraigie changed the base branch from main to next September 16, 2024 12:23
@kwhinnery-openai
Copy link

Nice - this seems like a good thing to do to all the SDKs.

@RobertCraigie
Copy link
Collaborator Author

yup I'm working on this for the Node SDK as well :)

Copy link

@RahulVadisetty91 RahulVadisetty91 left a comment

Choose a reason for hiding this comment

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

This script is well-structured and extremely useful for anyone working with Pydantic models, especially when managing compatibility between Pydantic v1 and v2.

@stainless-bot stainless-bot force-pushed the robert/add-request-id branch 2 times, most recently from eeaa015 to d2f6e40 Compare September 17, 2024 11:49
README.md Outdated Show resolved Hide resolved
@wilson97
Copy link

Is it possible to log the request id for async streaming as well? Right now I get the error 'AsyncStream' object has no attribute '_request_id'.

@RobertCraigie
Copy link
Collaborator Author

@wilson97 right now you can do this

stream = await client.chat.completions.create(..., stream=True)
stream.response.headers.get('x-request-id')  # req_xxx

but I don't see a reason not to add a request_id property to the Stream classes, will add that soon

cgayapr pushed a commit to cgayapr/openai-python that referenced this pull request Dec 14, 2024
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.

5 participants