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

Improve LLM error handling for structured output #281

Open
gfargo opened this issue Oct 29, 2024 · 2 comments
Open

Improve LLM error handling for structured output #281

gfargo opened this issue Oct 29, 2024 · 2 comments
Labels
bug Something isn't working enhancement New feature or request

Comments

@gfargo
Copy link
Owner

gfargo commented Oct 29, 2024

Describe the request

Sometimes the LLM will respond with a malformed object when using structure output with LangChain. To compensate for this, we should use Zod to validate the response.

Additionally, we can add a maxRetry config value that will automatically attempt to retry the request until response matches the expected shape.

@gfargo gfargo added bug Something isn't working enhancement New feature or request labels Oct 29, 2024
@gfargo
Copy link
Owner Author

gfargo commented Nov 18, 2024

Note solution used in #292 to ensure only a JSON object was returned, sans prefixed intro LLM text

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant