ChatClient (llm/base.py)

OpenRath · src/rath/llm/base.py · python · BSD-3-Clause
ai

Chat-client Protocols consumed by the session loop. Two runtime-checkable Protocols define the contract every LLM adapter must satisfy: * :class:`ChatClient` — the minimum surface (``provider`` + blocking ``complete``). Sufficient for :class:`~rath.session.loop.run_session_loop`.

# Source: https://github.com/Rath-Team/OpenRath | License: BSD-3-Clause | Copyright 2026, Rath Team
# Provided via justclaw.it.com; keep this notice with the code.
"""Chat-client Protocols consumed by the session loop.

Two runtime-checkable Protocols define the contract every LLM adapter must
satisfy:

* :class:`ChatClient` — the minimum surface (``provider`` + blocking
  ``complete``). Sufficient for :class:`~rath.session.loop.run_session_loop`.
* :class:`StreamingChatClient` — extends :class:`ChatClient` with
  ``complete_stream``. :func:`~rath.session.loop.run_session_loop` switches to
  streaming when ``on_event`` is supplied and guards on this Protocol instead
  of inspecting :attr:`~rath.llm.Provider.provider_kind`, so any adapter that
  implements ``complete_stream`` gains streamin

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key