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

Commit 990eaf1

Browse files
authored
doc: update readme for v2.0.0
1 parent 66a3acc commit 990eaf1

File tree

1 file changed

+72
-1
lines changed

1 file changed

+72
-1
lines changed

README.md

Lines changed: 72 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,13 +295,84 @@ if __name__ == "__main__":
295295
<br>
296296

297297
### # 06. Generate content from images
298+
Takes an image as input and returns a response.
299+
300+
```python
301+
image = 'folder/image.jpg'
302+
# image = open('folder/image.jpg', 'rb').read() # (jpeg, png, webp) are supported.
303+
304+
response = GeminiClient.generate_content("What does the text in this image say?", image=image)
305+
response.response_dict
306+
```
298307

299308
<br>
300309

301310
### # 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.
312+
313+
*extention flags*
314+
```
315+
@Gmail, @Google Drive, @Google Docs, @Google Maps, @Google Flights, @Google Hotels, @YouTube
316+
```
317+
```python
318+
response = GeminiClient.generate_content("@YouTube Search clips related with Google Gemini")
319+
response.response_dict
320+
```
321+
<details><summary>Extension description</summary>
322+
323+
### Google Workspace
324+
- **Services**: @Gmail, @Google Drive, @Google Docs
325+
- **Description**: Summarize, search, and find desired information quickly in your content for efficient personal task management.
326+
- **Features**: Information retrieval, document summarization, information categorization
327+
328+
### Google Maps
329+
- **Service**: @Google Maps
330+
- **Description**: Execute plans using location-based information. Note: Google Maps features may be limited in some regions.
331+
- **Features**: Route guidance, nearby search, navigation
332+
333+
### Google Flights
334+
- **Service**: @Google Flights
335+
- **Description**: Search real-time flight information to plan tailored travel itineraries.
336+
- **Features**: Holiday preparation, price comparison, trip planning
337+
338+
### Google Hotels
339+
- **Service**: @Google Hotels
340+
- **Description**: Search for hotels considering what matters most to you, like having a conversation with a friend.
341+
- **Features**: Packing for travel, sightseeing, special relaxation
342+
343+
### YouTube
344+
- **Service**: @YouTube
345+
- **Description**: Explore YouTube videos and ask questions about what interests you.
346+
- **Features**: Problem-solving, generating ideas, search, exploring topics
347+
</details>
302348

303349
<br>
304350

351+
352+
### # 08. Fix context setting rcid
353+
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+
305376
## Further
306377

307378
### Use rotating proxies
@@ -412,7 +483,7 @@ Core maintainers:
412483

413484

414485
## License
415-
[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.
416487

417488

418489
## References

0 commit comments

Comments
 (0)