Skip to content

feat(chat): Open WebUI Function for provider-agnostic Langfuse tracing - #37

Merged
SushantGautam merged 8 commits into
mainfrom
release/0.5.14
Oct 13, 2026
Merged

SushantGautam merged 8 commits into
mainfrom
release/0.5.14

Conversation

@SushantGautam

Copy link
Copy Markdown
Collaborator

Problem

Tracing chat to Langfuse via the pipelines stub required either pointing a connection's base URL at the stub (only traces that one OpenAI-compatible connection) or running the full open-webui/pipelines sidecar — neither of which is "trace everything without touching my connections."

What this does

Adds the bundled Studio Langfuse Capture filter function (chat/openwebui_functions/studio_langfuse_capture.py). Open WebUI Functions run inside OWUI's own backend, so:

  • All connections traced — OpenAI, Anthropic-compatible, local models; no base URL changes
  • No extra containers — no pipelines sidecar (its own README recommends Functions over Pipelines for basic filters)
  • Pure tap — posts request → /filter/inlet before the model call, reply → /filter/outlet after; payloads return untouched
  • Fail-safe — any tracing error is swallowed; chat never breaks

Setup: paste the file into Open WebUI admin → Functions, set its pipelines_url valve to the studio service base (e.g. http://helsedir-studio:9099). Stub side stays SIMPLEAUDIT_PIPELINES=on + the three LANGFUSE_* vars.

Smoke-tested both endpoints against the running stub with function-shaped payloads (200, body passed through unchanged).

Docs: docs/chat.md now lists this as the recommended wiring.

SushantGautam and others added 8 commits October 13, 2026 18:34
Also fixes the missed bump from the 0.5.13 release (pyproject was
still at 0.5.12).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The pipelines stub's filter seam already traced chat without touching
providers, but wiring it required either changing a connection's base URL
(connection mode) or running the full open-webui/pipelines sidecar. Add the
bundled 'Studio Langfuse Capture' filter function instead: it runs inside
Open WebUI's own backend, fires on every chat turn for every connection
(OpenAI, Anthropic-compatible, local), and pure-taps inlet/outlet to the
stub. No base URL changes, no extra containers, tracing failures never
break chat. Smoke-tested against the running stub.

docs/chat.md now presents this as the recommended wiring (the official
Pipelines README itself recommends Functions over Pipelines for basic
filters).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
No manual Open WebUI step: push_now() now also installs (or updates when the
bundled file changed) 'Studio Langfuse Capture' via Open WebUI's functions API,
granting access to all users. Runs at startup and after each connection
change; idempotent (content compared, only pushed when changed); best-effort
and never raises, so tracing can't block connection sync or startup. The
startup report line includes the tracing outcome.

Default target is http://helsedir-studio:9099 (studio container name on the
shared Docker network); override with STUDIO_PIPELINES_URL or the function's
pipelines_url valve.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The functions endpoints require id/name/content/meta on both create
and update, and function ids allow only alphanumerics and underscores:
use a stable slug id, send meta {}, and drop the redundant access-rights
call (new functions are active for all users by default). Verified
against a running Open WebUI instance.
The bundled default pointed at the Azure container name, which never
resolves on a dev machine — every tap failed silently. Probe the
container hostname at load time and fall back to loopback; explicit
STUDIO_PIPELINES_URL still wins.
The subpath Open WebUI build requests /chat/static/favicon.png, which
Caddy rewrote to a nonexistent static/favicon.png (only logo.png existed),
so the tab icon 404'd. Ship a 64x64 PNG derived from the logo.
@SushantGautam
SushantGautam merged commit 0dac742 into main Oct 13, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant