Documentation
¶
Overview ¶
Package imageproviders contains concrete implementations of image.Generation for each supported provider. Add a new file here (e.g. stabilityai.go) to support additional image generation backends — no other package needs changing.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GeminiClient ¶
type GeminiClient struct {
// contains filtered or unexported fields
}
GeminiClient generates images using Google Imagen via the Gemini API. Supported models: imagen-3.0-generate-002, imagen-3.0-fast-generate-001, imagegeneration@006 (Vertex AI only).
func NewGemini ¶
func NewGemini(apiKey string, opts ...GeminiOption) *GeminiClient
NewGemini creates a Google Imagen image generation client. apiKey is a Google AI Studio API key (AIza...).
func (*GeminiClient) GenerateImage ¶
func (c *GeminiClient) GenerateImage(ctx context.Context, prompt string) (*image.GenerationResponse, error)
GenerateImage calls the Imagen predict API and returns the result. Endpoint: POST /v1beta/models/{model}:predict?key=API_KEY
func (*GeminiClient) Provider ¶
func (c *GeminiClient) Provider() string
Provider implements image.Generation.
type GeminiOption ¶
type GeminiOption func(*GeminiClient)
GeminiOption configures a GeminiClient.
func WithGeminiAspectRatio ¶
func WithGeminiAspectRatio(ar string) GeminiOption
WithGeminiAspectRatio sets the aspect ratio ("1:1", "3:4", "4:3", "9:16", "16:9").
func WithGeminiBaseURL ¶
func WithGeminiBaseURL(url string) GeminiOption
WithGeminiBaseURL overrides the default Google AI Studio endpoint.
func WithGeminiCount ¶
func WithGeminiCount(n int) GeminiOption
WithGeminiCount sets the number of images to generate (1–4).
func WithGeminiHTTPClient ¶
func WithGeminiHTTPClient(hc *http.Client) GeminiOption
WithGeminiHTTPClient injects a custom HTTP client.
func WithGeminiModel ¶
func WithGeminiModel(model string) GeminiOption
WithGeminiModel sets the Imagen model.
type OpenAIClient ¶
type OpenAIClient struct {
// contains filtered or unexported fields
}
OpenAIClient generates images using OpenAI DALL-E (dall-e-3, dall-e-2).
func NewOpenAI ¶
func NewOpenAI(apiKey string, opts ...OpenAIOption) *OpenAIClient
NewOpenAI creates an OpenAI DALL-E image generation client.
func (*OpenAIClient) GenerateImage ¶
func (c *OpenAIClient) GenerateImage(ctx context.Context, prompt string) (*image.GenerationResponse, error)
GenerateImage calls the OpenAI Images API and returns the result.
func (*OpenAIClient) Provider ¶
func (c *OpenAIClient) Provider() string
Provider implements image.Generation.
type OpenAIOption ¶
type OpenAIOption func(*OpenAIClient)
OpenAIOption configures an OpenAIClient.
func WithOpenAIBaseURL ¶
func WithOpenAIBaseURL(url string) OpenAIOption
WithOpenAIBaseURL overrides the default endpoint (useful for proxies).
func WithOpenAIHTTPClient ¶
func WithOpenAIHTTPClient(hc *http.Client) OpenAIOption
WithOpenAIHTTPClient injects a custom HTTP client.
func WithOpenAIModel ¶
func WithOpenAIModel(model string) OpenAIOption
WithOpenAIModel sets the DALL-E model (e.g. "dall-e-3", "dall-e-2").
func WithOpenAIQuality ¶
func WithOpenAIQuality(q string) OpenAIOption
WithOpenAIQuality sets the quality ("standard" or "hd").
func WithOpenAISize ¶
func WithOpenAISize(size string) OpenAIOption
WithOpenAISize sets the image dimensions (e.g. "1024x1024", "1792x1024").