mail: Klassifizierung von OpenRouter auf lokales Ollama (qwen2.5:14b) umgestellt
This commit is contained in:
parent
14625424cf
commit
656037405d
1 changed files with 6 additions and 4 deletions
|
|
@ -259,12 +259,14 @@ def classify_mails(mails: list[dict], api_key: str) -> list[dict]:
|
||||||
for i, m in enumerate(mails)
|
for i, m in enumerate(mails)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
OLLAMA_URL = "http://100.84.255.83:11434/v1/chat/completions"
|
||||||
|
OLLAMA_MODEL = "qwen2.5:14b"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
r = _req.post(
|
r = _req.post(
|
||||||
"https://openrouter.ai/api/v1/chat/completions",
|
OLLAMA_URL,
|
||||||
headers={"Authorization": f"Bearer {api_key}"},
|
|
||||||
json={
|
json={
|
||||||
"model": "openai/gpt-4o-mini",
|
"model": OLLAMA_MODEL,
|
||||||
"messages": [
|
"messages": [
|
||||||
{"role": "system", "content": CLASSIFY_PROMPT},
|
{"role": "system", "content": CLASSIFY_PROMPT},
|
||||||
{"role": "user", "content": mail_text},
|
{"role": "user", "content": mail_text},
|
||||||
|
|
@ -272,7 +274,7 @@ def classify_mails(mails: list[dict], api_key: str) -> list[dict]:
|
||||||
"max_tokens": 2000,
|
"max_tokens": 2000,
|
||||||
"temperature": 0,
|
"temperature": 0,
|
||||||
},
|
},
|
||||||
timeout=60,
|
timeout=120,
|
||||||
)
|
)
|
||||||
r.raise_for_status()
|
r.raise_for_status()
|
||||||
content = r.json()["choices"][0]["message"]["content"]
|
content = r.json()["choices"][0]["message"]["content"]
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue