Error 400 'messages' must contain the word 'json' in some form, to use 'response_format' of type 'json_object'.
🐛 Describe the bug
I got this error :
BadRequestError: 400 'messages' must contain the word 'json' in some form, to use 'response_format' of type 'json_object'.
When i tried to set my own customPrompt.
using typescript.
mem0ai:2.1.38
Hi @rezadev8 can you describe the problem in details or can you share me how to reproduce this error in details
Hey @rezadev8 really sorry for the trouble caused. Can you share code snippet to help you better? Thanks.
Hi @ron-42 & @parshvadaftari This is my code in TS :
const memory = new Memory({
llm: {
provider: 'openai',
config: {
apiKey: process.env.OPENAI_API_KEY,
model: 'gpt-5-nano',
},
},
embedder: {
provider: 'ollama',
config: {
apiKey: 'ollama',
model: 'my_model',
url: 'http://localhost:11434',
},
},
vectorStore: {
provider: 'memory',
config: {
collectionName: 'memories',
dimension: 768,
},
},
historyStore: {
provider: 'supabase',
config: {
supabaseUrl: 'my_url',
supabaseKey:'my_key',
tableName: 'memory_history',
},
}
});
This config is works for me . but when I tryed to set customPrompt: 'my prompt' , I got the error I mentioned in the message above.
Hey @rezadev8 thank you for the response, will be fixing it with new release. Meanwhile you can try adding "json" or "return in json" keyword in the customPrompt which will fix this issue you're facing.
@parshvadaftari , Is this issue still open, or has it been resolved?
@parshvadaftari, I think based on @vedant381 commit, this issue should be fixed. Please check and verify.