top_p
but not both.temperature
but not both.data: [DONE]
message. Python code example.finish_reason="length"
, the message content may be partially truncated, indicating generation exceeded max_tokens or the conversation exceeded the maximum context length. Show properties.system_fingerprint
response parameter to monitor backend changes.none
means the model will not call a function but will generate a message. auto
means the model can choose between generating a message and calling a function. Forcing the model to call a function can be done with {"type": "function", "function": {"name": "my_function"}}. If no functions exist, the default is none
. If functions exist, the default is auto
. Show possible types.{
"model": "gemini-1.5-pro-latest",
"messages": [
{
"role": "user",
"content": "Who is Messi"
}
]
}
curl --location --request POST '/v1/chat/completions' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {{YOUR_API_KEY}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"model": "gemini-1.5-pro-latest",
"messages": [
{
"role": "user",
"content": "Who is Messi"
}
]
}'
{
"id": "chatcmpl-123",
"object": "chat.completion",
"created": 1677652288,
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "\n\nHello there, how may I assist you today?"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 9,
"completion_tokens": 12,
"total_tokens": 21
}
}