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
"""
6
Re-export of the shared cache-extraction helpers.
7
8
Purpose
9
-------
10
The 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
13
and the OpenAI-style ``prompt_tokens_details.cached_tokens``
14
fallback.
15
16
This module exists so DeepSeek-specific code (the provider plugin)
17
has a local symbol it can import while still sharing the same
18
default implementation. Providers whose usage shapes differ
19
override ``parse_usage`` directly and never import from here.
20
21
Responsibilities
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
26
Diagnostics
27
-----------
28
Domain: OC_CHAT.CLIENT
29
Levels:
30
L2 — lifecycle events
31
L3 — semantic details
32
L4 — deep tracing
33
34
Contracts
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
41
Dependencies
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
"""
46
from
oc_diagnostics
import
_dbg
47
48
from
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)
providers
deepseek
cache_usage.py
Generated by
1.15.0