Skip to content

Commit

Permalink
docs: update pyproject.toml and documentation added in #13
Browse files Browse the repository at this point in the history
  • Loading branch information
HanaokaYuzu committed Apr 5, 2024
1 parent f854a4a commit 3aa2371
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 18 deletions.
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -633,8 +633,8 @@ the "copyright" line and a pointer to where the full notice is found.
Copyright (C) <year> <name of author>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
Expand Down
30 changes: 16 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ A reverse-engineered asynchronous python wrapper for [Google Gemini](https://gem
- [Generate contents from text](#generate-contents-from-text)
- [Generate contents from image](#generate-contents-from-image)
- [Conversations across multiple turns](#conversations-across-multiple-turns)
- [Continue past conversations](#continue-past-conversations)
- [Continue previous conversations](#continue-previous-conversations)
- [Retrieve images in response](#retrieve-images-in-response)
- [Generate images with ImageFx](#generate-images-with-imagefx)
- [Save images to local files](#save-images-to-local-files)
Expand All @@ -60,7 +60,7 @@ A reverse-engineered asynchronous python wrapper for [Google Gemini](https://gem

> [!NOTE]
>
> This package requires Python 3.10 or later.
> This package requires Python 3.10 or higher.
Install/update the package with pip.

Expand Down Expand Up @@ -165,24 +165,26 @@ asyncio.run(main())
>
> Same as `GeminiClient.generate_content`, `ChatSession.send_message` also accepts `image` as an optional argument.
### Continue past conversations
### Continue previous conversations

To retrive past conversations you can pass through the `cid`, `rid` and `rcid` through the `metadata` argument in the `start_chat()` function. To Alternitavly if you want to save the variables you can get it from `chat_session.metadata`.
To manually retrieve previous conversations, you can pass previous `ChatSession`'s metadata to `GeminiClient.start_chat` when creating a new `ChatSession`. Alternatively, you can persist previous metadata to a file or db if you need to access them after the current Python process has exited.

```python
async def main():
# Load the past conversation
chat = client.start_chat("Your chat id")
responce = await chat.send_message("What was my previous message?")
# Save the conversation id
gemini_chatID = chat.metadata
```
# Start a new chat session
chat = client.start_chat()
response = await chat.send_message("Fine weather today")

> [!IMPORTANT]
>
> Storing the chat variables in a local variable like in this example will get eraced at runtime.
> If you would like to save these it is recomended to store it in json or in a database of some short.
# Save chat's metadata
previous_session = chat.metadata

# Load the previous conversation
previous_chat = client.start_chat(metadata=previous_session)
response = await previous_chat.send_message("What was my previous message?")
print(response)

asyncio.run(main())
```

### Retrieve images in response

Expand Down
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@ name = "gemini-webapi"
authors = [
{name = "UZQueen"},
]
description = "A reverse-engineered async wrapper for Google Gemini web client"
description = "✨ An elegant async Python wrapper for Google Gemini web app"
readme = "README.md"
license = {file = "LICENSE"}
keywords = ["API", "async", "Gemini", "Bard", "Google", "Generative AI", "LLM"]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
Expand Down

0 comments on commit 3aa2371

Please sign in to comment.