-
-
Notifications
You must be signed in to change notification settings - Fork 599
feat(OpenAI): Support annotations in Chat response. (Web Search) #564
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(OpenAI): Support annotations in Chat response. (Web Search) #564
Conversation
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.
With a simple run of Pint - you'll probably have a large chunk of these cs issues resolved. So haven't done a thorough review.
You also want to make a test to assert the new object (annotations) is valid. You can see this pattern done on on logprobs. You basically can just extract the exact chunk of annotations to pass it to your new class (CreateResponseChoiceAnnotation
) so you can assert those are extracted properly.
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.
Some quick comments. Can you swap double quotes for single into the docblocks? I'll review more later
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.
Very close - works well, we just introduced an extra layer of arrays which needs to be removed.
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.
All looks good now. I tested it out with this sample and it works as I expect.
$result = OpenAI::chat()->create([
'model' => 'gpt-4o-mini-search-preview',
'messages' => [
[
'role' => 'user',
'content' => 'Could you find 2 articles on french drains for OSHAA certification?',
]
],
'web_search_options' => [
'user_location' => [
'type' => 'approximate',
'approximate' => [
'country' => 'US',
'city' => 'Tampa',
]
]
],
]);
I made a few changes to merge:
|
thanks! and congrats on 1st pr! |
What:
Description:
Enabling SDK's ability to use web_search_options and return annotations.
Related:
fixes: #552