MCPcopy Create free account
hub / github.com/antirez/llama.cpp-deepseek-v4-flash / task_result_state

Class task_result_state

tools/server/server-task.h:95–127  ·  view source on GitHub ↗

struct for tracking the state of a task (e.g., for streaming)

Source from the content-addressed store, hash-verified

93
94// struct for tracking the state of a task (e.g., for streaming)
95struct task_result_state {
96 // tracking diffs for partial tool calls
97 std::vector<common_chat_msg_diff> diffs;
98 common_chat_parser_params chat_parser_params;
99 common_chat_msg chat_msg;
100 std::string generated_text; // append new chunks of generated text here
101 std::vector<std::string> generated_tool_call_ids;
102 std::unordered_set<size_t> sent_tool_call_names;
103
104 // for OpenAI Responses and Anthropic streaming API:
105 // track output item / content block state across chunks
106 bool thinking_block_started = false;
107 bool text_block_started = false;
108
109 // for OpenAI Responses streaming API
110 const std::string oai_resp_id;
111 const std::string oai_resp_reasoning_id;
112 const std::string oai_resp_message_id;
113 std::string oai_resp_fc_id; // function call ID for current args delta
114
115 task_result_state(const common_chat_parser_params & chat_parser_params)
116 : chat_parser_params(chat_parser_params)
117 , oai_resp_id("resp_" + random_string())
118 , oai_resp_reasoning_id("rs_" + random_string())
119 , oai_resp_message_id("msg_" + random_string()) {}
120
121 // parse partial tool calls and update the internal state
122 common_chat_msg update_chat_msg(
123 const std::string & text_added,
124 bool is_partial,
125 std::vector<common_chat_msg_diff> & diffs,
126 bool filter_tool_calls = false);
127};
128
129struct server_task {
130 int id = -1; // to be filled by server_queue

Callers 1

create_stateMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected