You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 12, 2024. It is now read-only.
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).
9
+
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). This repository is not expected to be updated frequently, and it will be modified for personal use.
10
10
11
11
Collaborated competently with [Antonio Cheong](https://github.com/acheong08).
To check regardless of the data type of the model output, return the response_dict argument. And use it appropriately.
107
110
108
111
```python
@@ -143,10 +146,9 @@ print(response.text)
143
146
144
147
### # 04. Image generation
145
148
Returns images generated by Gemini.
146
-
> [!NOTE]
147
-
> Use GeminiImage for image processing. `web_images` works without cookies, but for images like `generated_image` from Gemini, pass cookies. Cookies are needed to download images from Google's storage. Check the response or use existing cookies variable.
> Use GeminiImage for image processing. `web_images` works without cookies, but for images like `generated_image` from Gemini, pass cookies. Cookies are needed to download images from Google's storage. Check the response or use existing cookies variable.
response = GeminiClient.generate_content("What does the text in this image say?", image=image)
305
+
response.response_dict
306
+
```
307
+
308
+
<br>
309
+
310
+
### # 07. Generate content using Google Services
311
+
To begin, you must link Google Workspace to activate this extension via the [Gemini web extension](https://gemini.google.com/extensions). Please refer to the [official notice](https://support.google.com/gemini/answer/13695044) and review the [privacy policies](https://support.google.com/gemini/answer/13594961?visit_id=638457301410420313-1578971242&p=privacy_help&rd=1) for more details.
You can specify a particular response by setting its Response Choice ID (RCID).
354
+
355
+
```python
356
+
# Generate content for the prompt "Give me some information about the USA."
357
+
response1 = GeminiClient.generate_content("Give me some information about the USA.")
358
+
# After reviewing the responses, choose the one you prefer and copy its RCID.
359
+
GeminiClient.rcid ="rc_xxxx"
360
+
361
+
# Now, generate content for the next prompt "How long does it take from LA to New York?"
362
+
response2 = GeminiClient.generate_content("How long does it take from LA to New York?")
363
+
```
364
+
365
+
<br>
366
+
367
+
### # 09. Changing the Selected Response from 0 to n
368
+
In Gemini, generate_content returns the first response. This may vary depending on length or sorting. Therefore, you can specify the index of the chosen response from 0 to n as follows. However, if there is only one response, revert it back to 0.
369
+
```python
370
+
from gemini import GeminiModelOutput
371
+
GeminiModelOutput.chosen =1# default is 0
372
+
response1 = GeminiClient.generate_content("Give me some information about the USA.")
373
+
```
374
+
375
+
301
376
## Further
302
377
303
378
### Use rotating proxies
@@ -400,14 +475,15 @@ Contributors to the [Bard API](https://github.com/dsdanielpark/Bard-API/) and [G
[MIT](https://opensource.org/license/mit/) license, 2024, Minwoo(Daniel) Park. We hereby strongly disclaim any explicit or implicit legal liability related to our works. Users are required to use this package responsibly and at their own risk. This project is a personal initiative and is not affiliated with or endorsed by Google. It is recommended to use Google's official API.
486
+
[MIT](https://opensource.org/license/mit/) license, 2024. We hereby strongly disclaim any explicit or implicit legal liability related to our works. Users are required to use this package responsibly and at their own risk. This project is a personal initiative and is not affiliated with or endorsed by Google. It is recommended to use Google's official API.
411
487
412
488
413
489
## References
@@ -423,4 +499,3 @@ Users bear all legal responsibilities when using the GeminiAPI package, which of
423
499
<br>
424
500
425
501
426
-
*Copyright (c) 2024 Minwoo(Daniel) Park, South Korea*<br>
0 commit comments