Google-generativeai

Latest version: v0.5.2

Safety actively analyzes 623586 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 1 of 3

0.5.2

Bug Fix

* Fix file uploads by MarkDaoust in https://github.com/google-gemini/generative-ai-python/pull/291

New Features

* Support for new `TaskTypes` and `output_dimensionality` param by mayureshagashe2105 in https://github.com/google-gemini/generative-ai-python/pull/285


**Full Changelog**: https://github.com/google-gemini/generative-ai-python/compare/v0.5.1...v0.5.2

0.5.1

New features

* Add JSON mode by shilpakancharla in https://github.com/google/generative-ai-python/pull/274

Docs and small fixes

* Fix: incorrect type checking by Yeuoly in https://github.com/google/generative-ai-python/pull/283
* Fix an internal test failure by markmcd in https://github.com/google/generative-ai-python/pull/279
* Allow incomplete GenerationConfigDict by markmcd in https://github.com/google/generative-ai-python/pull/286
* Use generativelanguage v0.6.2 for json mode + update package version. by MarkDaoust in https://github.com/google/generative-ai-python/pull/287

New Contributors
* Yeuoly made their first contribution in https://github.com/google/generative-ai-python/pull/283

**Full Changelog**: https://github.com/google/generative-ai-python/compare/v0.5.0...v0.5.1

0.5.0

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 https://github.com/google/generative-ai-python/pull/249
* Files API: improve error messages, add delete_file, add `.uri` property by TYMichaelChen in https://github.com/google/generative-ai-python/pull/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 https://github.com/google/generative-ai-python/pull/230

* System instructions

When creating a model you can pass a string (or `Content`) as `system_instructions`: `genai.GenerativeModel(system_instructions="Be good!")`
* Add basic SI and tool_config support by MarkDaoust in https://github.com/google/generative-ai-python/pull/257
* Add `system_instruction` to model repr by markmcd in https://github.com/google/generative-ai-python/pull/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 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.

* Add basic SI and tool_config support by MarkDaoust in https://github.com/google/generative-ai-python/pull/257
* Function calling mode patch by mayureshagashe2105 in https://github.com/google/generative-ai-python/pull/271

Docs, bug fixes, and minor updates.

* Update README.md by aertoria in https://github.com/google/generative-ai-python/pull/256
* Fix incorrect reference to self.candidates[0].parts, self.candidates[0].parts[0].text by Andy963 in https://github.com/google/generative-ai-python/pull/239
* Fix TypedDict usage for compatibility with PyDantic by MarkDaoust in https://github.com/google/generative-ai-python/pull/259
* Simplify the Python SDK README by random-forests in https://github.com/google/generative-ai-python/pull/267
* Sdk update to use glm 0.6.1 by mayureshagashe2105 in https://github.com/google/generative-ai-python/pull/270

New Contributors
* aertoria made their first contribution in https://github.com/google/generative-ai-python/pull/256
* TYMichaelChen made their first contribution in https://github.com/google/generative-ai-python/pull/260
* random-forests made their first contribution in https://github.com/google/generative-ai-python/pull/267

**Full Changelog**: https://github.com/google/generative-ai-python/compare/v0.4.1...v0.5.0

0.4.1

Bugfix

* The send_message_async method should call the asynchronous method generate_content_async by xnny in https://github.com/google/generative-ai-python/pull/229

Docs

* Fix wrong arg name in README by lll-lll-lll-lll in https://github.com/google/generative-ai-python/pull/228

New Contributors
* lll-lll-lll-lll made their first contribution in https://github.com/google/generative-ai-python/pull/228
* xnny made their first contribution in https://github.com/google/generative-ai-python/pull/229

**Full Changelog**: https://github.com/google/generative-ai-python/compare/v0.4.0...v0.4.1

0.4.0

What's new

Features

* Update notebook magics to work with Gemini by markmcd in https://github.com/google/generative-ai-python/pull/109
* Semantic retriever by shilpakancharla in https://github.com/google/generative-ai-python/pull/168
* Attributed question answering (`genai.generate_answer`) by shilpakancharla in https://github.com/google/generative-ai-python/pull/169
* Automatic function calling. by MarkDaoust in https://github.com/google/generative-ai-python/pull/201

model = genai.GenerativeModel(..., tools=[my_function])
chat = model.start_chat(enable_automatic_function_calling=True)

* Request options (timeouts, retry, ...) by aidoskanapyanov in https://github.com/google/generative-ai-python/pull/204

Model.generate_content(...,
request_options={'timeout': 100, 'retry': google.api_core.retry.Retry()})

* Permissions module by mayureshagashe2105 in https://github.com/google/generative-ai-python/pull/205


More updates

* Lock google-auth version to fix 114 by yihong0618 in https://github.com/google/generative-ai-python/pull/115
* Update code in `README.md` and `generate_content` documentation by Hamza-nabil in https://github.com/google/generative-ai-python/pull/149
* Make error message more readable by ftnext in https://github.com/google/generative-ai-python/pull/163
* Python 3.12 support. by MarkDaoust in https://github.com/google/generative-ai-python/pull/165
* Rename model defaults to use gemini-pro by markmcd in https://github.com/google/generative-ai-python/pull/175
* Add a more explicit error when no `parts` are returned by markmcd in https://github.com/google/generative-ai-python/pull/180
* Add `embed_content_async` implementation by mayureshagashe2105 in https://github.com/google/generative-ai-python/pull/189
* Link embed_content reference page to model details page by kaycebasques in https://github.com/google/generative-ai-python/pull/194
* Implement `__repr__` for `GenerateContentResponse` and `ChatSession` by aidoskanapyanov in https://github.com/google/generative-ai-python/pull/202
* Fixed 166. Thanks piresramon. by MarkDaoust in https://github.com/google/generative-ai-python/pull/208

New Contributors
* yihong0618 made their first contribution in https://github.com/google/generative-ai-python/pull/115
* ftnext made their first contribution in https://github.com/google/generative-ai-python/pull/163
* mayureshagashe2105 made their first contribution in https://github.com/google/generative-ai-python/pull/189
* kaycebasques made their first contribution in https://github.com/google/generative-ai-python/pull/194
* aidoskanapyanov made their first contribution in https://github.com/google/generative-ai-python/pull/202

**Full Changelog**: https://github.com/google/generative-ai-python/compare/v0.3.2...v0.4.0

0.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 https://github.com/google/generative-ai-python/pull/123
* luo-anthony made their first contribution in https://github.com/google/generative-ai-python/pull/132
* thesanju made their first contribution in https://github.com/google/generative-ai-python/pull/131
* mpursley made their first contribution in https://github.com/google/generative-ai-python/pull/129
* Hamza-nabil made their first contribution in https://github.com/google/generative-ai-python/pull/140
* YebowenHu made their first contribution in https://github.com/google/generative-ai-python/pull/116
* eavanvalkenburg made their first contribution in https://github.com/google/generative-ai-python/pull/104

**Full Changelog**: https://github.com/google/generative-ai-python/compare/v0.3.1...v0.3.2

Page 1 of 3

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.