Highlights
- PHP 8.2+ is now required. Projects on PHP 8.1 will keep resolving to 2.7.x.
- New API features: JSON Schema for structured output and function declarations, multimodal function responses, server-side tool invocations, per-part media resolution,
ImageConfig::$imageSize, response metadata (responseId,modelStatus,finishMessage,urlContextMetadata,serviceTier), andimportFile()/getOperation()for file search stores. ClientFakenow supportsstartChat(), including multi-turn and streamed chats.- The README has been refreshed with current models and examples for all features.
Behavior changes
No public signatures changed, but a few behaviors did:
- Streamed requests that fail with a 5xx and a JSON error body now throw
ErrorExceptioninstead ofTransporterException, like regular requests (#187). - The chat history built by
streamSendMessage()keeps thoughts, function calls and tool calls as separate parts and keeps theirthoughtSignature. This fixes the next turn being rejected after a streamed function call, but$chat->history[$i]->partsmay look different than before (#183). - The
ValueErrormessages oftext()andparts()now end with the finish or block reason (#189).
What's Changed
Features
- Add new FinishReason, HarmCategory and MimeType values by @aydinfatih in #178
- Add response metadata fields by @aydinfatih in #179
- Add imageSize to ImageConfig by @aydinfatih in #180
- Support multimodal function responses by @aydinfatih in #181
- Support JSON Schema for structured output and function declarations by @aydinfatih in #182
- Support server-side tool invocations by @aydinfatih in #183
- Add media resolution per part by @aydinfatih in #184
- Add importFile and getOperation to file search stores by @aydinfatih in #185
Fixes
- Detect API errors returned wrapped in a list by @aydinfatih in #176
- Accept file names with the files/ prefix by @aydinfatih in #186
- Throw ErrorException for server errors on streamed requests by @aydinfatih in #187
- Support startChat() on ClientFake by @aydinfatih in #188
- Include finish and block reasons in quick accessor errors by @aydinfatih in #189
- Serialize the token id of logprobs candidates by @aydinfatih in #190
- Accept usage metadata without a total token count by @aydinfatih in #191
Maintenance
- Drop PHP 8.1 support and fix CI by @aydinfatih in #177
- Refresh the README by @aydinfatih in #192
Full Changelog: 2.7.4...2.8.0