发布

  • feat: backend connection overrides; extra_headers on every local door (#411)

    frostbyte_neo 发布于 2026-08-17 09:34:19 +00:00

    • feat: backend connection overrides; extra_headers on every local door

    Two clients, two configs — the gap this closes. index_backend /
    chat_backend on the constructor (and per-call backend on the chat
    doors, mirroring per-call model) carry connection params in each
    lane's own vocabulary, verbatim: the indexing gateways take the dict
    as LiteLLM call kwargs (a contextvar scopes it per operation, and the
    env-var key pre-check yields to it), the chat lane lifts api_key /
    base_url into LitellmModel's two pinned constructor slots and rides
    the rest as call kwargs, responses() and messages() hand the dict to
    their SDK client constructors. Per-call keys win over the client's;
    the openai-SDK fast path normalizes LiteLLM's api_base spelling.
    Config bundles deliberately don't carry it — you run those in your
    own environment (docstring says so).

    extra_headers lands on all three protocol doors, each engine merging
    caller headers verbatim (anthropic-beta wire-proven on messages).
    Wire-probed exception, documented on the chat door: LiteLLM's
    anthropic adapter owns the anthropic-beta header and drops the
    caller's value — Anthropic beta flags belong on messages(). Cloud
    rejects the new knobs like the other local-only params, and the
    docstrings now say credentials belong in backend, never extra_body
    (on the bare lane they would leak into the JSON body without
    touching auth — wire-probed).

    • docs: constructor Args list gains index_backend / chat_backend

    The class docstring documents every constructor argument; the backend
    wave added two without entries. Same phrasing as the per-call docs:
    index lane is LiteLLM vocabulary verbatim, chat_backend reaches
    whichever door runs (api_key/base_url portable across all three).

    • chore: three audit leftovers

    The classic pipeline's ThreadPoolExecutor import (unused since the
    0.2.9 merge) goes. The bare-model missing-key error now also names
    the backend={'api_key': ...} route, which satisfies the same check.
    messages() joins the uniform: a bad backend dict wraps as
    PageIndexAPIError like the responses door, instead of leaking the
    SDK's raw constructor error.

    • chore: narrow the anthropic wrap to TypeError; key advice names chat_backend

    Anthropic's constructor raises only TypeError in our supported range
    (unknown kwargs, conflicting credentials) — a missing key defers to
    request time, so catching AnthropicError there guarded an impossible
    case. And chat() has no backend parameter, so the missing-key advice
    now names chat_backend alongside the per-call route.

    下载附件