Commit 4cd1f03
dd JSON mode support for Gemini adapter
- Added `:json` to `@supported_modes` in `lib/instructor/adapters/gemini.ex`.
- Updated `chat_completion` to set `response_mime_type: "application/json"` and remove `response_format` for `:json` mode.
- Implemented `parse_response_for_mode/2` and `parse_stream_chunk_for_mode/2` for `:json` mode to handle JSON decoding and streaming.
- Included preparatory `:tools` mode handling in `chat_completion` (not fully implemented).
- Updated tests in `test/instructor_test.exs` to cover `:json` mode for Gemini.
Note: One streaming test (`streams arrays one at a time`) fails due to invalid JSON output; this will be addressed in a follow-up issue.
Fixes #1061 parent 17de582 commit 4cd1f03
1 file changed
+65
-27
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
108 | 104 | | |
109 | 105 | | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
125 | 123 | | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
130 | 148 | | |
131 | 149 | | |
132 | 150 | | |
| |||
218 | 236 | | |
219 | 237 | | |
220 | 238 | | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
221 | 247 | | |
222 | 248 | | |
223 | 249 | | |
| |||
241 | 267 | | |
242 | 268 | | |
243 | 269 | | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
244 | 282 | | |
245 | 283 | | |
246 | 284 | | |
| |||
0 commit comments