When using the SymfonyAiPlatformAdapter with the Symfony AI Gemini bridge, requests fail because the adapter sends the max_tokens key instead of max_output_tokens.
I think the problem is here:
/**
* Resolve the max-tokens option key expected by a Symfony AI bridge based on the used bridge
*/
public static function resolveMaxTokensKey(string $factoryClass): string
{
if (str_contains($factoryClass, '\\Bridge\\OpenAi\\')
|| str_contains($factoryClass, '\\Bridge\\OpenResponses\\')
) {
return 'max_output_tokens';
}
return 'max_tokens';
}
It should be maybe like this:
if (str_contains($factoryClass, '\\Bridge\\OpenAi\\')
|| str_contains($factoryClass, '\\Bridge\\OpenResponses\\')
|| str_contains($factoryClass, '\\Bridge\\Gemini\\')
) {
return 'max_output_tokens';
}
return 'max_tokens';
When using the SymfonyAiPlatformAdapter with the Symfony AI Gemini bridge, requests fail because the adapter sends the max_tokens key instead of max_output_tokens.
I think the problem is here:
It should be maybe like this: