gemini-1.5-pro
Model Overview
This multimodal AI model designed to process and understand text, images, and code. It excels in tasks requiring long-context understanding and interleaving of different modalities.
How to Make a Call
API Schema
Creates a chat completion using a language model, allowing interactive conversation by predicting the next response based on the given chat history. This is useful for AI-driven dialogue systems and virtual assistants.
Authorizations
Body
modelundefined · enumRequiredPossible values:
frequency_penaltynumber | nullableOptional
max_tokensnumber · min: 1OptionalDefault:
512
presence_penaltynumber | nullableOptional
streambooleanOptionalDefault:
false
top_pnumber · min: 0.1 · max: 1Optional
temperaturenumber · max: 2Optional
stopany ofOptional
stringOptional
string[]Optional
any | nullableOptional
tool_choiceany ofOptional
string · enumOptionalPossible values:
Responses
201Success
post
POST /v1/chat/completions HTTP/1.1
Host: api.aimlapi.com
Authorization: Bearer <YOUR_AIMLAPI_KEY>
Content-Type: application/json
Accept: */*
Content-Length: 391
{
"model": "gemini-1.5-pro",
"frequency_penalty": 1,
"logit_bias": {
"ANY_ADDITIONAL_PROPERTY": 1
},
"max_tokens": 512,
"presence_penalty": 1,
"messages": [
{
"role": "system",
"content": "text",
"name": "text"
}
],
"stream": false,
"top_p": 1,
"temperature": 1,
"stop": "text",
"tools": [
{
"type": "function",
"function": {
"description": "text",
"name": "text",
"parameters": {
"ANY_ADDITIONAL_PROPERTY": null
}
}
}
],
"tool_choice": "none"
}
201Success
No content
Code Example
import requests
response = requests.post(
"https://api.aimlapi.com/v1/chat/completions",
headers={
"Content-Type":"application/json",
# Insert your AIML API Key instead of <YOUR_AIMLAPI_KEY>:
"Authorization":"Bearer <YOUR_AIMLAPI_KEY>",
"Content-Type":"application/json"
},
json={
"model":"gemini-1.5-pro",
"messages":[
{
"role":"user",
# Insert your question for the model here, instead of Hello:
"content":"Hello"
}
]
}
)
data = response.json()
print(data)
Last updated
Was this helpful?