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

Commit

Permalink
Merge branches 'main' and 'main' of https://github.com/dsdanielpark/G…
Browse files Browse the repository at this point in the history
  • Loading branch information
dsdanielpark committed Mar 18, 2024
2 parents 312f2c8 + 37fcfc4 commit 5f3e93f
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ cookies = {} # Cookies may vary by account or region. Consider sending the entir
GeminiClient = Gemini(cookies=cookies) # You can use various args

response = GeminiClient.generate_content("Hello, Gemini. What's the weather like in Seoul today?")
response.response_dict
response.response_dict # renamed to payload after v2.3.0
```

Generate content from image
Expand All @@ -115,9 +115,13 @@ cookies = {} # Cookies may vary by account or region. Consider sending the entir

GeminiClient = Gemini(cookies=cookies) # You can use various args
response = GeminiClient.generate_content("What does the text in this image say?", image='folder/image.jpg')
response.response_dict
response.response_dict # renamed to payload after v2.3.0
```

> [!NOTE]
> If the generate_content method returns an empty payload, try executing it again without reinitializing the Gemini object.

<br>

### # 01. Initialization
Expand Down Expand Up @@ -145,13 +149,14 @@ GeminiClient = Gemini(cookies=cookies)
<br>

### # 02. Generate content
Returns Gemini's response, but the first one might be empty. If generate_content yields an empty payload, rerun it without reinitializing Gemini.

To check regardless of the data type of the model output, return the response_dict argument. And use it appropriately.
Regardless of model output type, access the response_dict property (renamed to payload after v2.3.0).
https://github.com/dsdanielpark/Gemini-API/blob/fdf064c57bc1fb47fbbb4b93067618a200e77f62/gemini/core.py#L252
```python
prompt = "Hello, Gemini. What's the weather like in Seoul today?"
response = GeminiClient.generate_content(prompt)
print(response.response_dict)
print(response.response_dict) # renamed to payload after v2.3.0
```
> [!IMPORTANT]
> Once connected and generating valid content, **Be sure to CLOSE the Gemini website or CLOSE your browser** for cookie stability.
Expand All @@ -166,7 +171,7 @@ The output of the generate_content function is `GeminiModelOutput`, with the fol
- *code*: returns the codes of the chosen candidate.
- *web_images*: returns a list of web images from the chosen candidate.
- *generated_images*: returns a list of generated images from the chosen candidate.
- *payload*: returns the response dictionary, if available. (same as *reponse_dict*)
- *payload*: returns the response dictionary, if available. (same as *reponse_dict* under v2.2.0)

https://github.com/dsdanielpark/Gemini-API/blob/fdf064c57bc1fb47fbbb4b93067618a200e77f62/gemini/src/model/output.py#L16

Expand Down

0 comments on commit 5f3e93f

Please sign in to comment.