The Martian Python SDK provides a simple interface to manage judges and routers for LLM evaluation and routing. This SDK allows you to create, update, and manage judges for evaluating LLM responses, as well as routers for directing traffic between different models.
- Python 3.9 or higher
- Git
- uv - Fast Python package installer and resolver
We recommend setting up your project with the following structure:
martian-hackathon/ # Root directory for all hackathon work
├── .env # Environment variables
├── .venv/ # Virtual environment (will be created by uv, below)
├── martian-sdk-python/ # Cloned SDK repository
└── project/ # Your hackathon project directory
-
Create and enter the hackathon root directory:
mkdir martian-hackathon cd martian-hackathon -
Clone the SDK repository:
git clone https://github.com/withmartian/martian-sdk-python.git
-
Create and activate a virtual environment in the hackathon root directory:
uv venv source .venv/bin/activate # On Unix/macOS # or .venv\Scripts\activate # On Windows
-
Install the SDK in editable mode along with Jupyter:
uv pip install -e martian-sdk-python uv pip install jupyter
-
Create your project directory:
mkdir project
-
Create a
.envfile in the hackathon root directory with your Martian credentials:cat > .env << EOL MARTIAN_API_URL=https://withmartian.com/api MARTIAN_API_KEY=your-api-key EOL
(See
martian-sdk-python/.env.template)
The SDK includes a Jupyter notebook that demonstrates key features and usage patterns:
-
From your hackathon parent directory, start Jupyter:
jupyter notebook
-
In Jupyter, navigate to
../martian-sdk-python/quickstart_guide.ipynb
The quickstart guide will walk you through:
- Setting up the Martian client
- Using the gateway to access various LLM models
- Creating and using judges
- Working with routers
- Training and evaluating models
For more details, check out the Martian Python SDK Documentation