Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README.md #13

Merged
merged 1 commit into from
Apr 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +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)
- [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 Down Expand Up @@ -164,6 +165,25 @@ asyncio.run(main())
>
> Same as `GeminiClient.generate_content`, `ChatSession.send_message` also accepts `image` as an optional argument.

### Continue past 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`.

```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
```

> [!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.


### Retrieve images in response

Images in the API's output are stored as a list of `Image` objects. You can access the image title, URL, and description by calling `image.title`, `image.url` and `image.alt` respectively.
Expand Down