NVIDIA-NeMo / NVIDIA-NeMo/Guardrails

conformance: add missing request properties to chat completion schema

Open
#2,250 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
7.2k
Forks
842
Avg merge
3d 1h
Merged PRs (30d)
25

Description

Problem

GuardrailsChatCompletionRequest declares 14 of the 28+ properties in
OpenAI's CreateChatCompletionRequest. The remaining 23 are silently dropped,
breaking clients that send them.

High-impact missing properties include response_format, seed,
max_completion_tokens, n, stream_options, and reasoning_effort.

Full list: max_completion_tokens, response_format, seed, n,
top_logprobs, stream_options, user, reasoning_effort, service_tier,
store, metadata, audio, modalities, moderation, prediction,
safety_identifier, verbosity, web_search_options, prompt_cache_key,
prompt_cache_options, prompt_cache_retention, function_call, functions.

Proposed direction

Add all 23 fields as Optional[Any] = None to
GuardrailsChatCompletionRequest in server/schemas/openai.py and forward
them to generation_options.llm_params in chat_completion(), following the
existing pattern for max_tokens, temperature, etc.

Alternative: set model_config = ConfigDict(extra="allow") on the request
model to forward all unknown fields as llm_params automatically. Covers
future additions but loses explicit OpenAPI documentation.

Acceptance criteria

  • All 23 properties are accepted by the request schema.
  • Values are forwarded to the LLM provider via llm_params.
  • Conformance gap count drops by 23.
  • Existing tests pass; new tests confirm passthrough for representative fields.

Validation

  • Run scripts/openai_coverage.py --fetch --fastapi and confirm the 23
    "removed the request property" gaps are resolved.
  • Run make test TEST=tests/server/ to confirm no regressions.

Files

  • nemoguardrails/server/schemas/openai.py
  • nemoguardrails/server/api.py

Parent epic

This issue is a sub-issue of #2249:

epic: close OpenAI API conformance gaps in Guardrails server

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in nemoguardrails/server/schemas/openai.py by comparing GuardrailsChatCompletionRequest with the listed missing properties, then inspect chat_completion() in nemoguardrails/server/api.py and the existing forwarding pattern. Add representative passthrough tests and run scripts/openai_coverage.py --fetch --fastapi followed by make test TEST=tests/server/; done means all 23 gaps are resolved without regressions.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
70/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.