oc_chat
Loading...
Searching...
No Matches
providers.deepseek.provider Namespace Reference

Classes

class  DeepSeekProvider

Variables

str _DEFAULT_BASE_URL = "https://api.deepseek.com"
str TOOL_SCHEMA_SENTINEL = "<!--dc:embedded-tool-schemas-->"

Detailed Description

DeepSeek provider implementation.

Purpose
-------
Concrete :class:`oc_chat.core.provider_plugin.ProviderPlugin` for the
DeepSeek API. Encapsulates everything provider-specific: client
construction, the model/tier registry, the ``extra_body`` shape for
thinking, the prefix-cache sentinel embedding, and prompt-cache
hit/miss extraction.

Importing the parent package (``import providers.deepseek``) triggers
self-registration via ``DeepSeekProvider.register()``. The rest of
the app retrieves it via
``oc_chat.core.provider_plugin.registry.get("deepseek")``.

Responsibilities
----------------
- :class:`DeepSeekProvider` — implement every abstract method on
  :class:`ProviderPlugin` for DeepSeek.
- :meth:`build_client` — construct a :class:`DeepSeekClient` with
  the supplied API key and base URL.
- :meth:`build_extra_body` — produce the
  ``{"thinking": {"type": "enabled"}}`` shape when the target model
  supports thinking.
- :meth:`transform_outgoing_messages` — deprecated no-op since plan 135
  (the dump is gone; ``render_request`` is the seam now).
- :meth:`parse_usage` — convert raw usage dicts to :class:`UsageStats`
  via the shared cache-hit/miss helper.
- :meth:`tier` / :meth:`models` — expose the static registries.
- :meth:`fetch_live_models` — list live models, dropping retired ids.
- :meth:`migrate_model_id` — map a retired alias to its V4 replacement
  for saved-session migration (plan 135 §4.6).

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

Contracts
---------
- ``transform_outgoing_messages`` returns its input unchanged (plan 135
  neutered the dump; it must never re-embed).
- ``build_extra_body`` returns ``None`` for models whose ``ModelCaps``
  do not advertise ``supports_thinking``.
- ``tier`` returns ``None`` (not a model id) when the requested tier
  is not in :data:`TIER_MAP`.
- ``migrate_model_id`` returns ``None`` for live ids; for a retired alias
  it returns ``(replacement, notice)`` with a distinct per-alias target.
- All abstract surface lives here; the bundle's other modules are
  pure data / SDK plumbing.

Dependencies
------------
- oc_diagnostics (structured debug logging via _dbg)
- option_c_agent_contracts (ProviderPlugin base class and the ModelCaps, UsageStats and BaseClient types)
- providers.deepseek.client (DeepSeekClient returned by build_client)
- providers.deepseek.cache_usage (prompt-cache hit and miss extraction for parse_usage)
- providers.deepseek.models (MODELS, TIER_MAP and RETIRED_ALIASES registries)

Variable Documentation

◆ _DEFAULT_BASE_URL

str providers.deepseek.provider._DEFAULT_BASE_URL = "https://api.deepseek.com"
protected

Definition at line 86 of file provider.py.

◆ TOOL_SCHEMA_SENTINEL

str providers.deepseek.provider.TOOL_SCHEMA_SENTINEL = "<!--dc:embedded-tool-schemas-->"

Definition at line 94 of file provider.py.