LocalAI icon indicating copy to clipboard operation
LocalAI copied to clipboard

HTML responses do not work when using the API

Open johndev168 opened this issue 4 months ago • 0 comments

LocalAI version: 3.5.0

Environment, CPU architecture, OS, and Version: Mac T8132 MacOS 15.5 24F74 no VM

Describe the bug When asking localai to answer in formatted html it does not work when using the api. In the "chat" tab it does work. You can straight up ask or even provide the instruction in system prompts and the ai will generate proper html as a response. But when using the api, it disregards the instruction and sends plain text every time.

To Reproduce Just send an api request with telling the ai that it should answer in html. No matter the instruction you will always receive plain text. If you use the chat feature from agents in localagi, the agent will tell you that it cannot do the request to write in html.

Expected behavior It should just send back html-formatted response.

Logs The logs do not mention anything regarding the html instruction.

Additional context When using the chat tab in localai, it does work. When using the chat feature in localagi, it tells me that it cannot do html. Using the api just ignores the instruction every time. I can send the request formatted in html just fine, it reads the whole prompt and extracts the necessary information, answering the question I put in the html structure. It just refuses to answer in html. Used model: Gemma 3 12b-it

johndev168 avatar Sep 08 '25 09:09 johndev168