nemo_gym.openai_utils
nemo_gym.openai_utils
Module Contents
Classes
Functions
Data
NeMoGymChatCompletionContentPartParam
NeMoGymChatCompletionMessageParam
NeMoGymChatCompletionMessageToolCallUnion
NeMoGymChatCompletionMessageToolCallUnionParam
NeMoGymChatCompletionOutputMessage
NeMoGymChatCompletionToolUnionParam
NeMoGymResponseInputContentList
NeMoGymResponseInputContentPart
REQUIRED_TOKEN_METADATA_FIELDS
API
Bases: InputAdditionalTools
Additional tool definitions accepted in request input.
Bases: BaseModel
This is just a stub class that wraps around aiohttp
Bases: ChatCompletion
Bases: typing.TypedDict
Bases: ChatCompletionAssistantMessageParam
Bases: ChatCompletionContentPartFileParam
Bases: ChatCompletionContentPartImageParam
Bases: ChatCompletionContentPartInputAudioParam
Bases: ChatCompletionContentPartTextParam
Bases: typing.TypedDict
Bases: BaseModel
Bases: ChatCompletionCustomToolParam
Bases: ChatCompletionDeveloperMessageParam
Bases: ChatCompletionMessage
Bases: ChatCompletionMessageCustomToolCall
Bases: ChatCompletionMessageCustomToolCallParam
Bases: ChatCompletionMessageToolCall
Bases: typing.TypedDict
Bases: ChatCompletionMessageToolCallParam
Bases: ChatCompletionSystemMessageParam
Bases: ChatCompletionToolMessageParam
Bases: ChatCompletionToolParam
Bases: ChatCompletionUserMessageParam
Bases: Choice
Bases: CompactionTrigger
A request for the provider to compact the context (compaction_trigger item).
Gym preserves this input item when replaying the transcript.
Bases: ComputerCallOutput
A computer-use result accepted in request input (computer_call_output item).
Bases: BaseModel
Bases: BaseModel
Bases: BaseModel
We copy openai.types.responses.response_input_param.FunctionCallOutput, originally a TypedDict, as a BaseModel here so that we can use it in the NeMoGymResponseOutputItem below and be consistent with the other ResponseOutputItem types.
Bases: FunctionDefinition
Bases: FunctionToolParam
Bases: ImageGenerationCall
A hosted image-generation call (OpenAI Responses image_generation_call output item).
Bases: typing.TypedDict
Video content accepted by the Responses-compatible Gym API.
Bases: LocalShellCall
A local-shell command for the client to execute (local_shell_call output item).
Bases: LocalShellCallOutput
The client’s result of a local shell command (local_shell_call_output item).
Bases: McpApprovalResponse
The client’s answer to a hosted-MCP approval request (mcp_approval_response item).
Bases: BaseModel
Bases: NeMoGymMessage, TokenIDLogProbMixin
Bases: Response
Bases: OutputAdditionalTools
Additional tool definitions returned by the provider.
Bases: ResponseApplyPatchToolCall
A patch the model wants applied (apply_patch_call output item).
Bases: ResponseApplyPatchToolCallOutput
The client’s result of applying a patch (apply_patch_call_output item).
Bases: ResponseCodeInterpreterToolCall
A hosted code-interpreter call (OpenAI Responses code_interpreter_call output item).
Bases: ResponseCompactionItem
An opaque context-compaction record the provider emits (compaction item).
Bases: ResponseComputerToolCallOutputItem
Provider output for a computer-use action, including status="failed".
Bases: ResponseComputerToolCall
A computer-use action for the client to execute (computer_call output item).
Bases: BaseModel
This class is a copy of openai.types.responses.response_create_params.ResponseCreateParamsNonStreaming We make a copy of it here since ResponseCreateParamsNonStreaming is a TypedDict with no strict validation. We need to do server side validation here.
Normalize fields whose OpenAI output and input schemas differ.
Bases: ResponseCustomToolCall
A client-executed custom tool call (OpenAI Responses custom_tool_call output item).
Bases: ResponseCustomToolCallOutput
The client’s result of a custom tool call (custom_tool_call_output item).
Bases: ResponseCustomToolCallOutputItem
Provider output for a custom tool call.
Bases: ResponseFileSearchToolCall
A hosted file-search call (OpenAI Responses file_search_call output item).
The provider executes the search and returns the call in response.output.
Inherits the upstream typing unchanged.
Bases: ResponseFunctionToolCallOutputItem
Provider output for a function call result.
Bases: ResponseFunctionShellToolCall
A shell command the model wants run (shell_call output item).
Bases: ResponseFunctionShellToolCallOutput
The client’s result of running a shell command (shell_call_output item).
Bases: BaseModel
Bases: ResponseFunctionWebSearch
A hosted web-search call (OpenAI Responses web_search_call output item).
Bases: ResponseInputTextParam
Bases: ResponseInputTokensDetails
Bases: OutputLocalShellCallOutput
Provider output for a local shell command.
Bases: McpApprovalRequest
A hosted-MCP approval request (OpenAI Responses mcp_approval_request item).
Inherits the upstream McpApprovalRequest typing; id/server_label
are relaxed to optional to tolerate endpoints that omit them.
Bases: OutputMcpApprovalResponse
Provider output carrying an answer to a hosted-MCP approval request.
Bases: McpCall
A hosted-MCP tool call (OpenAI Responses mcp_call output item).
Emitted when the upstream endpoint executes a tool server-side (e.g.
NVIDIA-hosted gpt-oss surfacing its built-in python tool as MCP) instead of
returning a client-executed function_call. The output/error
fields are already populated by the server, so the agent parses and passes
it through; there is no client-side execution and hence no training variant.
Inherits the upstream McpCall typing and only relaxes the fields
NVIDIA-hosted endpoints may omit or widen: id/server_label are made
optional and status accepts any string (upstream pins it to a Literal).
Bases: McpListTools
A hosted-MCP tool listing (OpenAI Responses mcp_list_tools output item).
Inherits the upstream McpListTools typing; only id/server_label
are relaxed to optional (NVIDIA-hosted endpoints may omit them) and tools
is widened to List[Any] so raw tool entries pass through without being
coerced into the upstream McpListToolsTool schema.
Bases: BaseModel
Bases: BaseModel
Bases: BaseModel
Bases: ResponseOutputTokensDetails
Bases: BaseModel
Bases: ResponseToolSearchCall
A tool-search call (tool_search_call output item).
Bases: ResponseToolSearchOutputItem
The result of a tool search (tool_search_output item).
Bases: ResponseUsage
Bases: Summary
Bases: BaseModel
Bases: typing.TypedDict
Add reported token counts without turning an unknown count into a measurement.
Convert a provider output item to the request input schema.
Prevent an untagged output item from being coerced into the wrong union member.
Require complete token metadata when any token field is present.
Require one non-empty source without changing the TypedDict representation.
Accumulate top-level and detailed response token counts.
Return the ForTraining subclass that carries token IDs for item_cls.
Raises NotImplementedError rather than KeyError, so the message can name the class and the fix. Either register the pair in RESPONSES_TO_TRAIN, or stop attaching token IDs to that item.