Flowise icon indicating copy to clipboard operation
Flowise copied to clipboard

[BUG] Advanced Structured Output Parser Failing

Open mdroidian opened this issue 1 year ago • 2 comments

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"]}".

image

@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 image

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

mdroidian avatar Feb 22 '24 05:02 mdroidian

not sure if it helps, but can you try ChatOpenA like gpt3.5 or gpt4?

HenryHengZJ avatar Feb 22 '24 16:02 HenryHengZJ

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

KennyVaneetvelde avatar Feb 22 '24 20:02 KennyVaneetvelde

gpt-3.5-turbo-0125 with ChatOpenAI

Bingo!

image

🙏Thank you @HenryHengZJ @KennyVaneetvelde

mdroidian avatar Feb 23 '24 01:02 mdroidian