Entropic 2.9.4
Local-first agentic inference engine
Loading...
Searching...
No Matches
tool_call_serialize.h
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
17#pragma once
18
19#include <string>
20#include <vector>
21
23#include <nlohmann/json.hpp>
24
25namespace entropic {
26
39inline std::string serialize_tool_calls(
40 const std::vector<ToolCall>& calls) {
41 nlohmann::json arr = nlohmann::json::array();
42 for (const auto& tc : calls) {
43 nlohmann::json args;
44 for (const auto& [k, v] : tc.arguments) {
45 auto parsed_val = nlohmann::json::parse(v, nullptr, false);
46 args[k] = parsed_val.is_discarded()
47 ? nlohmann::json(v) : parsed_val;
48 }
49 arr.push_back({{"name", tc.name}, {"arguments", args}});
50 }
51 return arr.dump();
52}
53
54} // namespace entropic
Activate model on GPU (WARM → ACTIVE).
std::string serialize_tool_calls(const std::vector< ToolCall > &calls)
Serialize parsed tool calls to the C-ABI JSON array form.
Tool call and tool result types.