MCPcopy Create free account
hub / github.com/ClickHouse/ai-sdk-cpp / buildSuccessResponse

Method buildSuccessResponse

tests/utils/mock_anthropic_client.cpp:188–205  ·  view source on GitHub ↗

AnthropicResponseBuilder implementation

Source from the content-addressed store, hash-verified

186
187// AnthropicResponseBuilder implementation
188std::string AnthropicResponseBuilder::buildSuccessResponse(
189 const std::string& content,
190 const std::string& model,
191 int input_tokens,
192 int output_tokens) {
193 nlohmann::json response = {
194 {"id", "msg_test123"},
195 {"type", "message"},
196 {"role", "assistant"},
197 {"content",
198 nlohmann::json::array({{{"type", "text"}, {"text", content}}})},
199 {"model", model},
200 {"stop_reason", "end_turn"},
201 {"stop_sequence", nullptr},
202 {"usage",
203 {{"input_tokens", input_tokens}, {"output_tokens", output_tokens}}}};
204 return response.dump();
205}
206
207std::string AnthropicResponseBuilder::buildErrorResponse(
208 int /* status_code */,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected