An open API service indexing awesome lists of open source software.

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.

Awesome Lists containing this project

README

          

# Chainlit Powered Memory Streaming Agent πŸ€–



GitHub stars


GitHub forks

Python Version


Chainlit


Fork


Star

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]([![License](https://img.shields.io/badge/License-MIT-blue.svg)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



LinkedIn


GitHub


Gmail

---