For the complete documentation index, see llms.txt. This page is also available as Markdown.

Rate Limiting

Rate limiting — recognize 429 responses, handle RateLimitError, inspect retry headers.

This guide covers how to handle rate limiting when using the Stratix Python SDK, including best practices for avoiding rate limits and properly handling rate limit errors.

Identifying Rate Limit Errors

Rate Limit HTTP Response

When you exceed rate limits, the API returns a 429 Too Many Requests status:

import layerlens
from layerlens import Stratix

try:
 client = Stratix()

 # Making too many requests quickly
 for i in range(100):
 evaluation = client.evaluations.create(
 model="gpt-4",
 benchmark="mmlu"
 )

except layerlens.RateLimitError as e:
 print(f"Rate limited: {e}")
 print(f"Status code: {e.status_code}") # 429
 print(f"Response headers: {dict(e.response.headers)}")

See Also

Last updated

Was this helpful?