oc_chat
Loading...
Searching...
No Matches
cache_usage.py
Go to the documentation of this file.
1#!/usr/bin/env python3
2# -*- coding: utf-8 -*-
3# providers/deepseek/cache_usage.py
4
5"""
6Re-export of the shared cache-extraction helpers.
7
8Purpose
9-------
10The actual implementation lives in :mod:`option_c_agent_contracts.cache_usage`
11— it's a neutral default that handles both DeepSeek's
12``prompt_cache_hit_tokens`` / ``prompt_cache_miss_tokens`` fields
13and the OpenAI-style ``prompt_tokens_details.cached_tokens``
14fallback.
15
16This module exists so DeepSeek-specific code (the provider plugin)
17has a local symbol it can import while still sharing the same
18default implementation. Providers whose usage shapes differ
19override ``parse_usage`` directly and never import from here.
20
21Responsibilities
22----------------
23- Re-export :func:`usage_prompt_cache_hit_miss` and
24 :func:`cache_hit_ratio_pct` from :mod:`option_c_agent_contracts.cache_usage`.
25
26Diagnostics
27-----------
28Domain: OC_CHAT.CLIENT
29Levels:
30 L2 — lifecycle events
31 L3 — semantic details
32 L4 — deep tracing
33
34Contracts
35---------
36- This module has no logic of its own — re-imports only.
37- The re-exported symbols are kept stable for the DeepSeek bundle's
38 internal callers; future moves of the shared implementation must
39 preserve the local import path.
40
41Dependencies
42------------
43- oc_diagnostics (structured debug logging via _dbg)
44- option_c_agent_contracts (usage_prompt_cache_hit_miss and cache_hit_ratio_pct, re-exported for the DeepSeek bundle)
45"""
46from oc_diagnostics import _dbg
47
48from option_c_agent_contracts import ( # noqa: F401
49 usage_prompt_cache_hit_miss,
50 cache_hit_ratio_pct,
51)
52
53_dbg("OC_CHAT.CLIENT", "module", "loaded", 4)