---
title: "FineTunePreferenceRequestInput"
url: "https://kongair.terwilligar.com/apis/openai-api-2-3-0/versions/ea92d048-c746-4ead-a6a8-da28d93137d1/schemas/FineTunePreferenceRequestInput"
---

> Full API specification: https://kongair.terwilligar.com/apis/openai-api-2-3-0/versions/ea92d048-c746-4ead-a6a8-da28d93137d1.md

# FineTunePreferenceRequestInput

The per-line training example of a fine-tuning input file for chat models using the dpo method.

## OpenAPI definition

```yaml
openapi: 3.0.0
info:
  title: OpenAI API
  version: 2.3.0
servers:
  - url: https://api.openai.com/v1
components:
  schemas:
    ChatCompletionRequestSystemMessage:
      type: object
      title: System message
      description: >
        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.
      properties:
        content:
          description: The contents of the system message.
          oneOf:
            - type: string
              description: The contents of the system message.
              title: Text content
            - type: array
              description: An array of content parts with a defined type. For system messages,
                only type `text` is supported.
              title: Array of content parts
              items:
                $ref: "#/components/schemas/ChatCompletionRequestSystemMessageContentPart"
              minItems: 1
        role:
          type: string
          enum:
            - system
          description: The role of the messages author, in this case `system`.
          x-stainless-const: true
        name:
          type: string
          description: An optional name for the participant. Provides the model
            information to differentiate between participants of the same role.
      required:
        - content
        - role
    ChatCompletionRequestUserMessage:
      type: object
      title: User message
      description: |
        Messages sent by an end user, containing prompts or additional context
        information.
      properties:
        content:
          description: |
            The contents of the user message.
          oneOf:
            - type: string
              description: The text contents of the message.
              title: Text content
            - type: array
              description: An array of content parts with a defined type. Supported options
                differ based on the [model](/docs/models) being used to generate
                the response. Can contain text, image, or audio inputs.
              title: Array of content parts
              items:
                $ref: "#/components/schemas/ChatCompletionRequestUserMessageContentPart"
              minItems: 1
          x-oaiExpandable: true
        role:
          type: string
          enum:
            - user
          description: The role of the messages author, in this case `user`.
          x-stainless-const: true
        name:
          type: string
          description: An optional name for the participant. Provides the model
            information to differentiate between participants of the same role.
      required:
        - content
        - role
    FineTuneChatCompletionRequestAssistantMessage:
      allOf:
        - type: object
          title: Assistant message
          deprecated: false
          properties:
            weight:
              type: integer
              enum:
                - 0
                - 1
              description: Controls whether the assistant message is trained against (0 or 1)
        - $ref: "#/components/schemas/ChatCompletionRequestAssistantMessage"
      required:
        - role
    ChatCompletionRequestToolMessage:
      type: object
      title: Tool message
      properties:
        role:
          type: string
          enum:
            - tool
          description: The role of the messages author, in this case `tool`.
          x-stainless-const: true
        content:
          oneOf:
            - type: string
              description: The contents of the tool message.
              title: Text content
            - type: array
              description: An array of content parts with a defined type. For tool messages,
                only type `text` is supported.
              title: Array of content parts
              items:
                $ref: "#/components/schemas/ChatCompletionRequestToolMessageContentPart"
              minItems: 1
          description: The contents of the tool message.
        tool_call_id:
          type: string
          description: Tool call that this message is responding to.
      required:
        - role
        - content
        - tool_call_id
    ChatCompletionRequestFunctionMessage:
      type: object
      title: Function message
      deprecated: true
      properties:
        role:
          type: string
          enum:
            - function
          description: The role of the messages author, in this case `function`.
          x-stainless-const: true
        content:
          nullable: true
          type: string
          description: The contents of the function message.
        name:
          type: string
          description: The name of the function to call.
      required:
        - role
        - content
        - name
    ChatCompletionTool:
      type: object
      properties:
        type:
          type: string
          enum:
            - function
          description: The type of the tool. Currently, only `function` is supported.
          x-stainless-const: true
        function:
          $ref: "#/components/schemas/FunctionObject"
      required:
        - type
        - function
    ParallelToolCalls:
      description: Whether to enable [parallel function
        calling](/docs/guides/function-calling#configuring-parallel-function-calling)
        during tool use.
      type: boolean
      default: true
    ChatCompletionRequestAssistantMessage:
      type: object
      title: Assistant message
      description: |
        Messages sent by the model in response to user messages.
      properties:
        content:
          x-oaiExpandable: true
          nullable: true
          oneOf:
            - type: string
              description: The contents of the assistant message.
              title: Text content
            - type: array
              description: An array of content parts with a defined type. Can be one or more
                of type `text`, or exactly one of type `refusal`.
              title: Array of content parts
              items:
                $ref: "#/components/schemas/ChatCompletionRequestAssistantMessageContentPart"
              minItems: 1
          description: >
            The contents of the assistant message. Required unless `tool_calls`
            or `function_call` is specified.
        refusal:
          nullable: true
          type: string
          description: The refusal message by the assistant.
        role:
          type: string
          enum:
            - assistant
          description: The role of the messages author, in this case `assistant`.
          x-stainless-const: true
        name:
          type: string
          description: An optional name for the participant. Provides the model
            information to differentiate between participants of the same role.
        audio:
          type: object
          nullable: true
          x-oaiExpandable: true
          description: |
            Data about a previous audio response from the model. 
            [Learn more](/docs/guides/audio).
          required:
            - id
          properties:
            id:
              type: string
              description: |
                Unique identifier for a previous audio response from the model.
        tool_calls:
          $ref: "#/components/schemas/ChatCompletionMessageToolCalls"
        function_call:
          type: object
          deprecated: true
          description: Deprecated and replaced by `tool_calls`. The name and arguments of
            a function that should be called, as generated by the model.
          nullable: true
          properties:
            arguments:
              type: string
              description: The arguments to call the function with, as generated by the model
                in JSON format. Note that the model does not always generate
                valid JSON, and may hallucinate parameters not defined by your
                function schema. Validate the arguments in your code before
                calling your function.
            name:
              type: string
              description: The name of the function to call.
          required:
            - arguments
            - name
      required:
        - role
    ChatCompletionRequestSystemMessageContentPart:
      oneOf:
        - $ref: "#/components/schemas/ChatCompletionRequestMessageContentPartText"
      x-oaiExpandable: true
    ChatCompletionRequestUserMessageContentPart:
      oneOf:
        - $ref: "#/components/schemas/ChatCompletionRequestMessageContentPartText"
        - $ref: "#/components/schemas/ChatCompletionRequestMessageContentPartImage"
        - $ref: "#/components/schemas/ChatCompletionRequestMessageContentPartAudio"
      x-oaiExpandable: true
    ChatCompletionRequestToolMessageContentPart:
      oneOf:
        - $ref: "#/components/schemas/ChatCompletionRequestMessageContentPartText"
      x-oaiExpandable: true
    FunctionObject:
      type: object
      properties:
        description:
          type: string
          description: A description of what the function does, used by the model to
            choose when and how to call the function.
        name:
          type: string
          description: The name of the function to be called. Must be a-z, A-Z, 0-9, or
            contain underscores and dashes, with a maximum length of 64.
        parameters:
          $ref: "#/components/schemas/FunctionParameters"
        strict:
          type: boolean
          nullable: true
          default: false
          description: Whether to enable strict schema adherence when generating the
            function call. If set to true, the model will follow the exact
            schema defined in the `parameters` field. Only a subset of JSON
            Schema is supported when `strict` is `true`. Learn more about
            Structured Outputs in the [function calling
            guide](docs/guides/function-calling).
      required:
        - name
    ChatCompletionRequestAssistantMessageContentPart:
      oneOf:
        - $ref: "#/components/schemas/ChatCompletionRequestMessageContentPartText"
        - $ref: "#/components/schemas/ChatCompletionRequestMessageContentPartRefusal"
      x-oaiExpandable: true
    ChatCompletionMessageToolCalls:
      type: array
      description: The tool calls generated by the model, such as function calls.
      items:
        $ref: "#/components/schemas/ChatCompletionMessageToolCall"
    ChatCompletionRequestMessageContentPartText:
      type: object
      title: Text content part
      description: |
        Learn about [text inputs](/docs/guides/text-generation).
      properties:
        type:
          type: string
          enum:
            - text
          description: The type of the content part.
          x-stainless-const: true
        text:
          type: string
          description: The text content.
      required:
        - type
        - text
    ChatCompletionRequestMessageContentPartImage:
      type: object
      title: Image content part
      description: |
        Learn about [image inputs](/docs/guides/vision).
      properties:
        type:
          type: string
          enum:
            - image_url
          description: The type of the content part.
          x-stainless-const: true
        image_url:
          type: object
          properties:
            url:
              type: string
              description: Either a URL of the image or the base64 encoded image data.
              format: uri
            detail:
              type: string
              description: Specifies the detail level of the image. Learn more in the [Vision
                guide](/docs/guides/vision#low-or-high-fidelity-image-understanding).
              enum:
                - auto
                - low
                - high
              default: auto
          required:
            - url
      required:
        - type
        - image_url
    ChatCompletionRequestMessageContentPartAudio:
      type: object
      title: Audio content part
      description: |
        Learn about [audio inputs](/docs/guides/audio).
      properties:
        type:
          type: string
          enum:
            - input_audio
          description: The type of the content part. Always `input_audio`.
          x-stainless-const: true
        input_audio:
          type: object
          properties:
            data:
              type: string
              description: Base64 encoded audio data.
            format:
              type: string
              enum:
                - wav
                - mp3
              description: >
                The format of the encoded audio data. Currently supports "wav"
                and "mp3".
          required:
            - data
            - format
      required:
        - type
        - input_audio
    FunctionParameters:
      type: object
      description: >-
        The parameters the functions accepts, described as a JSON Schema object.
        See the [guide](/docs/guides/function-calling) for examples, and the
        [JSON Schema
        reference](https://json-schema.org/understanding-json-schema/) for
        documentation about the format. 


        Omitting `parameters` defines a function with an empty parameter list.
      additionalProperties: true
    ChatCompletionRequestMessageContentPartRefusal:
      type: object
      title: Refusal content part
      properties:
        type:
          type: string
          enum:
            - refusal
          description: The type of the content part.
          x-stainless-const: true
        refusal:
          type: string
          description: The refusal message generated by the model.
      required:
        - type
        - refusal
    ChatCompletionMessageToolCall:
      type: object
      properties:
        id:
          type: string
          description: The ID of the tool call.
        type:
          type: string
          enum:
            - function
          description: The type of the tool. Currently, only `function` is supported.
          x-stainless-const: true
        function:
          type: object
          description: The function that the model called.
          properties:
            name:
              type: string
              description: The name of the function to call.
            arguments:
              type: string
              description: The arguments to call the function with, as generated by the model
                in JSON format. Note that the model does not always generate
                valid JSON, and may hallucinate parameters not defined by your
                function schema. Validate the arguments in your code before
                calling your function.
          required:
            - name
            - arguments
      required:
        - id
        - type
        - function
    FineTunePreferenceRequestInput:
      type: object
      description: The per-line training example of a fine-tuning input file for chat
        models using the dpo method.
      properties:
        input:
          type: object
          properties:
            messages:
              type: array
              minItems: 1
              items:
                oneOf:
                  - $ref: "#/components/schemas/ChatCompletionRequestSystemMessage"
                  - $ref: "#/components/schemas/ChatCompletionRequestUserMessage"
                  - $ref: "#/components/schemas/FineTuneChatCompletionRequestAssistantMessage"
                  - $ref: "#/components/schemas/ChatCompletionRequestToolMessage"
                  - $ref: "#/components/schemas/ChatCompletionRequestFunctionMessage"
                x-oaiExpandable: true
            tools:
              type: array
              description: A list of tools the model may generate JSON inputs for.
              items:
                $ref: "#/components/schemas/ChatCompletionTool"
            parallel_tool_calls:
              $ref: "#/components/schemas/ParallelToolCalls"
        preferred_completion:
          type: array
          description: The preferred completion message for the output.
          maxItems: 1
          items:
            oneOf:
              - $ref: "#/components/schemas/ChatCompletionRequestAssistantMessage"
            x-oaiExpandable: true
        non_preferred_completion:
          type: array
          description: The non-preferred completion message for the output.
          maxItems: 1
          items:
            oneOf:
              - $ref: "#/components/schemas/ChatCompletionRequestAssistantMessage"
            x-oaiExpandable: true
      x-oaiMeta:
        name: Training format for chat models using the preference method
        example: >
          {
            "input": {
              "messages": [
                { "role": "user", "content": "What is the weather in San Francisco?" }
              ]
            },
            "preferred_completion": [
              {
                "role": "assistant",
                "content": "The weather in San Francisco is 70 degrees Fahrenheit."
              }
            ],
            "non_preferred_completion": [
              {
                "role": "assistant",
                "content": "The weather in San Francisco is 21 degrees Celsius."
              }
            ]
          }
```
