@@ -176,7 +176,7 @@ def test_callback_simple_openai():
176176 llm .invoke (text , config = {"callbacks" : [handler ], "run_name" : test_name })
177177
178178 # Ensure data is flushed to API
179- handler .client .flush ()
179+ handler ._langfuse_client .flush ()
180180 sleep (2 )
181181
182182 # Retrieve trace
@@ -222,7 +222,7 @@ def test_callback_multiple_invocations_on_different_traces():
222222 handler2 = CallbackHandler ()
223223 llm .invoke (text , config = {"callbacks" : [handler2 ], "run_name" : test_name_2 })
224224
225- handler1 .client .flush ()
225+ handler1 ._langfuse_client .flush ()
226226
227227 # Ensure data is flushed to API
228228 sleep (2 )
@@ -281,7 +281,7 @@ def test_openai_instruct_usage():
281281 ]
282282 runnable_chain .batch (input_list )
283283
284- lf_handler .client .flush ()
284+ lf_handler ._langfuse_client .flush ()
285285
286286 observations = get_api ().trace .get (trace_id ).observations
287287
@@ -451,7 +451,7 @@ def test_link_langfuse_prompts_invoke():
451451 },
452452 )
453453
454- langfuse_handler .client .flush ()
454+ langfuse_handler ._langfuse_client .flush ()
455455 sleep (2 )
456456
457457 trace = get_api ().trace .get (trace_id = trace_id )
@@ -538,7 +538,7 @@ def test_link_langfuse_prompts_stream():
538538 for chunk in stream :
539539 output += chunk
540540
541- langfuse_handler .client .flush ()
541+ langfuse_handler ._langfuse_client .flush ()
542542 sleep (2 )
543543
544544 trace = get_api ().trace .get (trace_id = trace_id )
@@ -624,7 +624,7 @@ def test_link_langfuse_prompts_batch():
624624 },
625625 )
626626
627- langfuse_handler .client .flush ()
627+ langfuse_handler ._langfuse_client .flush ()
628628
629629 traces = get_api ().trace .list (name = trace_name ).data
630630
@@ -747,13 +747,13 @@ class GetWeather(BaseModel):
747747 }
748748 ]
749749
750- with handler .client .start_as_current_observation (
750+ with handler ._langfuse_client .start_as_current_observation (
751751 name = "test_callback_openai_functions_with_tools"
752752 ) as span :
753753 trace_id = span .trace_id
754754 llm .bind_tools ([address_tool , weather_tool ]).invoke (messages )
755755
756- handler .client .flush ()
756+ handler ._langfuse_client .flush ()
757757
758758 trace = get_api ().trace .get (trace_id = trace_id )
759759
@@ -846,11 +846,13 @@ def test_multimodal():
846846 ],
847847 )
848848
849- with handler .client .start_as_current_observation (name = "test_multimodal" ) as span :
849+ with handler ._langfuse_client .start_as_current_observation (
850+ name = "test_multimodal"
851+ ) as span :
850852 trace_id = span .trace_id
851853 model .invoke ([message ], config = {"callbacks" : [handler ]})
852854
853- handler .client .flush ()
855+ handler ._langfuse_client .flush ()
854856
855857 trace = get_api ().trace .get (trace_id = trace_id )
856858
@@ -935,14 +937,16 @@ def call_model(state: MessagesState):
935937 handler = CallbackHandler ()
936938
937939 # Use the Runnable
938- with handler .client .start_as_current_observation (name = "test_langgraph" ) as span :
940+ with handler ._langfuse_client .start_as_current_observation (
941+ name = "test_langgraph"
942+ ) as span :
939943 trace_id = span .trace_id
940944 final_state = app .invoke (
941945 {"messages" : [HumanMessage (content = "what is the weather in sf" )]},
942946 config = {"configurable" : {"thread_id" : 42 }, "callbacks" : [handler ]},
943947 )
944948 print (final_state ["messages" ][- 1 ].content )
945- handler .client .flush ()
949+ handler ._langfuse_client .flush ()
946950
947951 trace = get_api ().trace .get (trace_id = trace_id )
948952
@@ -975,7 +979,7 @@ def test_cached_token_usage():
975979 # invoke again to force cached token usage
976980 chain .invoke ({"test_param" : "in a funny way" }, config )
977981
978- handler .client .flush ()
982+ handler ._langfuse_client .flush ()
979983
980984 trace = get_api ().trace .get (handler .get_trace_id ())
981985
0 commit comments