the documentation says “You can also generate embeddings for multiple chunks at once by passing them in as a list of strings.”
curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-embedding-001:embedContent" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-H 'Content-Type: application/json' \
-d '{"model": "models/gemini-embedding-001",
"content": [
{"parts": [{"text": "What is the meaning of life?"}]},
{"parts": [{"text": "What is the purpose of existence?"}]},
{"parts": [{"text": "How do I bake a cake?"}]}
]
}'
however the api returns this error
{
"error": {
"code": 400,
"message": "Invalid JSON payload received. Unknown name \"content\": Proto field is not repeating, cannot start list.",
"status": "INVALID_ARGUMENT",
"details": [
{
"@type": "type.googleapis.com/google.rpc.BadRequest",
"fieldViolations": [
{
"description": "Invalid JSON payload received. Unknown name \"content\": Proto field is not repeating, cannot start list."
}
]
}
]
}
}