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

✨ Added support for response formats #3

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

jeffreyvr
Copy link

Added the option to set a response format including a test.

The Grok API supports setting a response format, also refered to structured outputs, for the grok-2-1212 model.

$options = new ChatOptions(model: Model::GROK_2_1212, temperature: 0.7, stream: false, responseFormat: ['type' => 'json_object']);
$response = $client->chat($messages, $options);

@thefeqy
Copy link
Contributor

thefeqy commented Mar 7, 2025

Thanks for your contribution. I just need to test it and merge it right away.

@thefeqy
Copy link
Contributor

thefeqy commented Mar 7, 2025

Great job on this!

Just a small issue—our tests no longer interact with the actual Grok API. Instead, we now use fake responses, which is causing the tests you've written to fail.

image

There's also a minor conflict with the README.md file.

Thanks for your contribution! Looking forward to merging this PR soon. 🚀

@jeffreyvr
Copy link
Author

Thanks! Conflicts have been resolved. Made a minor change to the mock response to allow for setting specific data to be returned.

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.

2 participants