https://github.com/waheed444/chainlit-memory-stream-agent
This project is an AI assistant built using Chainlit and the OpenAI Agent SDK, powered by Google Gemini models. It supports real-time streaming responses (just like ChatGPT) and remembers previous messages(history/memory) to keep the conversation flowing naturally.
https://github.com/waheed444/chainlit-memory-stream-agent
ai-agents-framework chainlit google-gemini-api openai-agents-sdk python uv
Last synced: about 1 month ago
JSON representation
This project is an AI assistant built using Chainlit and the OpenAI Agent SDK, powered by Google Gemini models. It supports real-time streaming responses (just like ChatGPT) and remembers previous messages(history/memory) to keep the conversation flowing naturally.
- Host: GitHub
- URL: https://github.com/waheed444/chainlit-memory-stream-agent
- Owner: waheed444
- Created: 2025-05-23T16:12:12.000Z (5 months ago)
- Default Branch: master
- Last Pushed: 2025-05-25T15:43:19.000Z (5 months ago)
- Last Synced: 2025-06-26T00:36:19.895Z (4 months ago)
- Topics: ai-agents-framework, chainlit, google-gemini-api, openai-agents-sdk, python, uv
- Language: Python
- Homepage:
- Size: 115 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Chainlit Powered Memory Streaming Agent π€
This project is an **AI assistant** built using **Chainlit** and the **OpenAI Agent SDK**, powered by **Google Gemini models**. It supports real-time **streaming** responses (just like ChatGPT) and remembers previous messages(history/memory) to keep the conversation flowing naturally. You can use it to build your own smart and responsive chatbot.
## Prerequisites β
Before running this project, ensure you have the following tools, libraries, and API keys properly configured:
| Tool / Library | Description
|--------------------------|-----------------------------------------------------------------------------
| π Python 3.9+ | Required for running the application and libraries
| 𧬠Chainlit | Framework for building conversational UIs with LLMs
| π§ OpenAI Agent SDK | Enables agent orchestration and streaming capabilities
| π Git | Version control for cloning and managing the project repository
| π Google Gemini API | [Get API Key](https://makersuite.google.com/app/apikey) for Gemini models
| π OpenAI API Key | [Get API Key](https://platform.openai.com/account/api-keys) for streaming
| π¦ dotenv | For managing environment variables securely
| π§ͺ VS Code | Recommended code editor for development---
## Features β¨
* π **Real-time Token Streaming:** Experience the fluidity of ChatGPT-like responses.
* π§ **Persistent Memory:** Maintain context across your conversations, ensuring your AI assistant remembers previous interactions.
* π **Chainlit Integration:** Leverage Chainlit's ease of use for rapid UI development and deployment.
* π€ **Gemini Power:** Utilize the cutting-edge capabilities of the `gemini-2.0-flash` model.
* π§° **OpenAI Agent SDK Integration:** Benefit from the robust features and flexibility of the OpenAI Agent SDK.
* π **Secure API Key Management:** Safely manage your API keys using a `.env` file.
* π **Developer-Friendly Codebase:** A modular and well-structured Python codebase, making it easy to extend and customize.## βοΈ Installation Instructions
1. **Clone the Repository:**
```bash
git clone https://github.com/waheed444/chainlit-memory-stream-agent.git
cd chainlit-memory-stream-agent
```2. **Create and Activate a Virtual Environment:**
```bash
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
```3. **Install dependencies:**
```bash
pip install openai-agents chainlit
# for UV User's
uv add openai-agents chainlit
```4. **Configure API keys:** Create a `.env` file in the root directory and add your API keys:
- > π Make sure to store your API keys securely in a `.env` file in the root directory:
```bash
GEMINI_API_KEY = paste_your_gemini_api_key_here
# OR
OPENAI_API_KEY = paste_your_openai_api_key_here
```5. **Run the App:**
```bash
chainlit run agent.py
```**(Note: You need to have `chainlit` installed. Install it via `pip install chainlit` if not already present.)**
## Usage Instructions π£οΈ
### Usage Examples
Start the Chat UI: Once Chainlit is running, open the local URL provided in your terminal and start chatting with your AI assistant.
Ask questions like:
```bash
Who was the founder of Pakistan?
Summarize the history of Python in 3 lines.
Whatβs the latest in AI this year?
```Enjoy token-by-token responses with context-aware answers based on your memory/previous messages.
π‘ You can customize the agent's behavior, memory strategy, or switch between Gemini and OpenAI models by modifying the `app.py` and `stream.py` files.
## Contributing
We welcome contributions to improve this project! Please follow these steps:
1. **Fork** the repository.
2. **Create a new branch:** `git checkout -b feature-name`
3. **Make your changes** and ensure they adhere to the project's coding style and best practices.
4. **Commit your changes:** `git commit -m "Add feature"`
5. **Push to the branch:** `git push origin feature-name`
6. **Submit a pull request** with a clear description of your changes and their benefits.
If you find any issues or want to improve this project, feel free to open a [GitHub issue]([https://github.com/waheed444/Chainlit-AiAgent/issues) or submit a pull request.This repo is only for learning and exploring new things, feel free to fork it, explore, or give suggestions!
**Star β the repo if it helps you!**
---
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
---
## π Let's Connect
---