Skip to content

Commit

Permalink
Merge pull request #8 from shamspias/fix/readme
Browse files Browse the repository at this point in the history
Fix/readme
  • Loading branch information
shamspias committed Dec 24, 2023
2 parents 4352d6b + d8761de commit c7e8fd6
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 18 deletions.
22 changes: 13 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ ephemeral conversation storage.
## Getting Started

### Prerequisites for Google Gemini API
- Get a [Google Gemini AI API key here](https://makersuite.google.com/app/apikey) and add it to Secrets in your Repl with the key GOOGLE_API_KEY.

- Get a [Google Gemini AI API key here](https://makersuite.google.com/app/apikey) and add it to Secrets in your Repl
with the key GOOGLE_API_KEY.

### Prerequisites for langchain-gemini-api

Expand Down Expand Up @@ -68,7 +70,9 @@ ephemeral conversation storage.
cd langchain-gemini-api
pip install -r requirements.txt
```

## Configuration

1. Create a `.env` file in the project directory and add the following:
```bash
GEMINI_API_KEY=<your_google_gemini_api_key> # e.g. "1234567890"
Expand All @@ -89,28 +93,28 @@ The API will be available at http://localhost:8000.

## API Endpoints

- **/conversations/<conversation_id>**: Endpoint for text-based conversations.
- **/vision-conversations/<conversation_id>**: Endpoint for image-based conversations.
- **/conversations/<conversation_id>**: Endpoint for text and image based conversations.
- **/delete/<conversation_id>**: Endpoint to delete conversation data.

## API Documentation

- **/docs**: [Swagger UI for API documentation](http://127.0.0.1:8000/docs).
- **/redoc**: [ReDoc UI for API documentation](http://127.0.0.1:8000/redoc).

## Acknowledgments

- Google Gemini API team
- [Langchain contributors](https://python.langchain.com/docs/integrations/chat/google_generative_ai)
- FastAPI community

## Demo

### Image-Based Conversation

- Coming soon

### Text-Based Conversation
### Conversation
#### With telegram bot use this one: https://t.me/rim_nova_bot
#### This is the telegram bot repo: [Gemini-Telegram-Bot](https://github.com/shamspias/gemini-telegram-bot)

- Coming soon
![Conversation](/media/images/conversation_1.png)
![Conversation](/media/images/conversation_2.png)

### Video

Expand Down
4 changes: 4 additions & 0 deletions app/utils/message_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ async def send_message_async(
raise

async def flush_conversation_cache(self, project_id: str):
# LLM configuration
llm_manager = GeminiLLMManager()
history = llm_manager.create_or_get_memory(project_id)
history.clear()
await self.cache_manager.flush_conversation_cache(project_id)

async def save_conversation_config(self, project_id: str, config: Dict):
Expand Down
Binary file added media/images/conversation_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/images/conversation_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 2 additions & 9 deletions test/endpoints/delete.http
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
# Test your FastAPI endpoints

GET http://127.0.0.1:8000/
Accept: application/json

###

GET http://127.0.0.1:8000/hello/User
Accept: application/json

###
GET http://127.0.0.1:8000/api/v1/delete/910739946
Accept: application/json

0 comments on commit c7e8fd6

Please sign in to comment.