I have this structured output:
<?php
declare(strict_types=1);
namespace App\Neuron\Outputs\BankTransfer;
use NeuronAI\StructuredOutput\SchemaProperty;
class TransferDraft
{
#[SchemaProperty(
description: 'Recipient bank account number, normally 10 digits. Null if not provided yet.',
required: false
)]
public ?string $accountNumber = null;
#[SchemaProperty(
description: 'Amount to transfer in Naira as a number. Null if not provided yet.',
required: false
)]
public ?float $amount = null;
#[SchemaProperty(
description: 'Optional transfer narration/reason. Null if not provided.',
required: false
)]
public ?string $narration = null;
}
Schema provided to gemini:
"responseSchema": {
"type": "OBJECT",
"properties": {
"amount": {
"type": "NUMBER",
"description": "..."
},
"accountNumber": {
"type": "STRING",
"description": "..."
},
"narration": {
"type": "STRING",
"description": "..."
},
"bankName": {
"type": "STRING",
"description": "Bank name exactly as the user stated it, including abbreviations like GTB, Access, Opay, Moniepoint. Null if not provided yet."
}
}
}
response (from gemini):
{
"accountNumber": "null",
"amount": 1.23,
"bankName": "null",
"narration": "null"
}
Gemini's doc explains the types here: https://ai.google.dev/gemini-api/docs/structured-output?example=recipe#json_schema_support
I already made a workaround myself, but maybe something to look into?
Thank you for your work so far.
I have this structured output:
Schema provided to gemini:
response (from gemini):
{ "accountNumber": "null", "amount": 1.23, "bankName": "null", "narration": "null" }Gemini's doc explains the types here: https://ai.google.dev/gemini-api/docs/structured-output?example=recipe#json_schema_support
I already made a workaround myself, but maybe something to look into?
Thank you for your work so far.