> ## Documentation Index
> Fetch the complete documentation index at: https://docs.freeplay.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Data Models

> Reference documentation for Freeplay SDK data models and payload structures.

Below are details of the Freeplay data model, which can be helpful to understand for more advanced usage. **Note the parameter names are written in snake case but some SDK languages make use of camel case instead**

## Record Payload

<CodeGroup>
  ```python python theme={null}
  from freeplay import RecordPayload
  ```

  ```typescript typescript theme={null}
  import { RecordPayload } from "freeplay";
  ```

  ```java java theme={null}
  import ai.freeplay.client.thin.resources.recordings.RecordPayload
  ```
</CodeGroup>

| Parameter Name        | Data Type              | Description                                                                      | Required |
| --------------------- | ---------------------- | -------------------------------------------------------------------------------- | -------- |
| project\_id           | str                    | Freeplay's projectId                                                             | Y        |
| all\_messages         | List\[dict\[str, str]] | All messages in the conversation so far                                          | Y        |
| inputs                | dict                   | The input variables                                                              | N        |
| session\_info         | SessionInfo            | The session id for which the recording should be associated                      | N        |
| prompt\_version\_info | PromptVersionInfo      | The prompt info from a formatted prompt, used for version tracking               | N        |
| call\_info            | CallInfo               | Information associated with the LLM call                                         | N        |
| trace\_info           | TraceInfo              | The trace to associate this completion with (for agent workflows)                | N        |
| tool\_schema          | List\[dict\[str, any]] | The tools/functions available to the model (for function calling/tool use)       | N        |
| test\_run\_info       | TestRunInfo            | Information associated with the Test Run if this recording is part of a Test Run | N        |

## Record Response

The `recordings.create()` method returns a `RecordResponse` containing:

| Parameter Name | Data Type | Description                                                                                       |
| -------------- | --------- | ------------------------------------------------------------------------------------------------- |
| completion\_id | str       | The unique ID of the recorded completion. Use this as `parent_id` when creating child tool spans. |

## Call Info

<CodeGroup>
  ```python python theme={null}
  from freeplay import CallInfo
  ```

  ```typescript typescript theme={null}
  import { getCallInfo } from "freeplay";
  ```

  ```java java theme={null}
  import ai.freeplay.client.thin.resources.recordings.CallInfo;
  ```
</CodeGroup>

| Parameter Name    | Data Type            | Description                                                                                                                               | Required |
| ----------------- | -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | -------- |
| provider          | string               | The name of your LLM provider (e.g., "openai", "anthropic", "mistral")                                                                    | N        |
| model             | string               | The name of your model (e.g., "gpt-4o-mini", "claude-3-5-sonnet")                                                                         | N        |
| start\_time       | float                | The start time of the LLM call as Unix timestamp. This will be used to measure latency                                                    | N        |
| end\_time         | float                | The end time of the LLM call as Unix timestamp. This will be used to measure latency                                                      | N        |
| model\_parameters | LLMParameters        | The parameters associated with your LLM call (e.g., temperature, max\_tokens)                                                             | N        |
| usage             | UsageTokens          | Token count to record to Freeplay for cost calculation. If not included, Freeplay will estimate token counts using Tiktoken.              | N        |
| provider\_info    | Dict\[str, Any]      | Additional provider-specific informatio, e.g. azure\_deployment.                                                                          | N        |
| api\_style        | "batch" or "default" | Set to "batch" if using a batch API (e.g., OpenAI Batch API) for accurate cost calculation. Use "default" or omit for standard API calls. | N        |

## LLM Parameters

<CodeGroup>
  ```python python theme={null}
  from freeplay.llm_parameters import LLMParameters
  ```

  ```typescript typescript theme={null}
  import { LLMParameters } from "freeplay";
  ```

  ```java java theme={null}
  import ai.freeplay.client.thin.resources.recordings.LLMParameters
  ```
</CodeGroup>

| Parameter Name | Data Type       | Description                                                         | Required |
| -------------- | --------------- | ------------------------------------------------------------------- | -------- |
| members        | Dict\[str, any] | Any parameters associated with your LLM call that you want recorded | Y        |

## Trace Info

TraceInfo is returned by `session.create_trace()` and used to group completions together and track agent workflows. See [Traces](/freeplay-sdk/traces) for usage examples.

| Parameter Name   | Data Type                      | Description                                                   | Required |
| ---------------- | ------------------------------ | ------------------------------------------------------------- | -------- |
| trace\_id        | string                         | The unique ID of the trace                                    | Auto     |
| session\_id      | string                         | The session this trace belongs to                             | Auto     |
| input            | str \| dict \| list            | The input to the trace (user message or tool arguments)       | N        |
| agent\_name      | string                         | Name of the agent for this trace                              | N        |
| parent\_id       | UUID                           | Parent trace or completion ID for creating nested hierarchies | N        |
| kind             | `'tool'` \| `'agent'`          | Type of trace—use `'tool'` for tool execution spans           | N        |
| name             | string                         | Name of the trace or tool                                     | N        |
| custom\_metadata | dict\[str, str \| int \| bool] | Custom metadata to associate with the trace                   | N        |

## Test Run Info

<CodeGroup>
  ```python python theme={null}
  from freeplay import TestRunInfo
  ```

  ```typescript typescript theme={null}
  import { getTestRunInfo } from "freeplay";
  ```

  ```java java theme={null}
  import ai.freeplay.client.thin.resources.testruns.TestRun;

  testRun.getTestRunInfo()
  ```
</CodeGroup>

| Parameter Name | Data Type | Description              | Required |
| -------------- | --------- | ------------------------ | -------- |
| test\_run\_id  | string    | The id of your Test Run  | Y        |
| test\_case\_id | string    | The id of your Test Case | Y        |

## OpenAI Function Call

<CodeGroup>
  ```python python theme={null}
  from freeplay.completions import OpenAIFunctionCall
  ```

  ```typescript typescript theme={null}
  import { OpenAIFunctionCall } from "freeplay";
  ```

  ```java java theme={null}
  import ai.freeplay.client.thin.resources.recordings.OpenAIFunctionCall
  ```
</CodeGroup>

| Parameter Name | Data Type | Description                                 | Required |
| -------------- | --------- | ------------------------------------------- | -------- |
| name           | string    | The name of the invoked function call       | Y        |
| arguments      | string    | The arguments for the invoked function call | Y        |
