laravel/ai v0.3.2 → v0.6.3

This release is a substantial expansion of Laravel AI’s native provider support. Across v0.4.0 through v0.6.3, the package moves more integrations off Prism, adds several new gateways, and tightens up tool calling, structured output, and failover behavior.

What's new

  • OpenAI now uses a dedicated Responses API gateway instead of Prism, which exposes OpenAI-specific capabilities more directly while keeping the Ai facade, agents, and tools API unchanged. This adds support for features like previous_response_id, provider tool options such as web_search_preview and file_search, and native handling for streaming and structured output. (#275)

  • Anthropic now has a direct Messages API gateway, replacing the Prism path for text generation. It supports tool calling, streaming, attachment mapping, extended thinking replay, and native output_config structured output when the structured outputs beta is enabled. (#309)

  • Gemini now uses a direct native gateway for text generation, embeddings, and image generation. This removes the Prism bottleneck and adds direct support for Gemini’s own request/streaming flow, while later updates also switched structured output to response_json_schema so nested schemas and nullable fields work without schema-stripping workarounds. (#312, #364, #386)

  • Groq, Mistral, xAI, OpenRouter, Ollama, DeepSeek, Azure OpenAI, Voyage AI, and Bedrock all gain native or direct provider integrations in this range. Together, these additions broaden the set of providers you can use through the SDK’s unified interfaces for text generation, embeddings, reranking, transcription, image generation, and tool calling depending on provider support. (#311, #368, #310, #395, #396, #399, #404, #398, #270)

  • Failover handling is broader and more consistent across native gateways. The SDK now treats provider overload responses like 503 and 529 as failoverable errors alongside rate limits, so fallback providers can be tried for text, images, audio, transcription, embeddings, and reranking. Cohere, Jina, and Voyage AI were also brought onto the same failover error handling path. (#378, #423, #424)

  • Agents can now accept a timeout parameter in the contract, giving you a supported way to pass request timeout preferences through agent calls. Follow-up requests in tool loops also preserve configured timeout and other options instead of reverting to provider defaults. (#412, #363)

  • Provider tools now fit better with static analysis. HasTools::tools() accepts both Tool and ProviderTool, which means agents can return built-in provider tools like WebSearch alongside custom tools without PHPStan type errors. (#353)

Breaking changes

  • Gemini now uses the SDK’s direct gateway instead of Prism. Prism-specific Gemini provider options, middleware, tool mapping behavior, or event listeners no longer apply; move those customizations to the SDK’s provider options interface and direct gateway configuration. (#312)

  • OpenAI switched from PrismGateway to OpenAiGateway. The public API is unchanged, but any code that directly referenced or extended Prism-based OpenAI gateway internals will need to target the new gateway instead. (#275)

  • Laravel\Ai\Gateway\AnthropicFileGateway moved to Laravel\Ai\Gateway\Anthropic\AnthropicFileGateway. Update any direct class references or imports to the new namespace. (#309)

  • Laravel\Ai\Gateway\GeminiFileGateway and Laravel\Ai\Gateway\GeminiStoreGateway moved under Laravel\Ai\Gateway\Gemini\. Update imports to Laravel\Ai\Gateway\Gemini\GeminiFileGateway and Laravel\Ai\Gateway\Gemini\GeminiStoreGateway. (#382)

  • HandlesRateLimiting was removed and replaced with HandlesFailoverErrors. If you were using or extending the old trait in custom gateway code, you’ll need to migrate to the new trait. (#378)

  • OLLAMA_BASE_URL was renamed to OLLAMA_URL. Update your .env if you were using the previous variable name. (#396)

Fixes

  • OpenAI now respects a configured base URL instead of always calling https://api.openai.com/v1, which fixes custom endpoint setups. (#315)

  • Audio transcription uploads now use the correct filename extension based on the audio MIME type, fixing failures for formats like webm. (#316)

  • OpenAI file attachments now include the required filename for inline input_file content, while avoiding invalid filename mapping on ProviderDocument inputs. (#324, #360)

  • OpenAI strict tool mode now works with tools that return an empty schema, and nested object schemas correctly include additionalProperties: false where required. (#340, #357)

  • Configured provider options, timeout, temperature, and token limits are now preserved across tool-call follow-up requests instead of being dropped after the first request. (#338, #340, #363)

  • Agent::fake() works again for Mistral-backed agents instead of falling through to real HTTP requests. (#375)

  • Agents using HasStructuredOutput no longer crash when schema() returns an empty array; they now fall back cleanly to plain text responses. (#391)

  • Gemini tool-call continuations and structured output handling were corrected to avoid HTTP 400 errors, including fixes for nullable tool parameters, empty argument payloads, and invalid replay fields in continuation requests. (#386, #409)

  • Anthropic now replays empty server_tool_use.input values as objects instead of arrays, fixing invalid request errors in assistant history replay. (#389)

  • Mistral transcription fixes include the correct default transcription model and proper handling for diarize(). (#325, #385)

  • DeepSeek usage statistics now include cache token counts, inference token details, and completion token details parsing. (#435)

Other notable changes

  • The remaining Prism dependency and dead Prism gateway code were removed as more providers moved to native gateways. (#414)
  • Anthropic’s default “smartest” model now points to Claude Opus 4.7. (#413)
  • ElevenLabs provider gateway instances are now memoized instead of being recreated on each access. (#427)

Contributors

@tott, @rspahni, @ipalaus, @jackbayliss, @sumaiazaman, @maherelgamil, @MrPunyapal, @aaronlei, @pushpak1300, @AnnoyingTechnology, @radumetes, @Button99, @qwertyquest, @CodeWrap, @NoelDeMartin, @dash8x, @Tiagospem

Only a subset of merged work was shown here because the merged PR list was truncated.

Only the most active 50 of 57 merged PRs were included. See the full compare view.