Skip to content

Allow empty Content and Role#26

Open
rhettg wants to merge 1 commit intorakyll:mainfrom
rhettg:rhettg-empty-content
Open

Allow empty Content and Role#26
rhettg wants to merge 1 commit intorakyll:mainfrom
rhettg:rhettg-empty-content

Conversation

@rhettg
Copy link

@rhettg rhettg commented Aug 21, 2023

These fields are required. Content is allowed to be empty. This behavior can be observed by trying to include a FunctionCall Message (see also #25) which has no Content. The API will reject it.

The OpenAPI specification for this type
(https://github.com/openai/openai-openapi/blob/e6277eabbbb5df1e90620e3657bb02da28dce460/openapi.yaml#L2195-L2197) shows the following:

    ChatCompletionRequestMessage:
      properties:
        ...

        content:
          type: string
          nullable: true
          description: The contents of the message. `content` is required for all messages, and may be null for assistant messages with function calls.

      ...
      required:
        - role
        - content

I've confirmed experimentally it accepts empty strings as well.

These fields are required. Content is allowed to be empty. This behavior
can be observed by trying to include a FunctionCall Message (see also rakyll#25)
which has no Content. The API will reject it.

The OpenAPI specification for this type
(https://github.com/openai/openai-openapi/blob/e6277eabbbb5df1e90620e3657bb02da28dce460/openapi.yaml#L2195-L2197)
shows the following:

```yaml
    ChatCompletionRequestMessage:
      properties:
        ...

        content:
          type: string
          nullable: true
          description: The contents of the message. `content` is required for all messages, and may be null for assistant messages with function calls.

      ...
      required:
        - role
        - content
```

I've confirmed experimentally it accepts empty strings as well.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant