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

fix: /chat body compatibility #178

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

Conversation

lollipopkit
Copy link
Contributor

As the OpenAI API ref, the body of /chat/completions can be:

{
  "model": "gpt-4o",
  "messages": [
    {
      "role": "system",
      "content": "You are a helpful assistant."
    },
    {
      "role": "user",
      "content": "Hello!"
    }
  ]
}

In this example, the messages[0].content is String, not {"type": text, "content": ""}.

Some third-party API forward provider (such as deepseek) use this example struct as the only correct struct, without supporting the struct now implemented in this package.

I have made a change as follow: If messages[INDEX].content only has one child of type text, then the content will set as a string.

Thanks for your review.
:)

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