Gym icon indicating copy to clipboard operation
Gym copied to clipboard

GPT-OSS OpenAI model workflow needs to work with build.nvidia.com endpoints

Open bxyu-nvidia opened this issue 1 year ago • 1 comments

Use cases, pain points, and background We tried using the GPT-OSS endpoints from build.nvidia.com or inference.nvidia.com and got some errors.

Description: Try them out and fix them

Design:

Out of scope:

Acceptance Criteria:

  • [ ] Obtain build.nvidia.com API key and inference.nvidia.com API key
  • [ ] Try out the above flow
  • [ ] Fix any issues on Gym infra or try to have a reasonably robust patch for the *.nvidia.com endpoints
  • [ ] Write a tutorial on how to get an API key from these places and how to use them

bxyu-nvidia avatar Oct 22 '25 19:10 bxyu-nvidia

I actually found the issue here. When we are calling return NeMoGymResponse.model_validate(openai_response_dict) in responses_api_models/openai_model/app.py we are getting an exception that is not bubbling up in the logs so it was a little bit harder to understand where the problem was coming from

Traceback (most recent call last): File "<string>", line 1, in <module> File "/home/ffrujeri/nemo-gym/responses_api_models/openai_model/.venv/lib/python3.12/site-packages/pydantic/main.py", line 716, in model_validate return cls.__pydantic_validator__.validate_python( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pydantic_core._pydantic_core.ValidationError: 4 validation errors for NeMoGymResponse usage.input_tokens Field required [type=missing, input_value={'prompt_tokens': 114, 't...t_tokens_details': None}, input_type=dict] For further information visit https://errors.pydantic.dev/2.12/v/missing usage.input_tokens_details Field required [type=missing, input_value={'prompt_tokens': 114, 't...t_tokens_details': None}, input_type=dict] For further information visit https://errors.pydantic.dev/2.12/v/missing usage.output_tokens Field required [type=missing, input_value={'prompt_tokens': 114, 't...t_tokens_details': None}, input_type=dict] For further information visit https://errors.pydantic.dev/2.12/v/missing usage.output_tokens_details Field required [type=missing, input_value={'prompt_tokens': 114, 't...t_tokens_details': None}, input_type=dict] For further information visit https://errors.pydantic.dev/2.12/v/missing

The build.nvidia.com endpoints are returning

'usage': {
    'prompt_tokens': 114,          # ← Old name
    'completion_tokens': 108,      # ← Old name
    'total_tokens': 222,
    'prompt_tokens_details': None
}

while the NeMoGymResponse expects:

'usage': {
    'input_tokens': 114,           # ← New name
    'output_tokens': 108,          # ← New name
    'input_tokens_details': {...},
    'output_tokens_details': {...}
}

@bxyu-nvidia what are the mechanism to validate versioning of the API data contract

ffrujeri avatar Nov 14 '25 23:11 ffrujeri