creativecrafts/laravel-ai-assistant
A Laravel package for adding an AI-powered assistant to your application. It offers a simple, configurable way to integrate conversational AI features, manage prompts and responses, and connect your app to supported AI providers.
This release is a quality-of-life upgrade for the Responses API adapter: you can now pass Chat Completions-style messages payloads and let the package transform them into Responses API input blocks automatically. It is backwards compatible, but it is still a beta, so pin the version in composer.json before relying on it.
Minimal setup:
InputBuilder. The first thing to inspect is how your adapter maps a request payload into input — especially the new messages → input conversion path.$response = $client->responses()->create([
'model' => '...',
'messages' => [
['role' => 'user', 'content' => 'Summarize this ticket.'],
],
]);
With 3.0.31-beta, the adapter will convert that messages array into a single user message with an input_text block, remove messages, and send input to the Responses API.
Where to look first:
InputBuilder::message() — it now sets both input and the legacy message key.file_id handling.Chat-style passthrough for migrations. If you are moving existing Chat Completions code to the Responses API, keep your existing messages arrays initially. The adapter converts strings and type: text|input_text content into input_text blocks, and image content into input_image blocks. This is the lowest-friction migration path.
Prefer explicit input for new code. Use InputBuilder or construct input blocks directly. Explicit input is preserved and takes precedence; the adapter only converts messages when input is not provided. This keeps your intent clear and avoids relying on implicit normalization.
Multimodal requests. Image content is normalized from either a string or { url: ... } into input_image with image_url. If you already use type: input_image, the adapter supports both image_url and file_id. Use file_id for previously uploaded files, especially large images, rather than re-sending URLs or base64 payloads.
Builder usage. InputBuilder::message() now sets input to a single user message with an input_text block while retaining the original message key for backward compatibility. Use the builder when you want a consistent, Response-API-native payload but still need compatibility with older code paths or tests that inspect message.
Integration tips.
input payload rather than only the raw messages input, since messages is removed after conversion.messages is removed after conversion. Do not rely on the original messages key being present in the outgoing payload or in request logs after the adapter runs. If you need an audit trail, capture the input before transformation or log the resulting input.input wins. If both input and messages are present, the adapter preserves input and removes messages. This is useful for overrides, but it can also hide a stale messages array — check your payloads when debugging unexpected behavior.InputBuilder::message(). The builder preserves the message key while also setting input. That is intentional for backward compatibility, but strict payload assertions or serializers may see both. Assert on input for Responses API behavior and on message only for legacy compatibility.{ url: ... } under type: image_url becomes input_image with image_url. If you already send input_image, make sure you use either image_url or file_id as expected. Malformed nested arrays are the most likely source of conversion surprises.input looks wrong, check whether you accidentally supplied input alongside messages, or whether your content blocks use unsupported type values.input blocks rather than patching the adapter. This keeps you compatible with future package releases and avoids depending on beta internals.How can I help you explore Laravel packages today?