@@ -135,7 +135,7 @@ def __init__(self, ld_client: LDClient, version_key: str, config_key: str, conte
135
135
self .config_key = config_key
136
136
self .context = context
137
137
138
- def get_track_data (self ):
138
+ def __get_track_data (self ):
139
139
"""
140
140
Get tracking data for events.
141
141
@@ -152,7 +152,7 @@ def track_duration(self, duration: int) -> None:
152
152
153
153
:param duration: Duration in milliseconds.
154
154
"""
155
- self .ld_client .track ('$ld:ai:duration:total' , self .context , self .get_track_data (), duration )
155
+ self .ld_client .track ('$ld:ai:duration:total' , self .context , self .__get_track_data (), duration )
156
156
157
157
def track_duration_of (self , func ):
158
158
"""
@@ -175,15 +175,15 @@ def track_feedback(self, feedback: Dict[str, FeedbackKind]) -> None:
175
175
:param feedback: Dictionary containing feedback kind.
176
176
"""
177
177
if feedback ['kind' ] == FeedbackKind .Positive :
178
- self .ld_client .track ('$ld:ai:feedback:user:positive' , self .context , self .get_track_data (), 1 )
178
+ self .ld_client .track ('$ld:ai:feedback:user:positive' , self .context , self .__get_track_data (), 1 )
179
179
elif feedback ['kind' ] == FeedbackKind .Negative :
180
- self .ld_client .track ('$ld:ai:feedback:user:negative' , self .context , self .get_track_data (), 1 )
180
+ self .ld_client .track ('$ld:ai:feedback:user:negative' , self .context , self .__get_track_data (), 1 )
181
181
182
182
def track_success (self ) -> None :
183
183
"""
184
184
Track a successful AI generation.
185
185
"""
186
- self .ld_client .track ('$ld:ai:generation' , self .context , self .get_track_data (), 1 )
186
+ self .ld_client .track ('$ld:ai:generation' , self .context , self .__get_track_data (), 1 )
187
187
188
188
def track_openai (self , func ):
189
189
"""
@@ -224,8 +224,8 @@ def track_tokens(self, tokens: Union[TokenUsage, BedrockTokenUsage]) -> None:
224
224
"""
225
225
token_metrics = tokens .to_metrics ()
226
226
if token_metrics .total > 0 :
227
- self .ld_client .track ('$ld:ai:tokens:total' , self .context , self .get_track_data (), token_metrics .total )
227
+ self .ld_client .track ('$ld:ai:tokens:total' , self .context , self .__get_track_data (), token_metrics .total )
228
228
if token_metrics .input > 0 :
229
- self .ld_client .track ('$ld:ai:tokens:input' , self .context , self .get_track_data (), token_metrics .input )
229
+ self .ld_client .track ('$ld:ai:tokens:input' , self .context , self .__get_track_data (), token_metrics .input )
230
230
if token_metrics .output > 0 :
231
- self .ld_client .track ('$ld:ai:tokens:output' , self .context , self .get_track_data (), token_metrics .output )
231
+ self .ld_client .track ('$ld:ai:tokens:output' , self .context , self .__get_track_data (), token_metrics .output )
0 commit comments