rig icon indicating copy to clipboard operation
rig copied to clipboard

feat: `strict` parameter in ToolDefinition

Open klntsky opened this issue 11 months ago • 3 comments

  • [x] I have looked for existing issues (including closed) about this

Feature Request

ToolDefinition does not contain a strict option

https://platform.openai.com/docs/assistants/tools/function-calling

Alternatives

The only alternative is to validate the returned JSON manually

klntsky avatar Jan 21 '25 16:01 klntsky

I'm definitely in need for this feature, or at least a workaround. Is there a way to add strict to a tooldef so that the jsonschema passed to the llm is adhered to more consistently? I'm getting non-adherence to my schema in tool responses and it may be because of this

azambuilds avatar Feb 02 '25 15:02 azambuilds

@joshua-mo-143 Any plans on supporting structured outputs?

nikhil-pandey avatar Apr 11 '25 16:04 nikhil-pandey

@nikhil-pandey Looking into getting this working. The strict argument isn't consistent with all providers (and some might be default strict)!

0xMochan avatar Apr 30 '25 01:04 0xMochan

@klntsky @Tameflame @nikhil-pandey

Hi folks, we're migrating our OpenAI integration to use the Responses API which makes it trivial to implement strict parameters on structured outputs (via the text config). Once #503 has a PR opened for it and it's been closed, that will then automatically close this issue.

(in terms of accessing the old Chat Completions API: you'll still be able to do it through a method on the adjusted CompletionModel struct)

joshua-mo-143 avatar Jun 11 '25 20:06 joshua-mo-143