| 1 |
from typing import Union, Optional |
| 2 |
from typing_extensions import Annotated, TypeAlias |
| 3 |
|
| 4 |
from ..._models import BaseModel, UnionDiscriminator |
| 5 |
from .beta_cache_miss_unavailable import BetaCacheMissUnavailable |
| 6 |
from .beta_cache_miss_model_changed import BetaCacheMissModelChanged |
| 7 |
from .beta_cache_miss_tools_changed import BetaCacheMissToolsChanged |
| 8 |
from .beta_cache_miss_system_changed import BetaCacheMissSystemChanged |
| 9 |
from .beta_cache_miss_messages_changed import BetaCacheMissMessagesChanged |
| 10 |
from .beta_cache_miss_previous_message_not_found import BetaCacheMissPreviousMessageNotFound |
| 11 |
|
| 12 |
__all__ = ["BetaDiagnostics", "CacheMissReason"] |
| 13 |
|
| 14 |
CacheMissReason: TypeAlias = Annotated[ |
| 15 |
Union[ |
| 16 |
BetaCacheMissModelChanged, |
| 17 |
BetaCacheMissSystemChanged, |
| 18 |
BetaCacheMissToolsChanged, |
| 19 |
BetaCacheMissMessagesChanged, |
| 20 |
BetaCacheMissPreviousMessageNotFound, |
| 21 |
BetaCacheMissUnavailable, |
| 22 |
None, |
| 23 |
], |
| 24 |
UnionDiscriminator("type"), |
| 25 |
] |
| 26 |
|
| 27 |
|
| 28 |
class BetaDiagnostics(BaseModel): |
| 29 |
""" |
| 30 |
Request-level diagnostics: why the prompt cache could not fully reuse |
| 31 |
the prefix of the request named by `diagnostics.previous_message_id`. |
| 32 |
""" |
| 33 |
|
| 34 |
cache_miss_reason: Optional[CacheMissReason] = None |
| 35 |
""" |
| 36 |
Explains why the prompt cache could not fully reuse the prefix from the request |
| 37 |
identified by `diagnostics.previous_message_id`. `null` means diagnosis is still |
| 38 |
pending — the response was serialized before the background comparison |
| 39 |
completed. |
| 40 |
""" |