@@ -43,7 +43,7 @@ class _FunctionCallingPageState extends State<FunctionCallingPage> {
4343 late GenerativeModel _autoFunctionCallModel;
4444 late GenerativeModel _parallelAutoFunctionCallModel;
4545 late GenerativeModel _complexJSONSchemaModel;
46- late GenerativeModel _refSchemaModel ;
46+ late GenerativeModel _refDefJsonSchemaModel ;
4747 late GenerativeModel _codeExecutionModel;
4848 late final AutoFunctionDeclaration _autoFetchWeatherTool;
4949 late final AutoFunctionDeclaration _autoPlanVacationTool;
@@ -121,7 +121,6 @@ class _FunctionCallingPageState extends State<FunctionCallingPage> {
121121 name: 'planVacation' ,
122122 description:
123123 'Plans a complex vacation itinerary combining flights, hotels, and activities.' ,
124- useJSONSchema: true ,
125124 parameters: {
126125 'destination' :
127126 Schema .string (description: 'The city or country to travel to.' ),
@@ -165,21 +164,22 @@ class _FunctionCallingPageState extends State<FunctionCallingPage> {
165164 name: 'processTransactions' ,
166165 description:
167166 'Processes a list of financial transactions using a predefined transaction model reference.' ,
168- //useJSONSchema: true,
169167 parameters: {
170- 'transactionsBlock' : Schema .object (
168+ 'transactionsBlock' : JSONSchema .object (
171169 description: 'A block containing a list of transactions.' ,
172170 properties: {
173- 'transactionsList' : Schema .array (
174- items: Schema .ref (r'#/properties/transactionsBlock/$defs/transactionDef' ),
171+ 'transactionsList' : JSONSchema .array (
172+ items: JSONSchema .ref (
173+ r'#/properties/transactionsBlock/$defs/transactionDef' ,
174+ ),
175175 ),
176176 },
177177 defs: {
178- 'transactionDef' : Schema .object (
178+ 'transactionDef' : JSONSchema .object (
179179 properties: {
180- 'amount' : Schema .number (),
181- 'transactionId' : Schema .integer (),
182- 'currency' : Schema .string (),
180+ 'amount' : JSONSchema .number (),
181+ 'transactionId' : JSONSchema .integer (),
182+ 'currency' : JSONSchema .string (),
183183 },
184184 ),
185185 },
@@ -292,7 +292,7 @@ class _FunctionCallingPageState extends State<FunctionCallingPage> {
292292 Tool .functionDeclarations ([_autoPlanVacationTool]),
293293 ],
294294 );
295- _refSchemaModel = aiClient.generativeModel (
295+ _refDefJsonSchemaModel = aiClient.generativeModel (
296296 model: 'gemini-2.5-flash' ,
297297 generationConfig: generationConfig,
298298 tools: [
@@ -478,18 +478,18 @@ class _FunctionCallingPageState extends State<FunctionCallingPage> {
478478 Expanded (
479479 child: ElevatedButton (
480480 onPressed: ! _loading
481- ? _testComplexJSONSchemaAutoFunctionCalling
481+ ? _testComplexSchemaAutoFunctionCalling
482482 : null ,
483- child: const Text ('Complex JSON Schema FC' ),
483+ child: const Text ('Complex Schema Auto FC' ),
484484 ),
485485 ),
486486 const SizedBox (width: 8 ),
487487 Expanded (
488488 child: ElevatedButton (
489489 onPressed: ! _loading
490- ? _testRefSchemaAutoFunctionCalling
490+ ? _testRefDefJsonSchemaAutoFunctionCalling
491491 : null ,
492- child: const Text ('Ref Schema FC' ),
492+ child: const Text ('Ref Def JSON Schema Auto FC' ),
493493 ),
494494 ),
495495 ],
@@ -727,7 +727,7 @@ class _FunctionCallingPageState extends State<FunctionCallingPage> {
727727 });
728728 }
729729
730- Future <void > _testComplexJSONSchemaAutoFunctionCalling () async {
730+ Future <void > _testComplexSchemaAutoFunctionCalling () async {
731731 await _runTest (() async {
732732 final chat = _complexJSONSchemaModel.startChat ();
733733 const prompt =
@@ -752,9 +752,9 @@ class _FunctionCallingPageState extends State<FunctionCallingPage> {
752752 });
753753 }
754754
755- Future <void > _testRefSchemaAutoFunctionCalling () async {
755+ Future <void > _testRefDefJsonSchemaAutoFunctionCalling () async {
756756 await _runTest (() async {
757- final chat = _refSchemaModel .startChat ();
757+ final chat = _refDefJsonSchemaModel .startChat ();
758758 const prompt =
759759 r'Process two transactions. The first is $50.00 in USD (ID 98765) and the second is €30.00 in EUR (ID 98766).' ;
760760
0 commit comments