huggingface / chat-ui

Open source codebase powering the HuggingChat app
https://huggingface.co/chat
Apache License 2.0
7.31k stars 1.06k forks source link

could you provide an easy way to force output as json? #1456

Open fancy45daddy opened 2 weeks ago

fancy45daddy commented 2 weeks ago

current I use

preprompt:'only output json. Do not output anything that is not json. Do not use markdown format. Must begin with {.'

But llama is not smart enough to output json form. It always begin with Here is the JSON answer or begin with ```(markdown format) for give me unvalid json string.

It seems preprompt is not enough to force json format. Could you provide an easy way to output just json. Or maybe the method is in tools.