File tree Expand file tree Collapse file tree 1 file changed +6
-9
lines changed
Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -173,14 +173,11 @@ def on_llm_end(
173173 "$ai_trace_id" : trace_id ,
174174 "$ai_posthog_properties" : self ._properties ,
175175 }
176- try :
177- self ._client .capture (
178- distinct_id = self ._distinct_id ,
179- event = "$ai_generation" ,
180- properties = event_properties ,
181- )
182- except Exception as e :
183- self .log .exception (f"Error capturing event: { e } " )
176+ self ._client .capture (
177+ distinct_id = self ._distinct_id or trace_id ,
178+ event = "$ai_generation" ,
179+ properties = event_properties ,
180+ )
184181
185182 def on_chain_error (
186183 self ,
@@ -219,7 +216,7 @@ def on_llm_error(
219216 "$ai_posthog_properties" : self ._properties ,
220217 }
221218 self ._client .capture (
222- distinct_id = self ._distinct_id ,
219+ distinct_id = self ._distinct_id or trace_id ,
223220 event = "$ai_generation" ,
224221 properties = event_properties ,
225222 )
You can’t perform that action at this time.
0 commit comments