Client Initialization
Configure the Catsu Client with custom settings
The Client class accepts configuration parameters to customize behavior.
Constructor Parameters
from catsu import Client
client = Client(
max_retries=3, # Maximum retry attempts (default: 3)
timeout=30, # Request timeout in seconds (default: 30)
)Parameters
max_retries (int, default: 3)
Maximum number of retry attempts for failed requests:
client = Client(max_retries=5)
# Retries are automatic for:
# - Rate limit errors (with exponential backoff)
# - Network timeouts
# - Temporary server errors (5xx)timeout (int, default: 30)
Request timeout in seconds:
client = Client(timeout=60) # 60 second timeoutAPI Key Configuration
Catsu reads API keys from environment variables automatically:
export OPENAI_API_KEY="your-openai-key"
export VOYAGE_API_KEY="your-voyage-key"
export COHERE_API_KEY="your-cohere-key"See Installation for the complete list of environment variables.
Complete Example
from catsu import Client
# Production configuration
client = Client(
max_retries=5, # More retries for reliability
timeout=60, # Longer timeout for large batches
)
response = client.embed(
"openai:text-embedding-3-small",
["Production embedding request"]
)Next Steps
- embed() Method - Generate embeddings synchronously
- aembed() Method - Generate embeddings asynchronously
- Error Handling - Handle exceptions and retries