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

Qwen 3.5 MoE chat adapter (20% override layer). More...

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

Inheritance diagram for entropic::Qwen35Adapter:
Collaboration diagram for entropic::Qwen35Adapter:

Public Member Functions

std::string chat_format () const override
 Chat format: ChatML.
 
ParseResult parse_tool_calls (const std::string &content) const override
 Parse XML function calls, fallback to tagged JSON.
 
Message format_tool_result (const ToolCall &tool_call, const std::string &result) const override
 Wrap tool result in <tool_response> tags.
 
std::string format_system_with_vision (const std::string &base_system, bool has_vision) const override
 Qwen3.5 vision system prompt extension.
 
std::string format_content_parts (const std::vector< ContentPart > &parts) const override
 Qwen3.5 content part formatting.
 
 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.
 

Protected Member Functions

std::string format_tools (const std::vector< std::string > &tool_jsons) const override
 Format tools in <tools> tags with OpenAI function JSON.
 
- 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

Qwen 3.5 MoE chat adapter (20% override layer).

Overrides: XML tool call parsing, <tools> tag formatting, <tool_response> result wrapping.

Version
1.8.2

Definition at line 39 of file qwen35_adapter.h.

Member Function Documentation

◆ chat_format()

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

Chat format: ChatML.

Returns
The string "chatml". @utility
Version
1.8.2

Implements entropic::ChatAdapter.

Definition at line 49 of file qwen35_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_content_parts()

std::string entropic::Qwen35Adapter::format_content_parts ( const std::vector< ContentPart > &  parts) const
overridevirtual

Qwen3.5 content part formatting.

Qwen3.5 content part formatting (OpenAI-native).

Qwen3.5 uses the OpenAI content array format natively (early fusion, no special image tags). Default implementation is sufficient — override exists for documentation and future tweaks.

Parameters
partsContent parts from a message.
Returns
JSON string in OpenAI content array format.
Version
1.9.11
Parameters
partsContent parts from a message.
Returns
JSON string in OpenAI content array format.

Reimplemented from entropic::ChatAdapter.

Definition at line 288 of file qwen35_adapter.cpp.

◆ format_system_with_vision()

std::string entropic::Qwen35Adapter::format_system_with_vision ( const std::string &  base_system,
bool  has_vision 
) const
overridevirtual

Qwen3.5 vision system prompt extension.

When has_vision is true, appends vision capability instructions. Otherwise returns base_system unchanged.

Parameters
base_systemBase system prompt text.
has_visionWhether the model has vision capability.
Returns
Formatted system prompt.
Version
1.9.11
Parameters
base_systemBase system prompt text.
has_visionWhether the model has vision capability.
Returns
System prompt, with vision instructions appended if active.

Reimplemented from entropic::ChatAdapter.

Definition at line 272 of file qwen35_adapter.cpp.

◆ format_tool_result()

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

Wrap tool result in <tool_response> tags.

Format tool result with <tool_response> tags.

Version
1.8.2
Parameters
tool_callExecuted tool call.
resultExecution result.
Returns
Formatted user message.

Reimplemented from entropic::ChatAdapter.

Definition at line 174 of file qwen35_adapter.cpp.

◆ format_tools()

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

Format tools in <tools> tags with OpenAI function JSON.

Version
1.8.2
Parameters
tool_jsonsTool definition JSON strings.
Returns
Formatted tools section.

Reimplemented from entropic::ChatAdapter.

Definition at line 194 of file qwen35_adapter.cpp.

◆ parse_tool_calls()

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

Parse XML function calls, fallback to tagged JSON.

Parse tool calls from Qwen 3.5 output.

Parameters
contentRaw model output.
Returns
ParseResult with cleaned content and tool calls.
Version
1.8.2

Primary: XML function calls. Fallback: tagged JSON (base class).

Parameters
contentRaw model output.
Returns
ParseResult.

Implements entropic::ChatAdapter.

Definition at line 55 of file qwen35_adapter.cpp.


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