oc_chat
Loading...
Searching...
No Matches
models.py
Go to the documentation of this file.
1#!/usr/bin/env python3
2# -*- coding: utf-8 -*-
3# providers/example/models.py
4
5"""
6Example provider model registry — typed.
7
8Purpose
9-------
10:data:`MODELS` is the canonical, single-source-of-truth registry of
11example "models" with their capabilities. Each entry is a fake; the
12:class:`ExampleClient` does not actually call any of them.
13
14:data:`TIER_MAP` records the semantic-tier → model-id mapping that
15:meth:`ExampleProvider.tier` returns. ``step_routing.py`` reads it
16via ``provider.tier("cheap")`` / ``provider.tier("reasoning")``.
17
18When copying this bundle for a real provider, replace the entries
19here with the provider's actual models and add any additional
20capability flags the provider needs.
21
22Responsibilities
23----------------
24- :data:`MODELS` — minimal ``dict[str, ModelCaps]`` with two
25 entries: ``example-echo`` (no thinking) and ``example-reasoning``
26 (thinking enabled).
27- :data:`TIER_MAP` — semantic-tier lookup for the four tiers
28 ``default`` / ``cheap`` / ``reasoning`` / ``summary``.
29
30Diagnostics
31-----------
32Domain: OC_CHAT.CLIENT
33Levels:
34 L2 — lifecycle events
35 L3 — semantic details
36 L4 — deep tracing
37
38Contracts
39---------
40- ``MODELS`` keys are arbitrary stub names (no API equivalence).
41- ``TIER_MAP`` values must reference keys in ``MODELS``.
42- The dataclass is immutable; capability changes mean editing this
43 file rather than mutating at runtime.
44
45Dependencies
46------------
47- oc_diagnostics (structured debug logging via _dbg)
48- option_c_agent_contracts (ModelCaps capability record for each model)
49"""
50from __future__ import annotations
51
52from oc_diagnostics import _dbg
53
54from option_c_agent_contracts import ModelCaps
55
56_dbg("OC_CHAT.CLIENT", "module", "loaded", 4)
57
58
59MODELS: dict[str, ModelCaps] = {
60 "example-echo": ModelCaps(supports_thinking=False, supports_reasoning=False, supports_tools=True, max_context_tokens=4096),
61 "example-reasoning": ModelCaps(supports_thinking=True, supports_reasoning=True, supports_tools=True, max_context_tokens=4096),
62}
63
64
65TIER_MAP: dict[str, str] = {
66 "default": "example-echo",
67 "cheap": "example-echo",
68 "reasoning": "example-reasoning",
69 "summary": "example-echo",
70}
71
72
73__all__ = ["MODELS", "TIER_MAP"]