Skip to content

API responds 422 when input contains string[] #265

Closed
@KeThang-V

Description

@KeThang-V

Hi,

When I send an array of string in a parameter of the input of a new prediction I'm getting a code 422 (Unprocessable Entity) from the API. The error is input.style_images: Invalid type. Expected: array, given: string.

So I tried to find out why and found this by adding a console.log directly to the request in the replicate lib:
My original input sent to replicate.predictions.create:

{
  "input": {
    "style_images": ["string1", "string2"]
  },
  ...
}

The API request body sent from the lib is transformed like this:

{
  "body": {
    "source": '{"input":{"style_images":"string2"},...}',
    ...
  }
}

I also tried to make the same request with curl or replicate-python and it works.

Thank you

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions