Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ryo-ma/gpt-assistants-api-ui
π¬ OpenAI Assistants API chat UI π οΈ It works easily by setting the ASSISTANT ID π Supports file upload and file download π Supports Streaming API πͺ Support to Azure OpenAI
https://github.com/ryo-ma/gpt-assistants-api-ui
assistant-api chatgpt gpt openai openai-api openai-assistant-api openai-assistants openai-chatgpt streamlit streamlit-webapp
Last synced: 2 days ago
JSON representation
π¬ OpenAI Assistants API chat UI π οΈ It works easily by setting the ASSISTANT ID π Supports file upload and file download π Supports Streaming API πͺ Support to Azure OpenAI
- Host: GitHub
- URL: https://github.com/ryo-ma/gpt-assistants-api-ui
- Owner: ryo-ma
- License: mit
- Created: 2023-11-19T17:11:59.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-09-23T01:00:48.000Z (4 months ago)
- Last Synced: 2025-01-20T09:15:24.557Z (9 days ago)
- Topics: assistant-api, chatgpt, gpt, openai, openai-api, openai-assistant-api, openai-assistants, openai-chatgpt, streamlit, streamlit-webapp
- Language: Python
- Homepage:
- Size: 134 KB
- Stars: 228
- Watchers: 5
- Forks: 185
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gpt-assistants-api-ui
* π¬ OpenAI Assistants API chat UI
* π οΈ It works easily by setting the ASSISTANT IDs
* π Supports file upload and file download
* π Supports Streaming API
* π₯ Supports multiple Assistant profiles in one place
* πͺ Support to Azure OpenA
* β» Cannot be used until Azure OpenAI Service supports Streaming API## π Quick Start
1. π€ Create an assistant on the OpenAI site & Get assistant ID (https://platform.openai.com/assistants)
2. π Get the API key from OpenAI (https://platform.openai.com/api-keys)
3. β¬οΈ Clone the repository```bash
$ git clone https://github.com/ryo-ma/gpt-assistants-api-ui.git
```4. π¦ Install dependencies
```bash
$ poetry install
```5. βοΈ Set environment variables file `.env`
```bash
# OpenAI settings
OPENAI_API_KEY="sk-xxx"
APP_ENABLED_FILE_UPLOAD_MESSAGE="Upload a file" # Leave empty to disableAUTHENTICATION_REQUIRED="False" # Must change to True if you require authentication
# When using only one assistant, set the following, unset the OPENAI_ASSISTANTS variable.
ASSISTANT_ID="asst_xxx"
ASSISTANT_TITLE="Assistants API UI" # This is for the single agent title# When using multiple assistants, set the following.
OPENAI_ASSISTANTS='[{"id": "asst_xxx", "title": "Assistants XXX UI"}, {"id": "asst_yyy", "title": "Assistants YYY UI"}]'
```
If you use azure instead, set `AZURE_OPENAI_ENDPOINT` and `AZURE_OPENAI_KEY`6. π Set Authentication configuration (optional)
To set up authentication, create a [secrets](https://docs.streamlit.io/deploy/streamlit-community-cloud/deploy-your-app/secrets-management) file `.streamlit/secrets.toml` as below:
```toml
[credentials]
usernames = { jsmith = {failed_login_attempts = 0, logged_in = false, name = "John Smith", password = "abc"}, rbriggs = {failed_login_attempts = 0, logged_in = false, name = "R Briggs", password = "abc"}}[cookie]
expiry_days = 30
key = "some_signature_key" # Must be string
name = "some_cookie_name"
```
Reference: [Deploying Streamlit-Authenticator via Streamlit Community Cloud](https://discuss.streamlit.io/t/deploying-streamlit-authenticator-via-streamlit-community-cloud/39085)## πβοΈ Run the app using Streamlit
```bash
$ poetry shell
$ streamlit run app.py
```## π³ Run the app using Docker
1. π½ Build image
```bash
$ docker compose build
```2. πβοΈ Run the app
```bash
$ docker compose up
```
Access to [http://localhost:8501](http://localhost:8501).## π Deploy to Streamlit Cloud
You can fork this repository and deploy the app to https://share.streamlit.io/. No need to run the app on your local machine.> Don't forget to choose 3.10 as the Python version and set environment variables in the "Advanced settings" during deployment.
To use authentication with Streamlit Cloud, please use this TOML format:
```toml
# Environment variables
# OpenAI settings
OPENAI_API_KEY="sk-xxx"
APP_ENABLED_FILE_UPLOAD_MESSAGE="Upload a file" # Leave empty to disableAUTHENTICATION_REQUIRED="False" # Must change to True if you require authentication
# When using only one assistant, set the following, unset the OPENAI_ASSISTANTS variable.
ASSISTANT_ID="asst_xxx"
ASSISTANT_TITLE="Assistants API UI" # This is for the single agent title# When using multiple assistants, set the following.
OPENAI_ASSISTANTS='[{"id": "asst_xxx", "title": "Assistants XXX UI"}, {"id": "asst_yyy", "title": "Assistants YYY UI"}]'# Authentication secrets
[credentials]
usernames = { jsmith = {failed_login_attempts = 0, logged_in = false, name = "John Smith", password = "abc"}, rbriggs = {failed_login_attempts = 0, logged_in = false, name = "R Briggs", password = "abc"}}[cookie]
expiry_days = 30
key = "some_signature_key" # Must be string
name = "some_cookie_name"
```