You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I manage to curl a reply as so here
curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash-exp:generateContent?key=KEY"
-H 'Content-Type: application/json'
-X POST
-d '{
"contents": [{
"parts":[{"text": "Write a story about a magic backpack."}]
}]
}'
this works for gemini 1.5
echo '{"contents":
[{"parts": [{"text": "What is the current Google stock price?"}]}],
"tools": [{"google_search_retrieval": {
"dynamic_retrieval_config": {
"mode": "MODE_DYNAMIC",
"dynamic_threshold": 1,
}
}
}
]
}' > request.json
curl -X POST "https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-pro-002:generateContent?key=KEY"
-H "Content-Type: application/json"
-d @request.json > response.json
cat response.json
---- however with gemini 2.0 :
echo '{"contents":
[{"parts": [{"text": "What is the current Google stock price?"}]}],
"tools": [{"google_search": {
"dynamic_retrieval_config": {
"mode": "MODE_DYNAMIC",
"dynamic_threshold": 1,
}
}
}
]
}' > request.json
curl -X POST "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash-exp:generateContent?key=KEY"
-H "Content-Type: application/json"
-d @request.json > response.json
cat response.json
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 874 0 572 100 302 1568 828 --:--:-- --:--:-- --:--:-- 2394
{
"error": {
"code": 400,
"message": "Invalid JSON payload received. Unknown name "dynamic_retrieval_config" at 'tools[0].google_search': Cannot find field.",
"status": "INVALID_ARGUMENT",
"details": [
{
"@type": "type.googleapis.com/google.rpc.BadRequest",
"fieldViolations": [
{
"field": "tools[0].google_search",
"description": "Invalid JSON payload received. Unknown name "dynamic_retrieval_config" at 'tools[0].google_search': Cannot find field."
}
]
}
]
}
}
I can't seem to find relevant docs on the REST API I am constrained to this version and can't use the python library at the moment
Beta Was this translation helpful? Give feedback.
All reactions