This repository hosts the Chat Piano API server, providing an efficient and scalable solution for managing and expanding tool-based services. Chat Piano leverages advanced AI models to interpret voice commands and convert them into MIDI files, facilitating seamless interactions between users and digital music creation platforms.
- Modular Tool Integration: Easily add new tools to the system while maintaining high scalability and performance.
- Scalability: Designed to handle growth with minimal effort, ensuring consistent performance as more tools are added.
- Package Management: Simplifies installation and updates via pip tools. Publishing to PyPI is planned for the future.
- Standard OpenAI Tool Definition: Utilizes OpenAI's standardized tool definition formats, ensuring compatibility and ease of integration into AI workflows.
- Python 3.8 or higher
- Docker (optional for containerized deployment)
- uv (optional for advanced synchronization and management)
Local Installation - Set up directly on your machine
This section provides detailed steps to install the project locally. Ideal for developers or testers who wish to modify and run the tool on their machines.
- Clone the repository recursively to include all submodules:
git clone git@github.com:yhbcode000/ChatPiano.git cd ChatPiano- Install the package in editable mode to allow changes:
pip install -e .- Start the Chat Piano tool server:
After this, the server will start and provide a URL for API interaction.start-chatpiano
Using uv - Enhanced project synchronization and management
The `uv` tool provides a streamlined way to manage synchronization and ensure optimal configurations for running the project.
- Sync the project to ensure all dependencies and configurations are up-to-date:
uv sync- Run the server with the `uv` management tool:
This command ensures the application is running with the best possible setup provided by `uv`.uv run python -m chat_piano
Docker Setup - Containerized deployment for isolated environments
Use Docker to encapsulate the project and its dependencies for an isolated and consistent environment. This is the recommended approach for production use.
- Build the Docker container locally:
docker build -t chat-piano .- Run the container in detached mode:
docker run -d --name chat-piano-instance chat-pianoNote: The Docker image includes all dependencies, ensuring a consistent and isolated environment. For production use, consider pulling the pre-built image to save time.
Pull Pre-Built Docker Image - Quick setup using a pre-built image
For quicker setup and deployment, use a pre-built Docker image hosted on Docker Hub.
- Pull the image directly from Docker Hub:
docker pull TODO-TO-BE-ANNOUNCED- Create a container from the pulled image:
docker run -d --name chat-piano-instance TODO-TO-BE-ANNOUNCED- Optionally, set up the Docker service for managed deployment:
This approach is ideal for scaling and orchestrating multiple instances efficiently.docker service create --name chat-piano-service TODO-TO-BE-ANNOUNCED
Once the server starts, you can access the API documentation via the provided link in the console output. Use the documentation to explore and interact with the APIs.
- Start the server locally or via Docker.
- Visit
http://localhost:5000(or the server's actual address) to access the interactive API documentation. - Test endpoints directly from the documentation or integrate the APIs into your application.
We welcome contributions from the community. Here are some ways you can contribute:
- Report bugs or suggest features by opening issues.
- Submit pull requests for fixes or new tools.
- Share feedback and ideas for improvement.
Adding Tools to the Repository - Extend the functionality with new tools
To add a new tool to the Chat Piano system, follow these steps:
- Configure the Tool in
__init__.py: Add your tool configuration tochat_piano/tools/__init__.pyto register it in the system.- Create the Tool's Python File: Place your Python file in the
chat_piano/toolsfolder. This file should define the tool's functionality and follow these guidelines:
- Always return a string to ensure the AI agent receives feedback from the tool.
- Use a non-blocking thread for any long-running algorithms to avoid stalling the main process.
- Implement Status and Results Handling:
- Provide a method for checking the tool's status.
- Include a method for retrieving results after the tool completes its task.
- Refer to an Example: For guidance, refer to
chat_piano/tools/generateMidiTool.py, which includes a clear implementation of these principles.- Test the Tool: Ensure the new tool integrates seamlessly with the server and behaves as expected during interaction.
For further details, contact the project author or refer to the contribution guidelines.
This project is licensed under the Apache License 2.0 - see the LICENSE file for more details.
- Music X Lab: Developed under the guidance and support of Music X Lab.
- Contributors: Thanks to contributors from the Music X Lab GitHub organization for their invaluable support.
- Community: Gratitude to all developers, musicians, and community members who have enhanced this project.
- Open-Source Tools: Special thanks to the developers and communities supporting the open-source tools and libraries utilized in this project.