Releases: google-gemini/generative-ai-python
v0.6.0
What's Changed
Features
- Add
genai.protos
to discourage direct use of google.ai.generativelanguage by @MarkDaoust in #354 - Add video metadata and error to File by @MarkDaoust in #348
- Restrict Harm category to the subset supported by Gemini by @aertoria in #295
- Improve request_options by @MarkDaoust in #297
- Add GenerateContentResponse.to_dict() by @MarkDaoust in #337
- Quick safety filtering: Allow
safety_settings="block_none"
by @MarkDaoust in #347
Bugfixes
- Cleanup file data handling. by @MarkDaoust in #321
- Allow count_tokens with no
contents
. by @MarkDaoust in #342 - improve the no-credentials error message, fail fast for no-credentials in colab. by @MarkDaoust in #352
- Make printing less verbose. by @MarkDaoust in #340
- Add request options to chat. by @MarkDaoust in #341
- Handle image RGBA mode by @MarkDaoust in #374
Docs
- Fix bugs, improve code clarity, and enhance overall reliability across several files. by @Faisal-Alsrheed in #339
- Enhance functions Documentation and Improve Error Messages by @Faisal-Alsrheed in #350
- Fix argument description. by @MarkDaoust in #338
- Update init.py to use the latest model by @logankilpatrick in #362
New Contributors
- @Faisal-Alsrheed made their first contribution in #339
- @logankilpatrick made their first contribution in #362
Full Changelog: v0.5.4...v0.6.0
v0.5.4 - Bugfix: Update client library version to clear timeouts.
What's Changed
- Update version of generativelanguage to fix timeout errors. by @MarkDaoust in #345
v0.5.3
What's Changed
Features
- Extend permissions service support to Tuned Models by @mayureshagashe2105 in #219
- Support improved CountTokens and usage_metadata output by @MarkDaoust in #315
- Add JSON schema support
- Add response_schema parameter by @shilpakancharla in #302
- Improve schema support by @MarkDaoust in #309
- Upgrade file handling
- Add file state by @MarkDaoust in #316
- Add support for resumable uploads for File API by @TYMichaelChen in #275
- Return full file details at the end of create. by @MarkDaoust in #314
- Update client.py by @MarkDaoust in #325
Bugfixes
-
update_time defined twice hence removing once. by @PandasPirate in #301
-
Add main async code match test by @mayureshagashe2105 in #299
-
Copy test cases over for new responder.py by @shilpakancharla in #303
Docs
- Debug docs build. by @MarkDaoust in #298
- Update issue templates to point to the Discourse forum by @ymodak in #304
- typo by @MarkDaoust in #313
New Contributors
- @PandasPirate made their first contribution in #301
Full Changelog: v0.5.2...v0.5.3
v0.5.2 - File upload bugfix
Bug Fix
- Fix file uploads by @MarkDaoust in #291
New Features
- Support for new
TaskTypes
andoutput_dimensionality
param by @mayureshagashe2105 in #285
Full Changelog: v0.5.1...v0.5.2
v0.5.1 - Add json mode
New features
- Add JSON mode by @shilpakancharla in #274
Docs and small fixes
- Fix: incorrect type checking by @Yeuoly in #283
- Fix an internal test failure by @markmcd in #279
- Allow incomplete GenerationConfigDict by @markmcd in #286
- Use generativelanguage v0.6.2 for json mode + update package version. by @MarkDaoust in #287
New Contributors
Full Changelog: v0.5.0...v0.5.1
v0.5.0 - Files
What's Changed
New features
-
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])
- Add initial prototype supporting the files API by @MarkDaoust in #249
- Files API: improve error messages, add delete_file, add
.uri
property by @TYMichaelChen in #260
-
Semantic 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 )
- Finish Semantic Retriever. by @shilpakancharla in #230
-
System instructions
When creating a model you can pass a string (or
Content
) assystem_instructions
:genai.GenerativeModel(system_instructions="Be good!")
- Add basic SI and tool_config support by @MarkDaoust in #257
- Add
system_instruction
to model repr by @markmcd in #272
-
Function 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 betweenNone
(No function calls),Auto
(The model chooses to return text or a FunctionCall), andAny
(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 passallowed_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.- Add basic SI and tool_config support by @MarkDaoust in #257
- Function calling mode patch by @mayureshagashe2105 in #271
Docs, bug fixes, and minor updates.
- Update README.md by @aertoria in #256
- Fix incorrect reference to self.candidates[0].parts, self.candidates[0].parts[0].text by @Andy963 in #239
- Fix TypedDict usage for compatibility with PyDantic by @MarkDaoust in #259
- Simplify the Python SDK README by @random-forests in #267
- Sdk update to use glm 0.6.1 by @mayureshagashe2105 in #270
New Contributors
- @aertoria made their first contribution in #256
- @TYMichaelChen made their first contribution in #260
- @random-forests made their first contribution in #267
Full Changelog: v0.4.1...v0.5.0
v0.4.1 - Bugfix
Bugfix
- The send_message_async method should call the asynchronous method generate_content_async by @xnny in #229
Docs
- Fix wrong arg name in README by @lll-lll-lll-lll in #228
New Contributors
- @lll-lll-lll-lll made their first contribution in #228
- @xnny made their first contribution in #229
Full Changelog: v0.4.0...v0.4.1
v0.4.0 - Function calling, Semantic retriever, AQA, and more
What's new
Features
- Update notebook magics to work with Gemini by @markmcd in #109
- Semantic retriever by @shilpakancharla in #168
- Attributed question answering (
genai.generate_answer
) by @shilpakancharla in #169 - Automatic function calling. by @MarkDaoust in #201
model = genai.GenerativeModel(..., tools=[my_function]) chat = model.start_chat(enable_automatic_function_calling=True)
- Request options (timeouts, retry, ...) by @aidoskanapyanov in #204
Model.generate_content(..., request_options={'timeout': 100, 'retry': google.api_core.retry.Retry()})
- Permissions module by @mayureshagashe2105 in #205
More updates
- Lock google-auth version to fix #114 by @yihong0618 in #115
- Update code in
README.md
andgenerate_content
documentation by @Hamza-nabil in #149 - Make error message more readable by @ftnext in #163
- Python 3.12 support. by @MarkDaoust in #165
- Rename model defaults to use gemini-pro by @markmcd in #175
- Add a more explicit error when no
parts
are returned by @markmcd in #180 - Add
embed_content_async
implementation by @mayureshagashe2105 in #189 - Link embed_content reference page to model details page by @kaycebasques in #194
- Implement
__repr__
forGenerateContentResponse
andChatSession
by @aidoskanapyanov in #202 - Fixed #166. Thanks @piresramon. by @MarkDaoust in #208
New Contributors
- @yihong0618 made their first contribution in #115
- @ftnext made their first contribution in #163
- @mayureshagashe2105 made their first contribution in #189
- @kaycebasques made their first contribution in #194
- @aidoskanapyanov made their first contribution in #202
Full Changelog: v0.3.2...v0.4.0
v0.3.2
What's Changed
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.
New Contributors
- @Andy963 made their first contribution in #123
- @luo-anthony made their first contribution in #132
- @thesanju made their first contribution in #131
- @mpursley made their first contribution in #129
- @Hamza-nabil made their first contribution in #140
- @YebowenHu made their first contribution in #116
- @eavanvalkenburg made their first contribution in #104
Full Changelog: v0.3.1...v0.3.2
v0.3.1 - Doc and Bug fixes.
Doc and Bug fixes.