There are some advanced JSON features like $ref and $def which allow for hierarchical structures etc.
They unlock a lot of powerful use cases, but they're not possible with Firebase AI logic right now. I think the two things we need are:
1. Support responseJsonSchema field in the API
Gemini can understand advanced schemas, but only when using the responseJsonSchema parameter rather than responseSchema (see GenerationConfig).
I believe Firebase AI Logic currently only supports responseSchema - see
|
Map<String, Object?> toJson() => { |
2. Support $ref and $def in Schema
Currently, Firebase's schema object does not support representing $ref and $def, so I think we'd need some support here.
See
|
// you may not use this file except in compliance with the License. |
There are some advanced JSON features like $ref and $def which allow for hierarchical structures etc.
They unlock a lot of powerful use cases, but they're not possible with Firebase AI logic right now. I think the two things we need are:
1. Support
responseJsonSchemafield in the APIGemini can understand advanced schemas, but only when using the
responseJsonSchemaparameter rather thanresponseSchema(see GenerationConfig).I believe Firebase AI Logic currently only supports
responseSchema- seeflutterfire/packages/firebase_ai/firebase_ai/lib/src/api.dart
Line 1030 in db7e829
2. Support $ref and $def in Schema
Currently, Firebase's schema object does not support representing $ref and $def, so I think we'd need some support here.
See
flutterfire/packages/firebase_ai/firebase_ai/lib/src/schema.dart
Line 4 in db7e829