Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.

Commit b547fdc

Browse files
authored
Merge pull request #248 from janhq/247-feat-should-allow-turning-off-caching
add caching enabled to hotfix cache issues
2 parents d2e4ac5 + c67f62d commit b547fdc

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

controllers/llamaCPP.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ void llamaCPP::chatCompletion(
178178

179179
if (jsonBody) {
180180
// Default values to enable auto caching
181-
data["cache_prompt"] = true;
181+
data["cache_prompt"] = caching_enabled;
182182
data["n_keep"] = -1;
183183

184184
// Passing load value
@@ -390,6 +390,7 @@ bool llamaCPP::loadModelImpl(const Json::Value &jsonBody) {
390390
.asInt();
391391
params.cont_batching = jsonBody.get("cont_batching", false).asBool();
392392

393+
this->caching_enabled = jsonBody.get("caching_enabled", false).asBool();
393394
this->user_prompt = jsonBody.get("user_prompt", "USER: ").asString();
394395
this->ai_prompt = jsonBody.get("ai_prompt", "ASSISTANT: ").asString();
395396
this->system_prompt =

controllers/llamaCPP.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1908,5 +1908,6 @@ class llamaCPP : public drogon::HttpController<llamaCPP> {
19081908
std::string system_prompt;
19091909
std::string pre_prompt;
19101910
int repeat_last_n;
1911+
bool caching_enabled;
19111912
};
19121913
}; // namespace inferences

llama.cpp

0 commit comments

Comments
 (0)