client.recordings namespace.
Methods Overview
Record an LLM Interaction
Log your LLM interaction with Freeplay. This is assuming your have already retrieved a formatted prompt and made an LLM call as demonstrated in the Prompts SectionUsing OpenAI or Anthropic’s Batch APIs
Some LLM providers offer a batch method of generating completions. If you are using the Batch API, you can log your results to Freeplay withapi_style="batch". This parameter is needed to calculate accurate costs for batch API usage, which are often significantly lower than regular completions. The general flow for logging batch data looks like:
- Create batch file with Freeplay completion tracking For each input, format your prompt using Freeplay’s template, then create a completion record with
api_style='batch'in the CallInfo. Store the returnedcompletion_idto update the completion in Freeplay once the batch request has completed. - Submit batch to OpenAI and poll for completion Upload your batch file to OpenAI, create the batch request, and poll until the batch status is “completed”.
- Update Freeplay with results Once complete, read the batch output file and update each Freeplay completion using the
completion_idfrom the response to match it back to the original request.
Recording Tools
You can record tool calls and their associated schemas for both OpenAI and Anthropic. These recorded completions and tool schemas can be viewed in the observability tab.When using function calling or tool use, pass the
tool_schema parameter in your RecordPayload.
This should be a list of tool/function definitions that were available to the model. The schema can be retrieved from
formatted_prompt.tool_schema if defined in your prompt template, or you can pass your own tool definitions in the same
format you use to pass them to the model.formatted_prompt.all_messages(), the LLM’s tool call output and subsequent tool results are concatenated into the message history alongside other messages.
Updating a Completion
Freeplay allows you to update a completion once it has already been recorded. This can be useful to add client evals or additional messages to the completion. To do this, you will need to have theproject_id and completion_id. The completion_id is returned via recordings.create. The code example below shows this in action:

