gproxy_protocol/wire/openai/responses/
diagnostics.rs1use crate::Rest;
3use serde::{Deserialize, Serialize};
4
5#[derive(
6 Debug, Clone, PartialEq, Eq, Serialize, Deserialize, gproxy_protocol_macros::DeclaredFields,
7)]
8#[serde(tag = "type", rename_all = "snake_case")]
9#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
10#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
11pub enum PromptCacheDiagnostics {
12 CacheMiss(CacheMiss),
13 CacheHit(DiagnosticOutcome),
14 ComparisonResponseNotFound(DiagnosticOutcome),
15 Unavailable(DiagnosticOutcome),
16}
17
18#[derive(
19 Debug,
20 Clone,
21 PartialEq,
22 Eq,
23 Serialize,
24 Deserialize,
25 gproxy_protocol_macros::WireBuilder,
26 gproxy_protocol_macros::DeclaredFields,
27)]
28#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
29#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
30pub struct CacheMiss {
31 pub cache_missed_tokens: i64,
32 pub reason: CacheMissReason,
33 #[serde(skip_serializing_if = "Option::is_none")]
34 pub comparison_reusable_tokens: Option<i64>,
35 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
36 pub rest: Rest,
37}
38
39#[derive(
40 Debug,
41 Clone,
42 PartialEq,
43 Eq,
44 Serialize,
45 Deserialize,
46 gproxy_protocol_macros::WireBuilder,
47 gproxy_protocol_macros::DeclaredFields,
48)]
49#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
50#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
51pub struct DiagnosticOutcome {
52 #[serde(default, flatten, skip_serializing_if = "serde_json::Map::is_empty")]
53 pub rest: Rest,
54}
55
56#[derive(
57 Debug,
58 Clone,
59 Copy,
60 PartialEq,
61 Eq,
62 Serialize,
63 Deserialize,
64 gproxy_protocol_macros::DeclaredFields,
65)]
66#[serde(rename_all = "snake_case")]
67#[cfg_attr(not(feature = "exhaustive"), non_exhaustive)]
68#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
69pub enum CacheMissReason {
70 ModelChanged,
71 PromptCacheKeyChanged,
72 ServiceTierChanged,
73 ToolsChanged,
74 TextFormatChanged,
75 ReasoningEffortChanged,
76 VerbosityChanged,
77 ContextCompacted,
78 InputChanged,
79}