---
title: "Log"
method: POST
path: "/v1/preview/models/{model_id}/log"
tags: ["models"]
---

# Log

`POST /v1/preview/models/{model_id}/log`

Log trajectories and calculate metrics.

## Path parameters

- `model_id` string, required

## Request body

- LogRequest — Schema for logging trajectories.
  - `split` string, required
  - `trajectory_groups` TrajectoryGroup[], required
    - `trajectories` Trajectory[], required
      - `messages_and_choices` union[]
        - union
          - ChatCompletionDeveloperMessageParam — Developer-provided instructions that the model should follow, regardless of messages sent by the user. With o1 models and newer, `developer` messages replace the previous `system` messages.
            - `content` union, required
              - …
            - `role` 'developer', required
            - `name` string
          - ChatCompletionSystemMessageParam — Developer-provided instructions that the model should follow, regardless of messages sent by the user. With o1 models and newer, use `developer` messages for this purpose instead.
            - `content` union, required
              - …
            - `role` 'system', required
            - `name` string
          - ChatCompletionUserMessageParam — Messages sent by an end user, containing prompts or additional context information.
            - `content` union, required
              - …
            - `role` 'user', required
            - `name` string
          - ChatCompletionAssistantMessageParam — Messages sent by the model in response to user messages.
            - `role` 'assistant', required
            - `audio` Audio — Data about a previous audio response from the model. [Learn more](https://platform.openai.com/docs/guides/audio).
              - …
            - `content` union
              - …
            - `function_call` OpenaiTypesChatChatCompletionAssistantMessageParamFunctionCall — Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model.
              - …
            - `name` string
            - `refusal` string, nullable
            - `tool_calls` union[]
              - …
          - ChatCompletionToolMessageParam
            - `content` union, required
              - …
            - `role` 'tool', required
            - `tool_call_id` string, required
          - ChatCompletionFunctionMessageParam
            - `content` string, nullable, required
            - `name` string, required
            - `role` 'function', required
          - Choice
            - `finish_reason` 'stop' | 'length' | 'tool_calls' | 'content_filter' | 'function_call', required
            - `index` integer, required
            - `logprobs` ChoiceLogprobs — Log probability information for the choice.
              - …
            - `message` ChatCompletionMessage, required — A chat completion message generated by the model.
              - …
      - `tools` ChatCompletionFunctionToolParam[], nullable
        - `function` FunctionDefinition, required
          - `name` string, required
          - `description` string
          - `parameters` object
          - `strict` boolean, nullable
        - `type` 'function', required
      - `additional_histories` History[]
        - `messages_and_choices` union[], required
          - union
            - ChatCompletionDeveloperMessageParam — Developer-provided instructions that the model should follow, regardless of messages sent by the user. With o1 models and newer, `developer` messages replace the previous `system` messages.
              - …
            - ChatCompletionSystemMessageParam — Developer-provided instructions that the model should follow, regardless of messages sent by the user. With o1 models and newer, use `developer` messages for this purpose instead.
              - …
            - ChatCompletionUserMessageParam — Messages sent by an end user, containing prompts or additional context information.
              - …
            - ChatCompletionAssistantMessageParam — Messages sent by the model in response to user messages.
              - …
            - ChatCompletionToolMessageParam
              - …
            - ChatCompletionFunctionMessageParam
              - …
            - Choice
              - …
        - `tools` ChatCompletionFunctionToolParam[], nullable
          - `function` FunctionDefinition, required
            - `name` string, required
            - `description` string
            - `parameters` object
            - `strict` boolean, nullable
          - `type` 'function', required
      - `reward` number
      - `initial_policy_version` integer, nullable
      - `final_policy_version` integer, nullable
      - `metrics` object
      - `metadata` object
      - `logs` string[]
      - `start_time` string, date-time

## Response `200`

Successful Response

- unknown

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/wandb/apis/serverless-training.md) · [All operations](https://skmtc.net/wandb/apis/serverless-training/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/wandb/serverless-training/revisions/8d8d96fc0fd3/schema)
