Skip to content

image generation endpoint response_format does not match OpenAI spec #2299

Closed
@cheahjs

Description

@cheahjs

LocalAI version:
LocalAI version: v2.15.0 (f69de3b)

Environment, CPU architecture, OS, and Version:

root@23ec4a478b09:/build# uname -a
Linux 23ec4a478b09 6.6.22-linuxkit #1 SMP Fri Mar 29 12:21:27 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

Describe the bug
LocalAI does not accept a string for response_format when calling image generation. As per OpenAI's spec, this is a string that is either url or b64_json.

To Reproduce

$ curl http://localhost:8080/v1/images/generations  -H "Content-Type: application/json"  -d '{ "prompt": "|", "step": 25, "size": "512x512", "response_format": "b64_json" }'
{"error":{"code":500,"message":"failed reading parameters from request:failed parsing request body: json: cannot unmarshal string into Go struct field OpenAIRequest.response_format of type schema.ChatCompletionResponseFormat","type":""}}

Expected behavior
LocalAI accepts response_format as a string per OpenAI specs.

Logs

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmedenhancementNew feature or requestup for grabsTickets that no-one is currently working on

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions