-
Notifications
You must be signed in to change notification settings - Fork 10
Add strict mode handling #28
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
base: main
Are you sure you want to change the base?
Conversation
|
Thanks for the PR! Only skimmed through, but I'd prefer that strict is true and included by default so we don't break existing implementations. |
|
@danielfriis that makes sense So the problem is whenever you include I rewrote it such that there's now a method to explicitly skip strict like this: class MySchema < RubyLLM::Schema
skip_strict true
string :name, description: "The person's name"
endThis will make sure all existing schemas work the same way as before, but the library can also be used for providing schemas to Anthropic. |
|
Hmmm. I see. So even if |
That's exactly right. It's like they don't support that field. |
|
What if we allowed values |
|
I can live with that. I can't see why anyone would have set |

Hi, I started working on a PR to support structured objects in Anthropic: crmne/ruby_llm#528
It seems that Anthropic doesn't want
strict: truein the schema, in fact, it blows up if it's present.This small PR will only add
struct: trueif it's actually set to true, otherwise it'll omit the key.We still set it to true by default, so in order to use schemas with Anthropic, one must explicitly set
strict falseorstrict nil.cc @danielfriis