fix(ai): configure OLLAMA_KEEP_ALIVE=5m to automatically release RAM after inactivity
This commit is contained in:
1 parent
03c692fe43
commit
3b1cb85ba2
4 files changed
+8
-5
No files matched your search
@@ -251,7 +251,7 @@ async def translate_sentence_ai(
|
||||
"prompt": prompt,
|
||||
"stream": False,
|
||||
"format": "json",
|
||||
"keep_alive": "24h",
|
||||
"keep_alive": config.OLLAMA_KEEP_ALIVE,
|
||||
"options": {
|
||||
"temperature": 0.2,
|
||||
"num_predict": 300,
|
||||
@@ -367,10 +367,10 @@ async def warmup_ollama_model() -> bool:
|
||||
client = get_ollama_client()
|
||||
resp = await client.post(
|
||||
f"{config.OLLAMA_BASE_URL}/api/generate",
|
||||
json={"model": config.OLLAMA_MODEL, "keep_alive": "24h"},
|
||||
json={"model": config.OLLAMA_MODEL, "keep_alive": config.OLLAMA_KEEP_ALIVE},
|
||||
)
|
||||
if resp.status_code == 200:
|
||||
logger.info(f"Ollama model '{config.OLLAMA_MODEL}' warmed up successfully (keep_alive=24h).")
|
||||
logger.info(f"Ollama model '{config.OLLAMA_MODEL}' warmed up successfully (keep_alive={config.OLLAMA_KEEP_ALIVE}).")
|
||||
return True
|
||||
else:
|
||||
logger.warning(f"Ollama warmup returned HTTP {resp.status_code}: {resp.text}")
|
||||
@@ -567,7 +567,7 @@ async def generate_lesson_ai_debrief(
|
||||
"prompt": prompt,
|
||||
"stream": False,
|
||||
"format": "json",
|
||||
"keep_alive": "24h",
|
||||
"keep_alive": config.OLLAMA_KEEP_ALIVE,
|
||||
"options": {
|
||||
"temperature": 0.3,
|
||||
"num_predict": 450,
|
||||
|
||||
Reference in new issue
Block a user