@@ -32,6 +32,10 @@ const (
3232 gemini25ProExp0325 = "gemini-2.5-pro-exp-03-25"
3333 gemini25ProPreview0325 = "gemini-2.5-pro-preview-03-25"
3434 gemini25ProPreview0506 = "gemini-2.5-pro-preview-05-06"
35+
36+ imagen3Generate001 = "imagen-3.0-generate-001"
37+ imagen3Generate002 = "imagen-3.0-generate-002"
38+ imagen3FastGenerate001 = "imagen-3.0-fast-generate-001"
3539)
3640
3741var (
5054 gemini25ProExp0325 ,
5155 gemini25ProPreview0325 ,
5256 gemini25ProPreview0506 ,
57+
58+ imagen3Generate001 ,
59+ imagen3Generate002 ,
60+ imagen3FastGenerate001 ,
5361 }
5462
5563 googleAIModels = []string {
6674 gemini25ProExp0325 ,
6775 gemini25ProPreview0325 ,
6876 gemini25ProPreview0506 ,
77+
78+ imagen3Generate002 ,
6979 }
7080
71- // models with native image support generation
81+ // Gemini models with native image support generation
7282 imageGenModels = []string {
7383 gemini20FlashPrevImageGen ,
7484 }
@@ -175,6 +185,27 @@ var (
175185 },
176186 }
177187
188+ supportedImagenModels = map [string ]ai.ModelInfo {
189+ imagen3Generate001 : {
190+ Label : "Imagen 3 Generate 001" ,
191+ Versions : []string {},
192+ Supports : & Media ,
193+ Stage : ai .ModelStageStable ,
194+ },
195+ imagen3Generate002 : {
196+ Label : "Imagen 3 Generate 002" ,
197+ Versions : []string {},
198+ Supports : & Media ,
199+ Stage : ai .ModelStageStable ,
200+ },
201+ imagen3FastGenerate001 : {
202+ Label : "Imagen 3 Fast Generate 001" ,
203+ Versions : []string {},
204+ Supports : & Media ,
205+ Stage : ai .ModelStageStable ,
206+ },
207+ }
208+
178209 googleAIEmbedders = []string {
179210 "text-embedding-004" ,
180211 "embedding-001" ,
@@ -194,7 +225,7 @@ var (
194225// listModels returns a map of supported models and their capabilities
195226// based on the detected backend
196227func listModels (provider string ) (map [string ]ai.ModelInfo , error ) {
197- names := []string {}
228+ var names []string
198229 var prefix string
199230
200231 switch provider {
@@ -210,7 +241,13 @@ func listModels(provider string) (map[string]ai.ModelInfo, error) {
210241
211242 models := make (map [string ]ai.ModelInfo , 0 )
212243 for _ , n := range names {
213- m , ok := supportedGeminiModels [n ]
244+ var m ai.ModelInfo
245+ var ok bool
246+ if strings .HasPrefix (n , "image" ) {
247+ m , ok = supportedImagenModels [n ]
248+ } else {
249+ m , ok = supportedGeminiModels [n ]
250+ }
214251 if ! ok {
215252 return nil , fmt .Errorf ("model %s not found for provider %s" , n , provider )
216253 }
@@ -227,7 +264,7 @@ func listModels(provider string) (map[string]ai.ModelInfo, error) {
227264// listEmbedders returns a list of supported embedders based on the
228265// detected backend
229266func listEmbedders (backend genai.Backend ) ([]string , error ) {
230- embedders := []string {}
267+ var embedders []string
231268
232269 switch backend {
233270 case genai .BackendGeminiAPI :
@@ -242,9 +279,10 @@ func listEmbedders(backend genai.Backend) ([]string, error) {
242279}
243280
244281// genaiModels collects all the available models in go-genai SDK
245- // TODO: add imagen and veo models
282+ // TODO: add veo models
246283type genaiModels struct {
247284 gemini []string
285+ imagen []string
248286 embedders []string
249287}
250288
@@ -253,6 +291,7 @@ type genaiModels struct {
253291func listGenaiModels (ctx context.Context , client * genai.Client ) (genaiModels , error ) {
254292 models := genaiModels {}
255293 allowedModels := []string {"gemini" , "gemma" }
294+ allowedImagenModels := []string {"imagen" }
256295
257296 for item , err := range client .Models .All (ctx ) {
258297 var name string
@@ -283,7 +322,15 @@ func listGenaiModels(ctx context.Context, client *genai.Client) (genaiModels, er
283322 continue
284323 }
285324
286- // TODO: add imagen and veo models
325+ found = slices .ContainsFunc (allowedImagenModels , func (s string ) bool {
326+ return strings .Contains (name , s )
327+ })
328+ // filter out: Aqa, Text-bison, Chat, learnlm
329+ if found {
330+ models .imagen = append (models .imagen , name )
331+ continue
332+ }
287333 }
334+
288335 return models , nil
289336}
0 commit comments