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

APIError message fields may be a array #381

Closed
imzhongqi opened this issue Jun 16, 2023 · 2 comments · Fixed by #384
Closed

APIError message fields may be a array #381

imzhongqi opened this issue Jun 16, 2023 · 2 comments · Fixed by #384

Comments

@imzhongqi
Copy link

{
  "error": {
    "message": [
      "Invalid schema for function 'xxx': In context=(), object schema missing properties"
    ],
    "type": "invalid_request_error",
    "param": null,
    "code": null
  }
}
@vvatanabe
Copy link
Collaborator

Basically, it is a string. However, if the json schema of the parameters field is invalid, as shown below, it is likely to be an array.

$ curl https://api.openai.com/v1/chat/completions -u :$OPENAI_API_KEY -H 'Content-Type: application/json' -d '{
  "model": "gpt-3.5-turbo-0613",
  "messages": [
    {"role": "user", "content": "What is the weather like in Boston?"}
  ],
  "functions": [
    {
      "name": "get_current_weather",
      "parameters": {
        "type": "object"
      }
    }
  ]
}'

{
  "error":{
     "message":[
        "Invalid schema for function 'get_current_weather': In context=(), object schema missing properties"
     ],
     "type":"invalid_request_error",
     "param":null,
     "code":null
  }
}

@vvatanabe
Copy link
Collaborator

FYI: I requested multiple functions with invalid parameters to try it out. There is only one error in the array.

$ curl https://api.openai.com/v1/chat/completions -u :$OPENAI_API_KEY -H 'Content-Type: application/json' -d '{
  "model": "gpt-3.5-turbo-0613",
  "messages": [
    {"role": "user", "content": "What is the weather like in Boston?"}
  ],
  "functions": [
    {
      "name": "get_current_weather",
      "parameters": {
        "type": "object"
      }
    },
    {
      "name": "get_current_weather2",
      "parameters": {
        "type": "object"
      }
    },
    {
      "name": "get_current_weather3",
      "parameters": {
        "type": "object"
      }
    }
  ]
}'

{
  "error": {
    "message": [
      "Invalid schema for function 'get_current_weather': In context=(), object schema missing properties"
    ],
    "type": "invalid_request_error",
    "param": null,
    "code": null
  }
}

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 a pull request may close this issue.

2 participants