oc_chat
Loading...
Searching...
No Matches
providers.example Namespace Reference

Namespaces

namespace  client
namespace  models
namespace  provider

Detailed Description

Example provider bundle — minimal working template.

Purpose
-------
Importing this package registers :class:`ExampleProvider` into the
module-level registry at ``oc_chat.core.provider_plugin.registry``.
The rest of the app then retrieves it via ``registry.get("example")``.

This bundle is intentionally tiny: it returns deterministic stubbed
responses ("echo: <last user message>") so it can run *without any
SDK or network access*. It still uses canonical Option C tooling
(``oc_diagnostics`` for ``_dbg``) — no provider bundle is exempt
from project-wide diagnostics coverage.

Use it as:

* A copy template when starting a new provider — every required file
  is present, every abstract method is implemented with the simplest
  possible body, and DeepSeek-specific quirks (prefix-cache sentinel,
  ``extra_body.thinking`` shape, ``OrderedDict`` payload ordering)
  are documented in comments rather than baked in.
* A test harness — integration tests that need a working
  :class:`ProviderPlugin` without hitting a real API can ``import
  providers.example`` and select it via ``OC_CHAT_PROVIDER=example``.
  This is the H.2c ``MockProviderPlugin``.

See ``providers/README.md`` for the full bundle layout reference and
``providers/example/README.md`` for the per-step "make it your own"
recipe.

Responsibilities
----------------
- Self-register :class:`ExampleProvider` on import.
- Re-export :class:`ExampleProvider` for direct access.

Diagnostics
-----------
Domain: OC_CHAT.CLIENT
Levels:
    L2 — lifecycle events
    L3 — semantic details
    L4 — deep tracing

Contracts
---------
- Side effect on import: ``ExampleProvider.register()`` runs once.
- The bundle must remain *SDK-free* and *network-free* so it works
  as a fast test harness. Importing ``oc_diagnostics`` is fine —
  it's first-party Option C tooling, not a foreign dependency.
- ``__all__`` exposes only the provider class.

Dependencies
------------
- oc_diagnostics (structured debug logging via _dbg)
- providers.example.provider (ExampleProvider, registered and re-exported on import)