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

Function base64_encode

src/langfuse/tracer.cpp:65–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63}
64
65std::string base64_encode(const std::string& in) {
66 static const char* kAlphabet =
67 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
68 std::string out;
69 out.reserve(((in.size() + 2) / 3) * 4);
70 int val = 0;
71 int valb = -6;
72 for (unsigned char c : in) {
73 val = (val << 8) + c;
74 valb += 8;
75 while (valb >= 0) {
76 out.push_back(kAlphabet[(val >> valb) & 0x3F]);
77 valb -= 6;
78 }
79 }
80 if (valb > -6) {
81 out.push_back(kAlphabet[((val << 8) >> (valb + 8)) & 0x3F]);
82 }
83 while (out.size() % 4)
84 out.push_back('=');
85 return out;
86}
87
88JsonValue model_parameters_from(const GenerateOptions& options) {
89 JsonValue params = JsonValue::object();

Callers 1

HttpStateMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected