I understand that when using curly braces, the ai agents expect some kind of value such as {tools} inline with LangChain, however, I need to give the AI json data which includes the curly braces, in which case it fails, what is the solution?
For exmaple, if I say:
Here’s an example of JSON structure:
{
“name”: “John Doe”,
“age”: 30
}
It will fail, or if I give it a ton of json to analyse, it will fail, even if it’s stringified.
This isn’t what I’m mean, I don’t think, lets say I want to give an AI Agent an and example json structure, it won’t allow { } as it thinks this is a placeholder for something, and if I use {{ }}, it think I’m going to write an expression.
So I have no way to give it a json exmaple.
The only workaround I’ve found is to use the memory manager to insert the system message as it won’t work in the AI Agent node when adding a system message.
Not knowing what your exact use case is, but perhaps you could use two agents (either chained or use the sub-workflow tool) to have the other agent do the structuring with the Output Parser Node ?
The issues I’m having is the structured output parser is failing, to I want to give it my own prompt which i know work, but I need to specify the json I want with an example in the system message, but it wont let me.
I also want to provide dynamic json data in the system message, but again, it won’t allow it.
I’d also suggest a tools agent, which has much better support for output parsing. But as Ria said, if you want to use JSON in system messages for a Conversational agent, you’d need to escape curly brackets so something like: