@@ -324,51 +324,81 @@ func (ga *GoogleAI) ListActions(ctx context.Context) []api.ActionDesc {
324
324
"systemRole" : true ,
325
325
"tools" : true ,
326
326
"toolChoice" : true ,
327
- "constrained" : true ,
327
+ "constrained" : "no-tools" ,
328
328
},
329
- "versions" : []string {},
330
- "stage" : string (ai .ModelStageStable ),
329
+ "versions" : []string {},
330
+ "stage" : string (ai .ModelStageStable ),
331
+ "customOptions" : configToMap (& genai.GenerateContentConfig {}),
331
332
},
332
333
}
333
334
metadata ["label" ] = fmt .Sprintf ("%s - %s" , googleAILabelPrefix , name )
334
335
335
336
actions = append (actions , api.ActionDesc {
336
337
Type : api .ActionTypeModel ,
337
- Name : fmt .Sprintf ("%s/%s" , googleAIProvider , name ),
338
- Key : fmt .Sprintf ("/%s/%s/%s" , api .ActionTypeModel , googleAIProvider , name ),
338
+ Name : api .NewName (googleAIProvider , name ),
339
+ Key : api .NewKey (api .ActionTypeModel , googleAIProvider , name ),
340
+ Metadata : metadata ,
341
+ })
342
+ }
343
+
344
+ for _ , name := range models .imagen {
345
+ metadata := map [string ]any {
346
+ "model" : map [string ]any {
347
+ "supports" : map [string ]any {
348
+ "media" : true ,
349
+ "multiturn" : true ,
350
+ "systemRole" : false ,
351
+ "tools" : false ,
352
+ "toolChoice" : false ,
353
+ "constrained" : "no-tools" ,
354
+ },
355
+ "versions" : []string {},
356
+ "stage" : string (ai .ModelStageStable ),
357
+ "customOptions" : configToMap (& genai.GenerateImagesConfig {}),
358
+ },
359
+ }
360
+ metadata ["label" ] = fmt .Sprintf ("%s - %s" , googleAILabelPrefix , name )
361
+
362
+ actions = append (actions , api.ActionDesc {
363
+ Type : api .ActionTypeModel ,
364
+ Name : api .NewName (googleAIProvider , name ),
365
+ Key : api .NewKey (api .ActionTypeModel , googleAIProvider , name ),
339
366
Metadata : metadata ,
340
367
})
341
368
}
342
369
343
370
for _ , e := range models .embedders {
344
371
actions = append (actions , api.ActionDesc {
345
372
Type : api .ActionTypeEmbedder ,
346
- Name : fmt . Sprintf ( "%s/%s" , googleAIProvider , e ),
347
- Key : fmt . Sprintf ( "/%s/%s/%s" , api .ActionTypeEmbedder , googleAIProvider , e ),
373
+ Name : api . NewName ( googleAIProvider , e ),
374
+ Key : api . NewKey ( api .ActionTypeEmbedder , googleAIProvider , e ),
348
375
})
349
376
}
350
377
351
378
return actions
352
379
}
353
380
354
381
func (ga * GoogleAI ) ResolveAction (atype api.ActionType , name string ) api.Action {
382
+ var config any
355
383
switch atype {
356
384
case api .ActionTypeEmbedder :
357
385
return newEmbedder (ga .gclient , name , & ai.EmbedderOptions {}).(api.Action )
358
386
case api .ActionTypeModel :
359
- var supports * ai.ModelSupports
360
- if strings .Contains (name , "gemini" ) || strings .Contains (name , "gemma" ) {
361
- supports = & Multimodal
387
+ supports := & Multimodal
388
+ config = & genai.GenerateContentConfig {}
389
+ if strings .Contains (name , "imagen" ) {
390
+ supports = & Media
391
+ config = & genai.GenerateImagesConfig {}
362
392
}
363
393
364
394
return newModel (ga .gclient , name , ai.ModelOptions {
365
- Label : fmt .Sprintf ("%s - %s" , googleAILabelPrefix , name ),
366
- Stage : ai .ModelStageStable ,
367
- Versions : []string {},
368
- Supports : supports ,
395
+ Label : fmt .Sprintf ("%s - %s" , googleAILabelPrefix , name ),
396
+ Stage : ai .ModelStageStable ,
397
+ Versions : []string {},
398
+ Supports : supports ,
399
+ ConfigSchema : configToMap (config ),
369
400
}).(api.Action )
370
401
}
371
-
372
402
return nil
373
403
}
374
404
@@ -388,47 +418,77 @@ func (v *VertexAI) ListActions(ctx context.Context) []api.ActionDesc {
388
418
"systemRole" : true ,
389
419
"tools" : true ,
390
420
"toolChoice" : true ,
391
- "constrained" : true ,
421
+ "constrained" : "no-tools" ,
422
+ },
423
+ "versions" : []string {},
424
+ "stage" : string (ai .ModelStageStable ),
425
+ "customOptions" : configToMap (& genai.GenerateContentConfig {}),
426
+ },
427
+ }
428
+ metadata ["label" ] = fmt .Sprintf ("%s - %s" , vertexAILabelPrefix , name )
429
+ actions = append (actions , api.ActionDesc {
430
+ Type : api .ActionTypeModel ,
431
+ Name : api .NewName (vertexAIProvider , name ),
432
+ Key : api .NewKey (api .ActionTypeModel , vertexAIProvider , name ),
433
+ Metadata : metadata ,
434
+ })
435
+ }
436
+
437
+ for _ , name := range models .imagen {
438
+ metadata := map [string ]any {
439
+ "model" : map [string ]any {
440
+ "supports" : map [string ]any {
441
+ "media" : true ,
442
+ "multiturn" : true ,
443
+ "systemRole" : false ,
444
+ "tools" : false ,
445
+ "toolChoice" : false ,
446
+ "constrained" : "no-tools" ,
392
447
},
393
- "versions" : []string {},
394
- "stage" : string (ai .ModelStageStable ),
448
+ "versions" : []string {},
449
+ "stage" : string (ai .ModelStageStable ),
450
+ "customOptions" : configToMap (& genai.GenerateImagesConfig {}),
395
451
},
396
452
}
397
453
metadata ["label" ] = fmt .Sprintf ("%s - %s" , vertexAILabelPrefix , name )
398
454
actions = append (actions , api.ActionDesc {
399
455
Type : api .ActionTypeModel ,
400
- Name : fmt . Sprintf ( "%s/%s" , vertexAIProvider , name ),
401
- Key : fmt . Sprintf ( "/%s/%s/%s" , api .ActionTypeModel , vertexAIProvider , name ),
456
+ Name : api . NewName ( vertexAIProvider , name ),
457
+ Key : api . NewKey ( api .ActionTypeModel , vertexAIProvider , name ),
402
458
Metadata : metadata ,
403
459
})
404
460
}
405
461
406
462
for _ , e := range models .embedders {
407
463
actions = append (actions , api.ActionDesc {
408
464
Type : api .ActionTypeEmbedder ,
409
- Name : fmt . Sprintf ( "%s/%s" , vertexAIProvider , e ),
410
- Key : fmt . Sprintf ( "/%s/%s/%s" , api .ActionTypeEmbedder , vertexAIProvider , e ),
465
+ Name : api . NewName ( vertexAIProvider , e ),
466
+ Key : api . NewKey ( api .ActionTypeEmbedder , vertexAIProvider , e ),
411
467
})
412
468
}
413
469
414
470
return actions
415
471
}
416
472
417
473
func (v * VertexAI ) ResolveAction (atype api.ActionType , name string ) api.Action {
474
+ var config any
418
475
switch atype {
419
476
case api .ActionTypeEmbedder :
420
477
return newEmbedder (v .gclient , name , & ai.EmbedderOptions {}).(api.Action )
421
478
case api .ActionTypeModel :
422
- var supports * ai.ModelSupports
423
- if strings .Contains (name , "gemini" ) {
424
- supports = & Multimodal
479
+ supports := & Multimodal
480
+ config = & genai.GenerateContentConfig {}
481
+ if strings .Contains (name , "imagen" ) {
482
+ supports = & Media
483
+ config = & genai.GenerateImagesConfig {}
425
484
}
426
485
427
486
return newModel (v .gclient , name , ai.ModelOptions {
428
- Label : fmt .Sprintf ("%s - %s" , vertexAILabelPrefix , name ),
429
- Stage : ai .ModelStageStable ,
430
- Versions : []string {},
431
- Supports : supports ,
487
+ Label : fmt .Sprintf ("%s - %s" , vertexAILabelPrefix , name ),
488
+ Stage : ai .ModelStageStable ,
489
+ Versions : []string {},
490
+ Supports : supports ,
491
+ ConfigSchema : configToMap (config ),
432
492
}).(api.Action )
433
493
}
434
494
return nil
0 commit comments