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.
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
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
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.
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.
http://localhost:5000 (or the server's actual address) to access the interactive API documentation.We welcome contributions from the community. Here are some ways you can contribute:
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.