feat(ai): add image generation support - #1461
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1461 +/- ##
==========================================
- Coverage 69.30% 69.28% -0.03%
==========================================
Files 367 368 +1
Lines 28949 29151 +202
==========================================
+ Hits 20062 20196 +134
- Misses 7987 8042 +55
- Partials 900 913 +13 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
Pull request overview
Adds first-class image generation/edit support to the framework AI surface via a fluent facades.AI().Image(...) request API, with an OpenAI provider implementation and supporting contracts/config/errors/mocks.
Changes:
- Introduce image-specific AI contracts (
ImageRequest,ImageResponse,ImagePrompt) and AI facade entrypointAI.Image(...). - Implement OpenAI image generations/edits (including reference image attachments) and parse image responses into a framework
ImageResponse. - Extend configuration defaults, errors, and mocks/tests to cover image models and image flows.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
mocks/ai/ImageResponse.go |
Adds mock for contracts/ai.ImageResponse. |
mocks/ai/ImageRequest.go |
Adds mock for contracts/ai.ImageRequest. |
mocks/ai/ImageProvider.go |
Adds mock for contracts/ai.ImageProvider. |
mocks/ai/AI.go |
Extends AI mock with Image(prompt, ...Option) fluent entrypoint. |
errors/list.go |
Adds centralized errors for image provider support and image prompt/response validation. |
contracts/ai/response.go |
Adds ImageResponse interface (content, mime type, usage, Then). |
contracts/ai/provider.go |
Adds ImagePrompt and ImageProvider provider extension interface. |
contracts/ai/image.go |
Introduces image request contract plus ImageQuality/ImageSize types. |
contracts/ai/config.go |
Extends model config with Models.Image.Default. |
contracts/ai/ai.go |
Adds AI.Image(...) ImageRequest to the primary AI contract. |
ai/setup/stubs.go |
Updates AI setup stub config to include default image model config. |
ai/openai/response.go |
Implements OpenAI-backed ImageResponse (and related response structs). |
ai/openai/provider_test.go |
Adds provider tests for image generations/edits, validations, and request shaping. |
ai/openai/provider.go |
Implements OpenAI Image(...) support and image response parsing. |
ai/image_request.go |
Adds internal fluent request builder wiring to Application.image(...). |
ai/image.go |
Re-exports image size/quality types/constants from contracts for convenience. |
ai/application_test.go |
Adds application-level tests for the fluent image request and provider dispatch. |
ai/application.go |
Adds Application.Image(...) and internal image(...) dispatch via ImageProvider. |
hwbrzzl
commented
May 3, 2026
Comment on lines
55
to
+70
| app.Call(func() { | ||
| immediatelyCall++ | ||
| if immediatelyCall.Add(1) == 3 { | ||
| go func() { | ||
| shutdownErr <- app.Shutdown() | ||
| }() | ||
| } | ||
| }).Cron("* * * * * *"), | ||
| app.Call(func() { | ||
| time.Sleep(2 * time.Second) | ||
| delayIfStillRunningCall++ | ||
| time.Sleep(1100 * time.Millisecond) | ||
| delayIfStillRunningCall.Add(1) | ||
| }).Cron("* * * * * *").DelayIfStillRunning(), | ||
| app.Call(func() { | ||
| time.Sleep(2 * time.Second) | ||
| skipIfStillRunningCall++ | ||
| time.Sleep(2500 * time.Millisecond) | ||
| skipIfStillRunningCall.Add(1) | ||
| }).Cron("* * * * * *").SkipIfStillRunning(), | ||
| app.Command("test --name Goravel argument0 argument1").Cron("*/2 * * * * *"), | ||
| app.Command("test --name Goravel argument0 argument1").Cron("* * * * * *"), |
Comment on lines
+83
to
+87
| s.Equal(int64(3), immediatelyCall.Load()) | ||
| s.Equal(int64(3), delayIfStillRunningCall.Load()) | ||
| s.Equal(int64(1), skipIfStillRunningCall.Load()) | ||
| s.Equal(int64(3), commandCall.Load()) | ||
| s.Equal(int64(3), panicCall.Load()) |
LinboLen
added a commit
to LinboLen/framework
that referenced
this pull request
May 3, 2026
* origin/master: fix(ai): remove context from image response content (goravel#1462) feat(ai): support provider-managed files (goravel#1460) feat(ai): add image generation support (goravel#1461) fix: [goravel#946] stop WithContext from leaking framework context keys (goravel#1456) feat(ai): add attachment upload support (goravel#1459) feat(ai): add attachment helper subpackages (goravel#1458) feat(ai): switch OpenAI provider to responses API (goravel#1457) feat(ai): add attachment support (goravel#1455)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
facades.AI().Image(...)API for generating and editing images with provider, model, quality, size, timeout, and attachment optionsCloses goravel/goravel#918
Why
This adds the first end-to-end image generation surface to the framework so Goravel applications can generate and edit images without dropping down to provider-specific SDKs. The API stays on the existing
facades.AI()entrypoint and reuses the current image attachment helpers, which keeps image prompting consistent with the rest of the AI module.It also wires OpenAI image generation and edit endpoints into the provider layer, adds default image model configuration, and covers the new behavior with application and provider tests so the first image feature phase is ready to build on.