Validating output when using with_schema #314
-
Thank you very much for this great gem, it's been a joy to use. And now with version 1.4 I was able to simplify my code considerably by using One thing I'm still doing, though I'm not sure it's necessary anymore, is to validate the LLM's response against the schema I gave it. My current flow is:
Is this last step still needed? I haven't tested the new version enough to be fully confident that the LLM will respect the instructions given (LLM's seem to love to throw a curve ball once in a while). I would love to hear how others are handling this. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Structured Output ensures that the schema is followed: https://platform.openai.com/docs/guides/structured-outputs?api-mode=chat If you're paranoid about it, you can always use a JSON Schema validator. Plenty of gems around for that. |
Beta Was this translation helpful? Give feedback.
Structured Output ensures that the schema is followed: https://platform.openai.com/docs/guides/structured-outputs?api-mode=chat
If you're paranoid about it, you can always use a JSON Schema validator. Plenty of gems around for that.