Record a generation
- TypeScript
- Python
What to record
| Field | Why it matters |
|---|---|
model | Groups and compares behavior and cost by model |
usageDetails (input/output tokens) | Powers token and cost analysis |
input | The prompt or messages sent to the model |
output | The completion returned by the model |
If you instrument LLM calls with a supported framework (Vercel AI SDK, OpenAI Agents, LangChain, …), generation spans — including model and tokens — are produced automatically. Use manual generations when you call a model directly or your framework does not emit them.
Errors
Mark a failed model call so it surfaces in Lemma:- TypeScript
- Python
Next steps
Tool calls
Record tool arguments and results.
Spans
Trace retrieval, ranking, and app logic.