The GPT Assistants Playground is designed to showcase the building, testing, and usage of GPT Assistants in a playground setting. This project aims to help users learn how to consume the Assistants API by demonstrating multi-modal interface that can be extended and integrated into your own applications.
Licensed under the Apache License 2.0.
This project demonstrates how to consume all features and functions of the OpenAI Assistants API through a Gradio interface. Gradio was selected since it provides multi-modal input and output through a chat interface, allowing users to upload files and receive generated files or other content in response. Another key feature is the ability for users to view how the assistants use various tools, such as the code interpreter and other functions, behind the scenes.
-
Clone this repository:
git clone https://github.com/cxbxmxcx/GPTAssistantsPlayground.git
-
Install the requirements:
pip install -r requirements.txt
Either set your OpenAI key as an environment variable using:
export OPENAI_API_KEY="your api key"
Or, if using PowerShell, use:
$env:OPENAI_API_KEY="your api key"
Alternatively, create a new file called .env and populate it with the environment variable setting:
OPENAI_API_KEY="your api key"
Then from the project folder, run the interface using:
python main.py
Open a browser to the default Gradio port: http://127.0.0.1:7860/
After the interface is launched, select or create a new agent and start chatting as shown in the image below:
The main interface tab consists of the following components:
- The Assistants panel where you can select, update and create assistants
- The conversation panel which is multi-modal and supports uploading files and for the assistant to generate and show files.
- The Assistant log panel shows how the assistant is working with and consuming tools behind the scenes. This includes showing the code it runs within its code interpreter. Other interface tabs:
- Logs - allows you to view any internal conversations by the assistant, this includes how and which actions (tools/functions) it is using.
- Agentic Behavior Tree (new) - this panel allows you to load, visualize, run and deploy agentic behavior trees
- Prefect Flow Runner - is a window to the Prefect web interface. You must have Prefect running to see this.
You can install several of the demo assistants located in the assistants.db Sqlite database. To do this follow these instructions:
- Create a new or use an existing assistant.
- Give the assistant the action - create_manager_assistant (found under the Actions section)
- Ask the assistant to create the manager assistant (ie. "please create the manager assistant")
- Refresh your browser to reload the assistants selector
- Select the new Manager Assistant - this assistant has the instructions and actions that will allow it to install assistants from the assistants.db database
This tab allows you to open and run/deploy agentic behavior trees and includes the following functionality:
- Load - load a yaml file that contains your tree definition. The folder btrees, contains some examples. Be sure to have the required assistants installed before running a btree.
- Editing the YAML, as you edit the yaml, the graph displaying the btree will also update to show how your yaml is being parsed
- Save - saving functionality is currently broken, it you make changes in a file it is recommended to copy paste the edits into the file directly.
- Run - this will run the btree with the Playground, you can check the progress of the run by viewing the Logs tab
- Deploy - (note: Prefect server must be running) - this will deploy the btree to Prefect and allow you to run, suspend, and schedule new runs using the web interface. Note, the Playground must be currently running in order to host the btree run. In the future their will be an option to deplay a btree to a Docker container.
Prefect is now automatically installed along with the other package requirements.
In order to use the Prefect Web UI you will need to run a server instance by executing the following in a new terminal window:
prefect server start
This will launch a server instance. You can then access Prefect through the tab in the Playground interface.
More info on Prefect can be found here: https://github.com/PrefectHQ/prefect
- OpenAI Documentation
- Gradio Documentation
- Python Official Documentation
- Additional tutorials and guides will be added here.
We welcome contributions and suggestions! Engage in discussions, report bugs, or propose new features.
We welcome and appreciate contributions from the community! Please follow these guidelines to contribute to the GPT Assistants Playground project:
-
Fork the Repository:
- Fork the repository to your own GitHub account by clicking the "Fork" button.
-
Clone Your Fork:
- Clone your forked repository to your local machine:
git clone https://github.com/your-username/GPTAssistantsPlayground.git
- Clone your forked repository to your local machine:
-
Create a Branch:
- Create a new branch for your feature or bugfix:
git checkout -b feature-name
- Create a new branch for your feature or bugfix:
-
Make Changes:
- Make your changes to the codebase. Ensure your code follows the project's coding standards and includes appropriate tests.
-
Commit Changes:
- Commit your changes with a clear and concise commit message:
git commit -m "Description of your changes"
- Commit your changes with a clear and concise commit message:
-
Push to Your Fork:
- Push your changes to your forked repository:
git push origin feature-name
- Push your changes to your forked repository:
-
Open a Pull Request:
- Open a pull request to merge your changes into the main repository. Provide a detailed description of your changes and any related issue numbers.
- Be respectful and considerate of others.
- Provide constructive feedback.
- Report issues and participate in discussions in a courteous manner.
- A project maintainer will review your pull request. They may request changes or provide feedback.
- Ensure your pull request passes all continuous integration (CI) checks.
- Address any review comments and push updates as necessary.
- When opening an issue, provide as much detail as possible about the bug or feature request.
- Include steps to reproduce the issue if applicable.
- Join the community discussions to engage with other contributors and maintainers.
- Reach out for help or clarification when needed.
We appreciate your contributions and look forward to collaborating with you!
Licensed under the Apache License 2.0.