Releases: dsdanielpark/Gemini-API
2.4.12
Gemini-API v2.4.12
| 2024-05-20 | There are some changes in logic depending on the region/country (IP) and account.
Users need to check the following to find the appropriate logic for themselves.
The package remains suitable for the most common use cases.
- BOT_SERVER params in const.py
- self._sid in client.py
- self._rcid in client.py
- Parsing method in response_parser.py
pip install python-gemini-api==2.4.12
pip install -q -U python-gemini-api
2.4.10
Gemini-API v2.4.10
- Most error fixes and feature tests have been completed. (2024-04-29)
- We are always looking for contributors to the package. Please feel free to report any QA issues or errors.
pip install python-gemini-api==2.4.10
pip install -q -U python-gemini-api
2.4.6
Gemini-API v2.4.6
- Error fixed
- Add OpenRouter async clinet
- MIT licensed
pip install python-gemini-api==2.4.6
pip install -q -U python-gemini-api
2.4.2
Gemini-API v2.4.2
Error fixed.
pip install python-gemini-api==2.4.2
pip install -q -U python-gemini-api
What's changed?
- You can use gemini-advanced version by declaring env variable. (Experimental feature)
import os os.environ["GEMINI_ULTRA"] = "1"
- Error fix #24
- New feature from 2.4.0
[See Code Examples]
Check out temporarily free Open-source LLM APIs with Open Router. (Free limit: 10 requests/minute)
Utilize free open-source LLM API through Open Router
OpenRouter offers temporary free inference for select models. Obtain an API key from Open Router API and check free models at Open Router models. Use models with a 0-dollar token cost primarily; other models may incur charges. See more free open-source LLM API guide
Note
You can easily receive responses from open LLMs without this package by following the instructions on here.
from gemini import OpenRouter
OPENROUTER_API_KEY = "<your_open_router_api_key>"
GemmaClient = OpenRouter(api_key=OPENROUTER_API_KEY, model="google/gemma-7b-it:free")
prompt = "Do you know UCA academy in Korea? https://blog.naver.com/ulsancoding"
response = GemmaClient.create_chat_completion(prompt)
print(response)
# payload = GemmaClient.generate_content(prompt)
# print(payload.json())
The free model list includes:
google/gemma-7b-it:free
- google/gemma-7b from Google ***mistralai/mistral-7b-instruct:free
- mistralai/Mistral-7B-Instruct-v0.1 for instruction from Mistral AI ****huggingfaceh4/zephyr-7b-beta:free
- HuggingFaceH4/zephyr-7b-beta ***openchat/openchat-7b:free
- openchat/openchat for chat **openrouter/cinematika-7b:free
- jondurbin/cinematika-7b-v0.1undi95/toppy-m-7b:free
- Undi95/Toppy-M-7Bgryphe/mythomist-7b:free
- Gryphe/MythoMist-7bnousresearch/nous-capybara-7b:free
- NousResearch/Nous-Capybara-7B-V1 from Nous Research
2.4.0
Gemini-API v2.4.0
This release includes various bug fixes and new features.
What's changed?
- Adding temporary free access to open-source LLM APIs. Stably use Google's Gemma for free.
- [Example codes] (Free limit: 10 requests/minute)
Installation 📦
pip install python-gemini-api==2.4.0
Utilize free open-source LLM API through Open Router in Gemini-API
OpenRouter offers temporary free inference for select models. Obtain an API key from Open Router API and check free models at Open Router models. Use models with a 0-dollar token cost primarily; other models may incur charges. See more free open-source LLM API guide
from gemini import OpenRouter
OPENROUTER_API_KEY = "<your_open_router_api_key>"
GemmaClient = OpenRouter(api_key=OPENROUTER_API_KEY, model="google/gemma-7b-it:free")
prompt = "Do you know UCA academy in Korea? https://blog.naver.com/ulsancoding"
response = GemmaClient.create_chat_completion(prompt)
print(response)
# payload = GemmaClient.generate_content(prompt)
# print(payload.json())
The free model list includes:
google/gemma-7b-it:free
- google/gemma-7b from Google ***mistralai/mistral-7b-instruct:free
- mistralai/Mistral-7B-Instruct-v0.1 for instruction from Mistral AI ****huggingfaceh4/zephyr-7b-beta:free
-HuggingFaceH4/zephyr-7b-beta ***openchat/openchat-7b:free
- openchat/openchat for chat **openrouter/cinematika-7b:free
- jondurbin/cinematika-7b-v0.1undi95/toppy-m-7b:free
- Undi95/Toppy-M-7Bgryphe/mythomist-7b:free
- Gryphe/MythoMist-7bnousresearch/nous-capybara-7b:free
- NousResearch/Nous-Capybara-7B-V1 from Nous Research
Note
You can easily receive responses from open LLMs without this package by following the instructions on here.
2.3.0
Gemini-API v2.3.0
This release includes various bug fixes and new features.
What's changed?
- Improved auto cookie strategy (#24), but further enhancements possible.
- Resolved bug related to Gemini property error (#19).
- Added multi-language support.
Installation 📦
pip install python-gemini-api==2.3.0
or
pip install -q -U python-gemini-api
Improvements in functionality other than error correction may be slow.
Thank you always for your love.
2.2.0
Gemini-API 2.2.0
This release includes various bug fixes and new features.
What's changed?
- The parsing strategy has changed due to payload changes in Gemini.
- Returned output may include organized code snippets.
- Fixed a type error. (#21)
- Experimenting with STT (speech to text) and TTS (text to speech) features, but they are still incomplete. Will release as version
3.0.0
once fully developed. - For other errors, refer to the issue page. Make sure to read the following issue. (#14)
Installation 📦
pip install python-gemini-api==2.2.0
Improvements in functionality other than error correction may be slow. Thank you always for your love.
2.0.0
Gemini API
Installation
pip install python-gemini-api==2.0.0
pip install git+https://github.com/dsdanielpark/Gemini-API.git
For the updated version, use the following command:
pip install -q -U python-gemini-api
Release Notes
This release includes various bug fixes and new features.
1.0.0
Gemini API - v1.x.x
Development Status :: 1 - Planning
In February 2024, Bard underwent a rebranding and is now known as Gemini. The Bard API has transitioned to the Gemini API.
Going forward, only major version updates will be documented in the release notes. For other minor patches, please refer to the latest PyPI files.
$ pip install python-gemini-api
$ pip install -q -U python-gemini-api
from gemini import Gemini
cookies = {
"key": "value"
}
GeminiClient = Gemini(cookies=cookies)
# GeminiClient = Gemini(cookie_fp="folder/cookie_file.json") # Or use cookie file path
# GeminiClient = Gemini(auto_cookies=True) # Or use auto_cookies paprameter
# Before proceeding, ensure that the GeminiClient object is defined without any errors.
prompt = "Hello, Gemini. What's the weather like in Seoul today?"
response = GeminiClient.generate_content(prompt)
print(response)
Full Changelog: https://github.com/dsdanielpark/Gemini-API/commits/1.0.0
Release Note
- Development is ongoing. Stay tuned. (Some features work, but it's incomplete.)
- Use a Chrome extension to fetch cookie values, as some cookies are not yet specified.
- Still working on parsing the response text.
- Only part of the text generation feature works.
- Developing logic to automatically refresh cookie values, see auto_cookies for details.
0.1.6
Gemini API - v0.1.6
In February 2024, Bard has changed its service name to Gemini.
Bard API to Gemini API
$ pip install python-gemini-api==0.1.6
$ pip install -q -U python-gemini-api
from gemini import Gemini
cookies = {
"key": "value"
}
GeminiClient = Gemini(cookies=cookies)
# GeminiClient = Gemini(cookie_fp="folder/cookie_file.json") # Or use cookie file path
# GeminiClient = Gemini(auto_cookies=True) # Or use auto_cookies paprameter
# Before proceeding, ensure that the GeminiClient object is defined without any errors.
prompt = "Hello, Gemini. What's the weather like in Seoul today?"
response = GeminiClient.generate_content(prompt)
print(response)
Full Changelog: https://github.com/dsdanielpark/Gemini-API/commits/0.1.6
Release Note
- Development is ongoing. Stay tuned. (Some features work, but it's incomplete.)
- Use a Chrome extension to fetch cookie values, as some cookies are not yet specified.
- Still working on parsing the response text.
- Only part of the text generation feature works.
- Developing logic to automatically refresh cookie values, see auto_cookies for details.