aboutsummaryrefslogtreecommitdiff
path: root/main.py
diff options
context:
space:
mode:
Diffstat (limited to 'main.py')
-rw-r--r--main.py13
1 files changed, 4 insertions, 9 deletions
diff --git a/main.py b/main.py
index 74533f5..ad5dc4f 100644
--- a/main.py
+++ b/main.py
@@ -4,13 +4,13 @@ import json
import re # thank you claude
import ollama
import websockets
+from pathlib import Path
from websockets.server import serve
from datetime import datetime
chatmodel = "hf.co/Stetsoncody/Llama-3.2-3B-Instruct-abliterated-GGUF:Q4_K_M"
embedmodel = 'hf.co/CompendiumLabs/bge-base-en-v1.5-gguf'
-NUM_THREADS = 6 # hardcoded since threads.txt is gone, change if needed
def times() -> str:
return datetime.now().strftime("%Y-%m-%d %H:%M:%S")
@@ -151,17 +151,12 @@ async def ollamachat(websocket):
messages.insert(0, {"role": "system", "content": system_prompt + rag_block})
+ params = json.loads(Path("config/params.json").read_text())
+
response = ollama.chat(
model=chatmodel,
messages=messages,
- options={
- "temperature": 0.83,
- "top_p": 0.9,
- "top_k": 40,
- "repeat_penalty": 1.1,
- "num_predict": 1024,
- "num_thread": NUM_THREADS,
- }
+ options=params,
)
# strip <think> blocks in case the model ignores think=False, thank you claude