Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow empty Content and Role #26

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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