MCPcopy Create free account
hub / github.com/antirez/ds4 / append_model_json_values

Function append_model_json_values

ds4_server.c:11173–11207  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11171
11172static void kv_cache_log_cb(void *ud, ds4_kvstore_log_type type, const char *msg) {
11173 (void)ud;
11174 ds4_log_type stype = DS4_LOG_KVCACHE;
11175 if (type == DS4_KVSTORE_LOG_DEFAULT) stype = DS4_LOG_DEFAULT;
11176 else if (type == DS4_KVSTORE_LOG_WARNING) stype = DS4_LOG_WARNING;
11177 server_log(stype, "%s", msg);
11178}
11179
11180static bool kv_cache_open(kv_disk_cache *kc, const char *dir, uint64_t budget_mb,
11181 bool reject_different_quant, kv_cache_options opt) {
11182 return ds4_kvstore_open(kc, dir, budget_mb, reject_different_quant, opt,
11183 "ds4-server", kv_cache_log_cb, NULL);
11184}
11185
11186static void kv_cache_close(kv_disk_cache *kc) {
11187 ds4_kvstore_close(kc);
11188}
11189
11190static char *render_tokens_text(ds4_engine *engine, const ds4_tokens *tokens, size_t *out_len) {
11191 return ds4_kvstore_render_tokens_text(engine, tokens, out_len);
11192}
11193
11194static bool byte_prefix_match(const char *text, size_t text_len,
11195 const char *prefix, size_t prefix_len) {
11196 return ds4_kvstore_byte_prefix_match(text, text_len, prefix, prefix_len);
11197}
11198
11199
11200static void tokens_copy_prefix(ds4_tokens *dst, const ds4_tokens *src, int n) {
11201 ds4_kvstore_tokens_copy_prefix(dst, src, n);
11202}
11203
11204
11205static void build_prompt_from_exact_prefix_and_text_suffix(
11206 ds4_engine *engine,
11207 const ds4_tokens *exact_prefix,
11208 const char *suffix_text,
11209 ds4_tokens *out)
11210{

Calls 3

buf_printfFunction · 0.85
json_escapeFunction · 0.85
buf_putsFunction · 0.85