-
Notifications
You must be signed in to change notification settings - Fork 33
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
Add response_mime_type
support to generationConfig
#31
Comments
+1 |
+1
|
PR here, I will test this with a project shortly and update it as needed. Feel free to test for your purposes @Martin-Matchory @Sinitra @DrAliRagab and let me know if it works. |
I noticed this library has an open tested PR for mimetype support so I'll close this one. |
Yes, both This is a working example using laravel http: $response = Http::baseUrl($this->baseUrl)
->withHeaders([
'x-goog-api-key' => $this->apiKey,
])
->asJson()
->acceptJson()
->post("v1beta/models/{$this->model}:generateContent", [
'contents' => [
'parts' => [
[
'text' => $instructions,
],
]
],
'generationConfig' => [
'responseMimeType' => 'application/json',
'responseSchema' => [
'type' => 'object',
'properties' => [
'score' => [
'type' => 'number',
'minimum' => 0,
'maximum' => 1,
'format' => 'float',
],
],
'required' => ['score'],
],
],
]); |
According to google docs here https://ai.google.dev/docs/gemini_api_overview#json
We can instruct Gemini to return
json
by adding"response_mime_type": "application/json"
togenerationConfig
I hope this will be added to
generationConfig
The text was updated successfully, but these errors were encountered: