Closed adrienbanse closed 3 months ago
I started working on this issue. I'm writing down some information that could be useful here.
The unpaid tier for gemini is not available in France (as stated here : https://ai.google.dev/gemini-api/docs/available-regions?authuser=0#available_regions) So If someone else wish to work on this :
Basic example from the documentation :
import google.generativeai as genai
genai.configure(api_key="APIKEY")
# The Gemini 1.5 models are versatile and work with both text-only and multimodal prompts
model = genai.GenerativeModel('gemini-1.5-flash')
response = model.generate_content("Write a story about a magic backpack.")
The response generated looks like this :
GenerateContentResponse(
done=True,
iterator=None,
result=protos.GenerateContentResponse({
"candidates": [
{
"content": {
"parts": [
{
"text": "Barnaby was [...] take him. \n"
}
],
"role": "model"
},
"finish_reason": "STOP",
"index": 0,
"safety_ratings": [
{
"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
"probability": "NEGLIGIBLE"
},
{
"category": "HARM_CATEGORY_HATE_SPEECH",
"probability": "NEGLIGIBLE"
},
{
"category": "HARM_CATEGORY_HARASSMENT",
"probability": "NEGLIGIBLE"
},
{
"category": "HARM_CATEGORY_DANGEROUS_CONTENT",
"probability": "NEGLIGIBLE"
}
]
}
],
"usage_metadata": {
"prompt_token_count": 8,
"candidates_token_count": 569,
"total_token_count": 577
}
}),
)
Description
Add Google generative AI models, e.g. Gemini.
Solution
Google has it's own Python package for its generative AI models.
Python package: google-generativeai
Documentation:
Code example: