generated from dataforgoodfr/d4g-project-template
-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Google generative AI models #36
Comments
I started working on this issue. The unpaid tier for gemini is not available in France
|
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
}
}),
) |
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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:
The text was updated successfully, but these errors were encountered: