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.

@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

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