datarobot_genai.dragent.frontends.converters
converters
convert_run_agent_input_to_chat_request_or_message
Bridge plain RunAgentInput to NAT chat completions for inner workflow agents.
DRAgent registers converters for DRAgentRunAgentInput only. The DRUM
NatAgent.invoke path produces plain RunAgentInput at the
streaming_memory_agent passthrough boundary, where inner
per_user_tool_calling_agent expects ChatRequestOrMessage.
Source code in datarobot_genai/dragent/frontends/converters.py
convert_str_to_chat_response
Convert a workflow's string output to a ChatResponse reporting the configured model.
Overrides NAT's built-in str -> ChatResponse converter, which calls
ChatResponse.from_string(data, usage=usage) without a model and so
falls back to its "unknown-model" default:
https://github.com/NVIDIA/NeMo-Agent-Toolkit/blob/99e07260fe71872202cdcff1c899f15ef14f4852/packages/nvidia_nat_core/src/nat/data_models/api_server.py#L973
dragent ignores the request's model (the agent runs its configured LLM), so the
response reports that configured model (:func:default_response_model), independent
of what the caller sent.
Source code in datarobot_genai/dragent/frontends/converters.py
convert_dragent_event_response_to_chat_response
Convert a (usually aggregated) DRAgentEventResponse to a NAT ChatResponse.
Used by the non-streaming /chat/completions and inline paths so
datarobot_moderations survive the DRAgentEventResponse -> ChatResponse
boundary. NAT's default path would route through str
(convert_dragent_event_response_to_str then convert_str_to_chat_response),
dropping the moderation extra.
Source code in datarobot_genai/dragent/frontends/converters.py
convert_nat_chat_response_chunk_to_openai_chat_completion_chunk
convert_nat_chat_response_chunk_to_openai_chat_completion_chunk(chunk: ChatResponseChunk) -> ChatCompletionChunk
Map NAT streaming chunk to OpenAI chat.completion.chunk.
Source code in datarobot_genai/dragent/frontends/converters.py
convert_dragent_event_response_to_openai_chat_completion_chunk
convert_dragent_event_response_to_openai_chat_completion_chunk(response: DRAgentEventResponse) -> ChatCompletionChunk
Convert one DRAgent stream chunk to an OpenAI chunk (dome / moderation streaming).
Source code in datarobot_genai/dragent/frontends/converters.py
build_assistant_text_events
Build an assistant TextMessageStart/Content/End AG-UI event sequence.
Produces real assistant text deltas (not a CustomEvent) so downstream
consumers that detect assistant text (e.g. moderation postscore) and
:func:convert_dragent_event_response_to_str see the content.
Source code in datarobot_genai/dragent/frontends/converters.py
convert_str_to_dragent_text_response
Convert a native-NAT str output to a text-bearing DRAgentEventResponse.
Emits assistant TextMessage* events so the result carries detectable assistant
text — required for the non-streaming normalization + moderation path. Called
directly by datarobot_dragent_normalization middleware (not via
GlobalTypeConverter).
Source code in datarobot_genai/dragent/frontends/converters.py
convert_chat_response_to_dragent_event_response
Convert a native-NAT ChatResponse to a text-bearing DRAgentEventResponse.
Preserves model and token usage; emits assistant TextMessage* events for
the message content. NAT ChoiceMessage carries no tool calls, so only text is
represented (matching the non-streaming NAT contract).