Remix.run Logo
fumeux_fume 5 days ago

Very common struggle, but a great way to prevent that is prefilling the assistant response with "{" or as much JSON output as you're going to know ahead of time like '{"response": ['

XenophileJKO 5 days ago | parent | next [-]

Just to be clear for anyone reading this, the optimal way to do this is schema enforced inference. You can only get a parsable response. There are failure modes, but you don't have to mess with parsing at all.

psadri 5 days ago | parent | prev [-]

Haven’t tried this. Does it mix well with tool calls? Or does it force a response where you might have expected a tool call?

fumeux_fume 5 days ago | parent [-]

It'll force a response that begins with an open bracket. So if you might need a response with a tool call that doesn't start with "{", then it might not fit your workflow.