Skip to content
This repository has been archived by the owner on Jun 12, 2024. It is now read-only.

Commit

Permalink
doc: readme
Browse files Browse the repository at this point in the history
  • Loading branch information
dsdanielpark authored Mar 5, 2024
1 parent ed03261 commit 3f765a9
Showing 1 changed file with 3 additions and 33 deletions.
36 changes: 3 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
Development Status :: 2 - Pre-Alpha

<div align="right">
<a href="https://pypi.org/project/python-gemini-api/">
<img alt="PyPI" src="https://img.shields.io/pypi/v/python-gemini-api?color=black">
</a>
</div>
</div>

# <img src="https://www.gstatic.com/lamda/images/favicon_v1_150160cddff7f294ce30.svg" width="35px" alt="Gemini Icon" /> Gemini API <a href="https://pypi.org/project/python-gemini-api/"> <img alt="PyPI" src="https://img.shields.io/pypi/v/python-gemini-api?color=black"></a>

# <img src="https://www.gstatic.com/lamda/images/favicon_v1_150160cddff7f294ce30.svg" width="35px" alt="Gemini Icon" /> Google - Gemini API


A *unofficial* Python wrapper, [python-gemini-api](https://pypi.org/project/python-gemini-api/), operates through reverse-engineering, utilizing cookie values to interact with [Google Gemini](https://gemini.google.com) for users struggling with frequent authentication problems or unable to authenticate via [Google Authentication](https://developers.google.com/identity/protocols/oauth2?hl=en).
Expand All @@ -28,11 +25,9 @@ Gemini is a family of generative AI models developed by Google DeepMind that is
- [Text generation](#text-generation)
- [Image generation](#image-generation)
- [Generate content with image](#generate-content-with-image)
- [Text To Speech(TTS) from Gemini](#text-to-speechtts-from-gemini)
- [Further](#further)
- [Behind a proxy](#behind-a-proxy)
- [Use rotating proxies](#use-rotating-proxies)
- [Reusable session object](#reusable-session-object)
- [More features](#more-features)


Expand Down Expand Up @@ -90,9 +85,6 @@ GeminiClient = Gemini(cookies=cookies)
> **If the session connects successfully and 'generate_content' runs well, PLEASE CLOSE Gemini website.** If Gemini web stays open in the browser, cookies may expire faster.


<br>

### Generate Content
```python
prompt = "Hello, Gemini. What's the weather like in Seoul today?"
Expand All @@ -102,9 +94,6 @@ print(response)
> [!NOTE]
> If the session fails to connect, works improperly, or terminates, returning an error, it is recommended to manually renew the cookies. The error is likely due to incorrect cookie values. Refresh or log out of Gemini web to renew cookies and try again. *Once connected and generating valid content, avoid closing the browser or revisiting Gemini web for cookie stability.*
<br>


<br>

## Further
Expand Down Expand Up @@ -134,26 +123,7 @@ GeminiClient.generate_content("Hello, Gemini. Give me a beautiful photo of Seoul
```


### Reusable session object
You can continue using a reusable session, but it may not perfectly maintain context due to limitations. Consider storing summaries of past conversations in the database for better consistency.
```python
from gemini import Gemini, HEADERS
import requests

cookies = {
"key": "value"
}

session = requests.Session()
session.headers = HEADERS
session.cookies.update(cookies)

GeminiClient = Gemini(session=session, timeout=30)
response = GeminiClient.generate_content("Hello, Gemini. What's the weather like in Seoul today?")

# Continued conversation without set new session
response = GeminiClient.generate_content("What was my last prompt?")
```


<br>
Expand Down

0 comments on commit 3f765a9

Please sign in to comment.