Entropic 2.9.4
Local-first agentic inference engine
Loading...
Searching...
No Matches
adapter_base.h File Reference

ChatAdapter concrete base class. More...

#include <entropic/types/message.h>
#include <entropic/types/tool_call.h>
#include <optional>
#include <string>
#include <string_view>
#include <unordered_set>
#include <vector>
Include dependency graph for adapter_base.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  entropic::ParseResult
 Parsed tool call result: cleaned content + extracted calls. More...
 
class  entropic::ChatAdapter
 Concrete base class for chat format adapters (80% logic). More...
 

Namespaces

namespace  entropic
 Activate model on GPU (WARM → ACTIVE).
 

Functions

std::vector< ToolCallentropic::recover_action_envelope_calls (const std::string &raw)
 gh#88: recover tool calls a gemma model parroted as bare-JSON.
 
void entropic::apply_action_envelope_recovery (std::vector< ToolCall > &calls, const std::string &raw)
 gh#88: substitute recovered bare-JSON calls when a reliable (PEG_GEMMA4 / gemma) parse produced none; logs the recovery.
 
void entropic::coerce_string_typed_args (std::vector< ToolCall > &calls, const std::string &tools_json)
 gh#90: coerce numeric scalars back to strings for string-typed tool parameters.
 

Detailed Description

ChatAdapter concrete base class.

Responsibilities (80% in base)
  • System prompt assembly (identity + context + tools)
  • Think-block extraction and stripping
  • Tagged tool call parsing (<tool_call>JSON</tool_call>)
  • Bare JSON tool call parsing (fallback)
  • Malformed JSON recovery
  • Tool result formatting
  • Response completeness detection (think-aware)
Subclass overrides (20%)
  • parse_tool_calls() — model-specific parsing strategy
  • format_tools() — tool definition format
  • format_tool_result() — if model needs special wrapping
  • chat_format() — chat format identifier

Internal to inference .so — nlohmann/json used internally, not in interface headers.

Version
1.8.2

Definition in file adapter_base.h.