LocalAI icon indicating copy to clipboard operation
LocalAI copied to clipboard

image generation endpoint `response_format` does not match OpenAI spec

Open cheahjs opened this issue 1 year ago • 2 comments

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

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

cheahjs avatar May 12 '24 09:05 cheahjs

I can confirm this, it is currently not supported but looking for implementation

mudler avatar May 13 '24 10:05 mudler

Implementation https://github.com/mudler/LocalAI/pull/2347

prajwalnayak7 avatar May 19 '24 13:05 prajwalnayak7

fixed now in master, thanks @prajwalnayak7 !

mudler avatar May 29 '24 22:05 mudler