-
Notifications
You must be signed in to change notification settings - Fork 14.3k
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
openai: raw response headers #24150
openai: raw response headers #24150
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
@@ -510,7 +512,9 @@ def _stream( | |||
kwargs["stream"] = True | |||
payload = self._get_request_payload(messages, stop=stop, **kwargs) | |||
default_chunk_class: Type[BaseMessageChunk] = AIMessageChunk | |||
with self.client.create(**payload) as response: | |||
with self.client.with_raw_response.create(**payload) as raw_response: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tradeoff: this code is more maintainable, but it won't tolerate custom client/async_client that doesn't implement with_raw_response (i.e. non-openai clients)
Could make it tolerate this by only raw-responsing if include_response_headers is set to true.
I'm generally in favor of maintainability here. Happy to discuss.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
switching back to not break things
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these were just copypasta from openai but rely on openai package internals. delete.
Fixes small issues introduced in #24150 (unreleased).
No description provided.