NVIDIA-NeMo / NVIDIA-NeMo/Guardrails
feature: Tool call validation for v1/chat/completions requests
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 7.2k
- Forks
- 842
- Avg merge
- 3d 1h
- Merged PRs (30d)
- 25
Description
Did you check the docs?
- I have read all the NeMo-Guardrails docs
Is your feature request related to a problem? Please describe.
While the tool_choice and tools params exist in the GuardrailsChatCompletionRequest schema, their behaviour is not perfectly aligned with the OpenAI Chat Completions API. Broadly speaking, there is no currently no validation of the tool_choice param in GuardrailsChatCompletionRequest. In contrast, OpenAI Chat Completion API checks the tool_choice argument in the incoming request with the list of tools. This ensures that all tool choices declared in chat completions requests are valid. In order to align tool-calling behaviour in GuardrailsChatCompletionRequest with OpenAI API Chat Completions API, initialization and run-time validation are necessary.
Describe the solution you'd like
- Optional configuration of tools on
config.yamlto define a list of tools the model can access i.e adding a new field,toolsinLLMRails. This is meant to mimic OpenAI's Tool Search where we load all the available tools at server start time rather than having the user send tool definitions at runtime - Check if the requested
tool_choicein a guardrailsv1/chat/completionsis available in the list oftools - Enrich the existing
toolsandtool_choiceparams. with missing subfields
Describe alternatives you've considered
n/a
Additional context
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the GuardrailsChatCompletionRequest schema and the LLMRails configuration path, then trace handling for tools and tool_choice in v1/chat/completions. Confirm how config.yaml could define server-side tools, where initialization and run-time validation belong, and which missing subfields need to be represented. Done means invalid tool choices are rejected and valid configured tools align with the OpenAI Chat Completions behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, backend-api-design
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 50/100