This document provides instructions for setting up and running the LiteLLM test scripts.
- Python 3.7 or later
- pip (Python package manager)
-
Create a project directory
mkdir litellm-tests cd litellm-tests
-
Create a virtual environment (recommended)
python -m venv venv # Windows venv\Scripts\activate # macOS/Linux source venv/bin/activate
-
Install required packages
pip install litellm python-dotenv
-
Create a
.env
fileCreate a file named
.env
in your project directory and add your API keys, add keys and model providers as needed:OPENAI_API_KEY=your_openai_api_key ANTHROPIC_API_KEY=your_anthropic_api_key # GOOGLE_API_KEY=your_google_api_key
-
Create a directory for test files
mkdir docs
-
Add test files (optional)
- For long context tests: Add a long text file (e.g., a transcript) in the
docs
folder - For image tests: Add an image file (e.g., a JPEG) in the
docs
folder
- For long context tests: Add a long text file (e.g., a transcript) in the
Place each of the test scripts in your project directory and run them individually:
python basic-completion.py
python system-message-test.py
python long-context-test.py
python streaming-test.py
python tool-calling-test.py
python image-input-test.py
- To test different models, update the
models
list in each script - Adjust the parameters (e.g., temperature, max_tokens) according to your requirements
- For the long context test, update the file path in the script to your text file
- If you encounter API key errors, check that your
.env
file is correctly formatted and the keys are valid - For context length errors, try using a smaller text file or a model with a larger context window
- For image input errors, ensure your image file exists and is in a supported format (JPEG, PNG)
The scripts cover the main features mentioned in the transcript:
- Basic completion
- System messages
- Long context
- Streaming
- Tool calling
- Image input
If you want to test additional features:
- Modify parameters (temperature, top_p, etc.)
- Test with different prompts
- Try different model versions