Using LiteLLM with curator
Prerequisites
Steps
1. Create a curator.LLM Subclass
"""Generate synthetic recipes for different cuisines using curator."""
from datasets import Dataset
from bespokelabs import curator
class RecipeGenerator(curator.LLM):
"""A recipe generator that generates recipes for different cuisines."""
def prompt(self, input: dict) -> str:
"""Generate a prompt using the template and cuisine."""
return f"Generate a random {input['cuisine']} recipe. Be creative but keep it realistic."
def parse(self, input: dict, response: str) -> dict:
"""Parse the model response along with the input to the model into the desired output format.."""
return {
"recipe": response,
"cuisine": input["cuisine"],
}2. Set Up Your Seed Dataset
3. Configure LiteLLM Backend
4. Generate Data
LiteLLM Configuration
API Keys and Environment Variables
Curator Configuration
Rate Limits
Providers and Models
Together
DeepInfra
Last updated