fix(llm): kein Fallback auf Textmodell bei Vision-Anfragen
Wenn qwen3-vl:32b timeout hat, wurde bisher auf qwen2.5:14b (Textmodell) zurueckgefallen. Das kann keine Bilder sehen und halluziniert stattdessen. Jetzt: allow_fallback=False fuer Vision und klare Fehlermeldung bei Timeout.
This commit is contained in:
parent
ac0f6fda2e
commit
92898a33e3
1 changed files with 9 additions and 2 deletions
|
|
@ -525,7 +525,8 @@ def ask_with_image(image_base64: str, caption: str, tool_handlers: dict, session
|
||||||
try:
|
try:
|
||||||
for _round in range(MAX_TOOL_ROUNDS):
|
for _round in range(MAX_TOOL_ROUNDS):
|
||||||
data = _call_api(messages, api_key, use_tools=True,
|
data = _call_api(messages, api_key, use_tools=True,
|
||||||
model=MODEL_VISION, max_tokens=4000)
|
model=MODEL_VISION, max_tokens=4000,
|
||||||
|
allow_fallback=False)
|
||||||
choice = data["choices"][0]
|
choice = data["choices"][0]
|
||||||
msg = choice["message"]
|
msg = choice["message"]
|
||||||
|
|
||||||
|
|
@ -561,8 +562,14 @@ def ask_with_image(image_base64: str, caption: str, tool_handlers: dict, session
|
||||||
})
|
})
|
||||||
|
|
||||||
data = _call_api(messages, api_key, use_tools=False,
|
data = _call_api(messages, api_key, use_tools=False,
|
||||||
model=MODEL_VISION, max_tokens=4000)
|
model=MODEL_VISION, max_tokens=4000,
|
||||||
|
allow_fallback=False)
|
||||||
return data["choices"][0]["message"]["content"]
|
return data["choices"][0]["message"]["content"]
|
||||||
|
|
||||||
|
except requests.exceptions.ReadTimeout:
|
||||||
|
return (
|
||||||
|
"Das Vision-Modell antwortet nicht (Timeout). "
|
||||||
|
"Bitte in 1-2 Min erneut versuchen — das Modell wird gerade geladen."
|
||||||
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return f"Vision-LLM-Fehler: {e}"
|
return f"Vision-LLM-Fehler: {e}"
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue