This is how I am defining the executor
const executor = await initializeAgentExecutorWithOptions(tools, model, {
agentType: 'chat-conversational-react-description',
verbose: false,
});
Whenever I prompt the AI I have this statement at the end.
type SomeObject = {
field1: number,
field2: number,
}
- It is very critical that you answer only as the above object and JSON stringify it as a single string.
Don't include any other verbose explanatiouns and don't include the markdown syntax anywhere.
The SomeObject
is just an example. Usually it will have a proper object type.
When I use the executor
to get a response from the AI, half the time I get the proper JSON string, but the other half the times are the AI completely ignoring my instructions and gives me a long verbose answer in just plain English...
How can I make sure I always get the structured data answer I want?
Maybe using the agentType: 'chat-conversational-react-description'
isn't the right approach here?