Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JsonSchemaValidator: inconsistency in corrective message generation for Claude vs. OpenAI models #7455

Closed
vblagoje opened this issue Apr 3, 2024 · 1 comment
Assignees
Labels
2.x Related to Haystack v2.0 P1 High priority, add to the next sprint

Comments

@vblagoje
Copy link
Member

vblagoje commented Apr 3, 2024

Describe the bug

The JsonSchemaValidator class, designed to validate JSON content of ChatMessage against a specified JSON Schema, exhibits inconsistent behavior in generating corrective messages when used with Claude compared to OpenAI models. While the validator successfully prompts OpenAI models to generate messages that satisfy the schema requirements, it fails to elicit the correct behavior from Claude models. This inconsistency affects the utility of Haystack 2.x recovery loops, where the JsonSchemaValidator plays a crucial role in ensuring that LLM responses adhere to predefined schema constraints.

Expected behavior

The expected behavior is for the JsonSchemaValidator to work properly across different LLMs, including but not limited to OpenAI and Claude models. Upon encountering a validation error, the validator should be able to generate an error message that instructs any LLM to produce a response that correctly aligns with the specified JSON Schema. This ensures that the recovery loop mechanism can effectively guide LLMs towards generating schema-compliant responses, regardless of the underlying model architecture or provider.

@vblagoje vblagoje added 2.x Related to Haystack v2.0 P2 Medium priority, add to the next sprint if no P1 available labels Apr 3, 2024
@shadeMe shadeMe added P1 High priority, add to the next sprint and removed P2 Medium priority, add to the next sprint if no P1 available labels Jun 10, 2024
@shadeMe shadeMe assigned vblagoje and unassigned davidsbatista Jun 14, 2024
@vblagoje
Copy link
Member Author

Fixed with #7556, closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.x Related to Haystack v2.0 P1 High priority, add to the next sprint
Projects
None yet
Development

No branches or pull requests

3 participants