diff --git a/docs/platform/llm-server/ai/GNAI-022-TECH_OpenWebUI-DeepResearch.md b/docs/platform/llm-server/ai/GNAI-022-TECH_OpenWebUI-DeepResearch.md index b9c8991..2f9a38a 100644 --- a/docs/platform/llm-server/ai/GNAI-022-TECH_OpenWebUI-DeepResearch.md +++ b/docs/platform/llm-server/ai/GNAI-022-TECH_OpenWebUI-DeepResearch.md @@ -131,6 +131,19 @@ nach OWUI-v0.13.3 Reserved-Args (`user_prompt` lesen, History cappen). - Rate-Limit-Doku und LLM-Metriken im Monitoring bleiben M6-Restpunkte (GNAI-001 M6). +## 5a. Befunde aus dem ersten Live-Test (14.11.2026) + +- **Fehler `"queries"` in der Pipe:** die Prompts enthielten JSON-Beispiele + (`{"queries": …}`) und wurden per `str.format()` gerendert — die Braces + kollidierten mit Format-Feldern (KeyError). Fix: `.replace("{qpr}", …)`; + neuer sha256-Pin `5ddb6191…`. Non-Streaming-Pfad fängt Exceptions jetzt ab + und meldet sie als Text. +- **HTTP 500 `GET /ollama/api/version` beim Öffnen der Modellliste:** v0.13.3 + ruft den Ollama-Endpoint mit `ENABLE_OLLAMA_API=True` (Default) — ohne + Ollama auf dem Host 500. Fix: `ENABLE_OLLAMA_API=False` in `open_webui_env`. +- Verifiziert nach Redeploy: function-Content in DB sha256 `5ddb6191…`, + `ENABLE_OLLAMA_API=False` im Container, Playbook idempotent `changed=0`. + ## 6. Sicherheit - Pipe-Code läuft serverseitig in OpenWebUI (OWUI-Warnung: Functions sind diff --git a/llm-server/llm/ansible/roles/open_webui/defaults/main.yml b/llm-server/llm/ansible/roles/open_webui/defaults/main.yml index 6dd9a9f..200f90b 100644 --- a/llm-server/llm/ansible/roles/open_webui/defaults/main.yml +++ b/llm-server/llm/ansible/roles/open_webui/defaults/main.yml @@ -39,7 +39,7 @@ open_webui_web_search_tool_id: gnai-web-search # sha256 (recompute after every edit of files/gnai-deep-research-pipe.py: # sha256sum files/gnai-deep-research-pipe.py). open_webui_deep_research_function_id: gnai-deep-research -open_webui_deep_research_pipe_sha256: "1458b6a91b0aa159954e58318e3d263726e743b3c4d6088cadfe26c40a2400d7" +open_webui_deep_research_pipe_sha256: "5ddb6191c7e94789d2e1bf33b775092a38d6fe5c5762653d07084dcc58a9b677" open_webui_deep_research_valves: ENGINE_BASE_URL: "{{ open_webui_engine_base_url }}" ENGINE_MODEL_ID: "{{ open_webui_engine_model_id }}" @@ -115,6 +115,9 @@ open_webui_env: # existed only in legacy versions and is gone in v0.13.3. ENABLE_WEB_SEARCH: "True" WEB_SEARCH_ENGINE: searxng + # No Ollama on this host: without this the UI calls /ollama/api/version on + # every model-list open and surfaces HTTP 500 "could not connect to Ollama". + ENABLE_OLLAMA_API: "False" # v0.13.3 strips any query string from the URL and sends q/format=json # itself (retrieval/web/searxng.py), so the placeholder form is # correct. diff --git a/llm-server/llm/ansible/roles/open_webui/files/gnai-deep-research-pipe.py b/llm-server/llm/ansible/roles/open_webui/files/gnai-deep-research-pipe.py index d66a56c..d9cbde0 100644 --- a/llm-server/llm/ansible/roles/open_webui/files/gnai-deep-research-pipe.py +++ b/llm-server/llm/ansible/roles/open_webui/files/gnai-deep-research-pipe.py @@ -21,22 +21,24 @@ except ImportError: # pragma: no cover - bs4 ist im OpenWebUI-Image vorhanden BeautifulSoup = None +# NOTE: no str.format() on these prompts — the JSON braces {"queries": ...} +# would be parsed as format fields (KeyError). Use .replace() for {qpr}. PLANNER_SYSTEM = ( "You are a research planner. Given the user's research question and the " - "conversation so far, produce a JSON object {\"queries\": [str, ...]} with " - "up to {qpr} concrete, diverse web search queries (English and the user's " - "language). Answer with JSON only, no prose." + "conversation so far, produce a JSON object with key \"queries\" holding a " + "list of up to {qpr} concrete, diverse web search queries (English and the " + "user's language). Answer with JSON only, no prose." ) SYNTH_SYSTEM = ( "You are a research analyst. You receive search results and fetched page " "excerpts, each tagged with a citation number [n]. Decide whether the " "material answers the user's research question.\n" - "If more research is needed, answer JSON only: " - "{\"status\": \"continue\", \"next_queries\": [str, ...]} with up to {qpr} " - "follow-up queries that close the gaps.\n" - "If done, answer JSON only: {\"status\": \"done\", \"report\": \"\"}.\n" + "If more research is needed, answer JSON only with keys \"status\" = " + "\"continue\" and \"next_queries\" = list of up to {qpr} follow-up queries " + "that close the gaps.\n" + "If done, answer JSON only with keys \"status\" = \"done\" and \"report\" = " + "markdown report in the user's language, citing claims with [n] markers.\n" "Never invent citations; only use numbers of sources actually provided." ) @@ -241,7 +243,7 @@ class Pipe: # 1) planen (Runde 1) bzw. Luecken schliessen (Folgerunden) if round_no == 1 or not queries: plan_msgs = [ - {"role": "system", "content": PLANNER_SYSTEM.format(qpr=v.QUERIES_PER_ROUND)}, + {"role": "system", "content": PLANNER_SYSTEM.replace("{qpr}", str(v.QUERIES_PER_ROUND))}, *history, {"role": "user", "content": f"Research question: {question}"}, ] @@ -279,7 +281,7 @@ class Pipe: # 4) synthetisieren / Luecken bewerten synth_msgs = [ - {"role": "system", "content": SYNTH_SYSTEM.format(qpr=v.QUERIES_PER_ROUND)}, + {"role": "system", "content": SYNTH_SYSTEM.replace("{qpr}", str(v.QUERIES_PER_ROUND))}, *history, {"role": "user", "content": f"Research question: {question}\n\nSearch-result snippets:\n{snippets}\n\nFetched pages:\n{findings}"}, ] @@ -302,7 +304,7 @@ class Pipe: # Max-Iterationen erreicht: trotzdem ein Report aus dem akkumulierten Material if sources: final_msgs = [ - {"role": "system", "content": SYNTH_SYSTEM.format(qpr=0)}, + {"role": "system", "content": SYNTH_SYSTEM.replace("{qpr}", "0")}, *history, {"role": "user", "content": f"Research question: {question}\n\nAccumulated sources (iteration limit reached, write the best possible report now):\n" + "\n\n".join( f"[{s['n']}] {s['title']} ({s['url']})" for s in sources @@ -321,6 +323,9 @@ class Pipe: return run() # non-streaming: Generator konsumieren und als eine Completion zurückgeben chunks: list[str] = [] - async for chunk in run(): - chunks.append(chunk) + try: + async for chunk in run(): + chunks.append(chunk) + except Exception as e: + return f"Deep-Research-Fehler: {type(e).__name__}: {e}" return "".join(chunks)