The streaming request support with OpenAI API contract mentioned here does not work.
Request:
curl "https://generativelanguage.googleapis.com/v1beta/openai/chat/completions" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer GEMINI_API_KEY" \
-d '{
"model": "gemini-1.5-flash",
"messages": [
{"role": "user", "content": "Explain to me how AI works"}
],
"stream": true
}'
Response
[{
"error": {
"code": 400,
"message": "Invalid resource field value in the request.",
"status": "INVALID_ARGUMENT",
"details": [
{
"@type": "type.googleapis.com/google.rpc.ErrorInfo",
"reason": "RESOURCE_PROJECT_INVALID",
"domain": "googleapis.com",
"metadata": {
"method": "google.cloud.aiplatform.internal.PredictionService.StreamGenerateContent",
"service": "aiplatform.googleapis.com"
}
}
]
}
}]