This commit is contained in:
2026-02-01 17:57:16 +03:00
parent 3b4430086b
commit 56c4042539
3 changed files with 22 additions and 0 deletions

View File

@@ -16,6 +16,14 @@ OLLAMA_URL = "http://localhost:11434"
MODEL = "qwen3:14b"
DIR = Path(__file__).resolve().parent
# Параметры для стабильного структурированного вывода (JSON framework)
OLLAMA_OPTIONS = {
"temperature": 0.3, # ниже = детерминированнее, меньше «творчества» и смены языка
"num_ctx": 8500, # контекст под длинную главу
"num_predict": 4096, # лимит токенов ответа под полный frame
"repeat_penalty": 1.1,
}
def load_input() -> dict:
with open(DIR / "вход_главы.json", encoding="utf-8") as f:
@@ -49,6 +57,7 @@ def call_ollama(prompt: str) -> str:
"messages": [{"role": "user", "content": prompt}],
"stream": False,
"format": "json",
"options": OLLAMA_OPTIONS,
},
ensure_ascii=False,
).encode("utf-8")