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

Async patterns

Async patterns — concurrency, gather, semaphore-bounded parallelism.

Concurrent evaluations

import asyncio
from layerlens import AsyncStratix

async def run_one(client, model_key, benchmark_key):
 model = await client.models.get_by_key(model_key)
 bm = await client.benchmarks.get_by_key(benchmark_key)
 e = await client.evaluations.create(model=model, benchmark=bm)
 return await client.evaluations.wait_for_completion(e)

async def main():
 client = AsyncStratix()
 results = await asyncio.gather(*[run_one(client, m, "mmlu") for m in ["openai/gpt-4o", "anthropic/claude-opus-4-7"]])
 for r in results: print(r.accuracy)

asyncio.run(main())

Semaphore-bounded

When running many concurrent jobs, bound concurrency:

See also

Last updated

Was this helpful?