[BUG] Advanced Structured Output Parser Failing
Describe the bug
The parser is failing for me quite often.
Just connected to LangSmith and it seems the response usually includes System: before the JSON.
Failed to parse. Text: " System: {"fieldsOfStudy": ["Philosophy", "Psychology", "Sociology"], "researchSpecializations": ["Moral Psychology", "Existentialism", "Social Psychology"]}".
@KennyVaneetvelde Thank you for the feature! Do you see anything I could be doing wrong? I have 3 other Chatflows with similar results.
To Reproduce Create LLM Chain with Advanced Structured Output Parser with the following JSON
z.object({
fieldsOfStudy: z.array(z.string()),
researchSpecializations: z.array(z.string())
});
OpenAI: gpt-3.5 turbo-instruct Chat Prompt template:
Role and Goal:
This GPT identifies and suggests academic topics based on a given initial topic.
It provides two lists in response:
- Fields of Study: 5-10 high-level field of study or areas
- Research Specializations: 5-10 more specific topics, suitable for in-depth academic research or publication.
Constraints: The GPT responds only with two lists in json format and does not provide additional commentary or explanations.
Guidelines: The GPT focuses on academic relevance and specificity, ensuring that the topics are suitable for scholarly discussion and exploration. It avoids suggesting topics outside academic research or studies.
Clarification: The GPT should never ask for clarification.
Expected behavior Output to be in JSON
Screenshots
Flow Topic Generator.json
Setup
- Installation: npm run dev
- Flowise Version: 1.5.0
- OS: Windows
- Browser: Chrome
Additional context Tried default temperature (7) as well as 2 and 0
not sure if it helps, but can you try ChatOpenA like gpt3.5 or gpt4?
The issue is due to the usage of the instruct GPT model, I believe, try gpt-3.5-turbo-0125 with ChatOpenAI as @HenryHengZJ suggested
gpt-3.5-turbo-0125 with ChatOpenAI
Bingo!
🙏Thank you @HenryHengZJ @KennyVaneetvelde