Entropic 2.3.8
Local-first agentic inference engine
Loading...
Searching...
No Matches
entropic::Nemotron3Adapter Class Reference

Nemotron 3 chat adapter (hybrid Mamba-Transformer family). More...

#include </home/runner/work/entropic/entropic/src/inference/adapters/nemotron3_adapter.h>

Inheritance diagram for entropic::Nemotron3Adapter:
Collaboration diagram for entropic::Nemotron3Adapter:

Public Member Functions

std::string chat_format () const override
 Chat format: GGUF-embedded template (Nemotron-specific).
 
ParseResult parse_tool_calls (const std::string &content) const override
 Parse DSML invoke calls; fall back to qwen XML, then tagged JSON.
 
Message format_tool_result (const ToolCall &tool_call, const std::string &result) const override
 Wrap tool result in <tool_response> tags.
 
 ChatAdapter (std::string tier_name, std::string identity_prompt)
 Construct adapter with tier identity.
 
- Public Member Functions inherited from entropic::ChatAdapter
 ChatAdapter (std::string tier_name, std::string identity_prompt)
 Construct adapter with tier identity.
 
std::string format_system_prompt (const std::string &base_prompt, const std::vector< std::string > &tool_jsons) const
 Assemble system prompt: identity + context + tools.
 
bool is_response_complete (const std::string &content, const std::vector< ToolCall > &tool_calls) const
 Check if response represents task completion.
 
virtual std::string format_system_with_vision (const std::string &base_system, bool has_vision) const
 Format system prompt with optional vision context.
 
virtual std::string format_content_parts (const std::vector< ContentPart > &parts) const
 Convert multimodal content parts to adapter-specific format.
 

Protected Member Functions

std::string format_tools (const std::vector< std::string > &tool_jsons) const override
 Format tools as a <tools> JSON array, then teach DSML invoke.
 
- Protected Member Functions inherited from entropic::ChatAdapter
std::vector< ToolCallparse_tagged_tool_calls (const std::string &content) const
 Parse <tool_call>JSON</tool_call> tagged blocks.
 
std::vector< ToolCallparse_bare_json_tool_calls (const std::string &content) const
 Parse bare JSON lines containing "name" key.
 
std::string extract_thinking (const std::string &content) const
 Extract <think>...</think> content.
 
std::string strip_think_blocks (const std::string &content) const
 Strip all <think>...</think> blocks from content.
 
std::optional< ToolCalltry_recover_json (const std::string &json_str) const
 Attempt JSON recovery on malformed tool call string.
 
std::optional< ToolCallparse_single_tool_call (const std::string &json_str) const
 Parse a single JSON tool call string.
 

Additional Inherited Members

- Protected Attributes inherited from entropic::ChatAdapter
std::string tier_name_
 Identity tier name.
 
std::string identity_prompt_
 Assembled identity prompt.
 
std::unordered_set< std::string > tool_prefixes_
 Known tool prefixes.
 

Detailed Description

Nemotron 3 chat adapter (hybrid Mamba-Transformer family).

Tool-call parsing mirrors the qwen3_coder XML format. Reasoning traces are emitted as <think>...</think> blocks and handled by the shared base-class primitives.

Version
2.1.9

Definition at line 60 of file nemotron3_adapter.h.

Member Function Documentation

◆ chat_format()

std::string entropic::Nemotron3Adapter::chat_format ( ) const
inlineoverridevirtual

Chat format: GGUF-embedded template (Nemotron-specific).

Returns
Empty string — llama.cpp drives template application from the GGUF's stored template. @utility
Version
2.1.9

Implements entropic::ChatAdapter.

Definition at line 71 of file nemotron3_adapter.h.

◆ ChatAdapter()

entropic::ChatAdapter::ChatAdapter ( std::string  tier_name,
std::string  identity_prompt 
)

Construct adapter with tier identity.

Parameters
tier_nameIdentity tier (e.g. "eng", "lead").
identity_promptAssembled identity prompt.
Version
1.8.2
Parameters
tier_nameIdentity tier name.
identity_promptAssembled identity prompt.
Version
1.8.2

Definition at line 66 of file adapter_base.cpp.

◆ format_tool_result()

Message entropic::Nemotron3Adapter::format_tool_result ( const ToolCall tool_call,
const std::string &  result 
) const
overridevirtual

Wrap tool result in <tool_response> tags.

Wrap tool result in <tool_response> tags as a user message.

Parameters
tool_callExecuted tool call.
resultExecution result text.
Returns
User-role message containing the wrapped result.
Version
2.1.9
Parameters
tool_callExecuted tool call (used for logging only).
resultExecution result text.
Returns
User-role message with the wrapped result.

Reimplemented from entropic::ChatAdapter.

Definition at line 235 of file nemotron3_adapter.cpp.

◆ format_tools()

std::string entropic::Nemotron3Adapter::format_tools ( const std::vector< std::string > &  tool_jsons) const
overrideprotectedvirtual

Format tools as a <tools> JSON array, then teach DSML invoke.

Format tool definitions and teach the DSML invoke call format.

Parameters
tool_jsonsTool definition JSON strings.
Returns
Section to inject into the system prompt.
Version
2.3.8

gh#70: the injected call-format example matches what the nemotron_h GGUFs actually emit (DSML invoke, fullwidth-pipe ), instead of the qwen XML the model never produced under the production prompt.

Parameters
tool_jsonsTool definition JSON strings.
Returns
Section to inject into the system prompt.

Reimplemented from entropic::ChatAdapter.

Definition at line 290 of file nemotron3_adapter.cpp.

◆ parse_tool_calls()

ParseResult entropic::Nemotron3Adapter::parse_tool_calls ( const std::string &  content) const
overridevirtual

Parse DSML invoke calls; fall back to qwen XML, then tagged JSON.

Parse tool calls from Nemotron 3 output.

Parameters
contentRaw model output.
Returns
ParseResult.
Version
2.3.8

Layered strategy (gh#70): DSML invoke first (the native emit), then the qwen3_coder XML path and the tagged-JSON path as backstops for rigged-prompt or mixed-format consumers.

Parameters
contentRaw model output.
Returns
ParseResult.

Implements entropic::ChatAdapter.

Definition at line 60 of file nemotron3_adapter.cpp.


The documentation for this class was generated from the following files: