NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
PyPI · #1391 most downloaded on PyPI
Google Generative AI High level API client library and tools.
Last release 9 months ago
16 Dec 2025
Ships unpredictably
gaps range from 9 days to 8 months
Nearly every release is documented
notes for 24 of 25 stable releases
1 version withdrawn
withdrawn after publishing
3 years old
28 releases · first in 2023
One column per quarter.
Add a warning message on import telling people that this package is archived.
Add a warning message on import telling people that this package is archived.
Full Changelog: https://github.com/google-gemini/deprecated-generative-ai-python/compare/v0.8.5...v0.8.6
Several bug fixes by @MarkDaoust in #731
GEMINI_API_KEY="" shadowing "GOOGLE_API_KEY".awaiting user response by @amirh in #720Full Changelog: v0.8.4...v0.8.5
feat: add py.typed by @Goldziher in #509
Full Changelog: v0.8.3...v0.8.4
Search grounding by @shilpakancharla in #558
Full Changelog: v0.8.2...v0.8.3
Ensure tests are runnable when standalone by @markmcd in https://github.com/google-gemini/generative-ai-python/pull/552
Full Changelog: https://github.com/google-gemini/generative-ai-python/compare/0.8.1...v0.8.2
Full Changelog: 0.8.1...v0.8.2
Expand .text error descriptions. by @MarkDaoust in https://github.com/google-gemini/generative-ai-python/pull/527
.text error descriptions. by @MarkDaoust in https://github.com/google-gemini/generative-ai-python/pull/527Full Changelog: https://github.com/google-gemini/generative-ai-python/compare/v0.8.0...0.8.1
.text error descriptions. by @MarkDaoust in #527Full Changelog: v0.8.0...0.8.1
Remove DiscussService and TextService by @shilpakancharla in #512
GEMINI_API_KEY by default instead of the GOOGLE_API_KEY one by @Giom-V in #418text_generation samples for shell by @shilpakancharla in #430Full Changelog: v0.7.2...v0.8.0
Fix bug passing single-string safety settings. by @MarkDaoust in https://github.com/google-gemini/generative-ai-python/pull/417
list_models by @rozha in https://github.com/google-gemini/generative-ai-python/pull/439samples/files.py by @shilpakancharla in https://github.com/google-gemini/generative-ai-python/pull/414Full Changelog: https://github.com/google-gemini/generative-ai-python/compare/v0.7.1...v0.7.2
list_models by @rozha in #439samples/files.py by @shilpakancharla in #414Full Changelog: v0.7.1...v0.7.2
Add code execution by @shilpakancharla in https://github.com/google-gemini/generative-ai-python/pull/396
Full Changelog: https://github.com/google-gemini/generative-ai-python/compare/v0.7.0...v0.7.1
For a detailed introduction, check out the context caching guide on the site.
For a detailed introduction, check out the context caching guide on the site.
Full Changelog: https://github.com/google-gemini/generative-ai-python/compare/v0.6.0...v0.7.0
Add genai.protos to discourage direct use of google.ai.generativelanguage by @MarkDaoust in https://github.com/google-gemini/generative-ai-python/pull
genai.protos to discourage direct use of google.ai.generativelanguage by @MarkDaoust in https://github.com/google-gemini/generative-ai-python/pull/354safety_settings="block_none" by @MarkDaoust in https://github.com/google-gemini/generative-ai-python/pull/347contents. by @MarkDaoust in https://github.com/google-gemini/generative-ai-python/pull/342Full Changelog: https://github.com/google-gemini/generative-ai-python/compare/v0.5.4...v0.6.0
Update version of generativelanguage to fix timeout errors. by @MarkDaoust in https://github.com/google-gemini/generative-ai-python/pull/345
Extend permissions service support to Tuned Models by @mayureshagashe2105 in https://github.com/google-gemini/generative-ai-python/pull/219
update_time defined twice hence removing once. by @PandasPirate in https://github.com/google-gemini/generative-ai-python/pull/301
Add main async code match test by @mayureshagashe2105 in https://github.com/google-gemini/generative-ai-python/pull/299
Copy test cases over for new responder.py by @shilpakancharla in https://github.com/google-gemini/generative-ai-python/pull/303
Add f to f-string by @markmcd in https://github.com/google-gemini/generative-ai-python/pull/322
Full Changelog: https://github.com/google-gemini/generative-ai-python/compare/v0.5.2...v0.5.3
Fix file uploads by @MarkDaoust in https://github.com/google-gemini/generative-ai-python/pull/291
TaskTypes and output_dimensionality param by @mayureshagashe2105 in https://github.com/google-gemini/generative-ai-python/pull/285Full Changelog: https://github.com/google-gemini/generative-ai-python/compare/v0.5.1...v0.5.2
Add JSON mode by @shilpakancharla in https://github.com/google/generative-ai-python/pull/274
Full Changelog: https://github.com/google/generative-ai-python/compare/v0.5.0...v0.5.1
You can now upload files to the api. Then instead of resending an image with each request, just pass a file reference in your prompt:
Files API
You can now upload files to the api. Then instead of resending an image with each request, just pass a file reference in your prompt:
f = genai.upload_file(path="image.png")
m = genai.GenerativeModel(model_name=...)
response = m.generate_content(["Please describe this file:", f])
.uri property by @TYMichaelChen in https://github.com/google/generative-ai-python/pull/260Semantic retriever
Using answer.generate_answer, you can now either pass "inline_passages" to include the reference material in the request:
from google.generativeai import answer
answer.generate_answer(
content=question,
inline_passages=splitter.split(document)
)
Or pass a reference to a retriever Document or Corpus:
from google.generativeai import answer
from google.generativeai import retriever
my_corpus = retriever.get_corpus('my_corpus')
genai.generate_answer(
content=question,
semantic_retreiver=my_corpus
)
System instructions
When creating a model you can pass a string (or Content) as system_instructions: genai.GenerativeModel(system_instructions="Be good!")
system_instruction to model repr by @markmcd in https://github.com/google/generative-ai-python/pull/272Function Calling - Tool Config
The list of tools available for function calling during a chat session is typically constant. The new tool_config argument lets you switch the function calling mode between None (No function calls), Auto (The model chooses to return text or a FunctionCall), and Any (the model must call a function).
model = genai.GenerativeModel(tools=[my_functions])
chat = model.start_chat()
chat.send_message(tool_config={"function_calling_config": "ANY"})
In Any mode the model will return a function call. You may also pass allowed_function_names to restrict the calls to a subset of the available functions: `chat.send_message(tool_config={"function_calling_config": "ANY", "allowed_function_names": [...]})
In Any mode the model can use constrained decoding to more strictly follow the argument specifications in the function declarations.
Full Changelog: https://github.com/google/generative-ai-python/compare/v0.4.1...v0.5.0
The send_message_async method should call the asynchronous method generate_content_async by @xnny in https://github.com/google/generative-ai-python/pu
Full Changelog: https://github.com/google/generative-ai-python/compare/v0.4.0...v0.4.1
Update notebook magics to work with Gemini by @markmcd in https://github.com/google/generative-ai-python/pull/109
genai.generate_answer) by @shilpakancharla in https://github.com/google/generative-ai-python/pull/169 model = genai.GenerativeModel(..., tools=[my_function])
chat = model.start_chat(enable_automatic_function_calling=True)
Model.generate_content(...,
request_options={'timeout': 100, 'retry': google.api_core.retry.Retry()})
README.md and generate_content documentation by @Hamza-nabil in https://github.com/google/generative-ai-python/pull/149parts are returned by @markmcd in https://github.com/google/generative-ai-python/pull/180embed_content_async implementation by @mayureshagashe2105 in https://github.com/google/generative-ai-python/pull/189__repr__ for GenerateContentResponse and ChatSession by @aidoskanapyanov in https://github.com/google/generative-ai-python/pull/202Full Changelog: https://github.com/google/generative-ai-python/compare/v0.3.2...v0.4.0
Fix GenerativeModel.count_tokens. Add basic function call support. Fix async streaming with python 3.9. Use typing_extensions for TypedDict. Fix docs
Fix GenerativeModel.count_tokens.
Add basic function call support.
Fix async streaming with python 3.9.
Use typing_extensions for TypedDict.
Fix docs and error messages.
Full Changelog: https://github.com/google/generative-ai-python/compare/v0.3.1...v0.3.2
Nothing published for this version
Adds the Content family of methods to support Gemini models.
Adds the Content family of methods to support Gemini models.
Handle maximum batch size for embed_text.
embed_text.types.ModelNameOptions.count_text_tokensmetadata (HTML headers).Bugfix: Add missing enum names to saftey_types.py
saftey_types.pygoogle.ai.generativelanguage v0.3.3
v0.3.3.Accept strings and ints for enums.
[{"category": category, "threshold": threshold}, ...]).Support for text generation, chat and embeddings.
Nothing published for this version
Nothing published for this version
Nothing published for this version
Your coding agent can read these notes before it upgrades. Set up the MCP server →