@@ -35,7 +35,7 @@ def test_supported_models(self):
3535
3636class TestGeminiProvider (BaseTest ):
3737 @override_settings (GEMINI_API_KEY = "test-api-key" )
38- @patch ("products.llm_analytics.backend.providers .gemini.genai.Client" )
38+ @patch ("posthoganalytics.ai .gemini.genai.Client" )
3939 @patch ("posthoganalytics.default_client" )
4040 def test_provider_initialization (self , mock_posthog_client , mock_genai_client ):
4141 mock_posthog_client .return_value = MagicMock ()
@@ -57,7 +57,7 @@ def test_missing_posthog_client_raises_error(self):
5757 GeminiProvider ("gemini-2.0-flash" )
5858
5959 @override_settings (GEMINI_API_KEY = "test-api-key" )
60- @patch ("products.llm_analytics.backend.providers .gemini.genai.Client" )
60+ @patch ("posthoganalytics.ai .gemini.genai.Client" )
6161 @patch ("posthoganalytics.default_client" )
6262 def test_invalid_model_raises_error (self , mock_posthog_client , mock_genai_client ):
6363 mock_posthog_client .return_value = MagicMock ()
@@ -74,7 +74,7 @@ def setUp(self):
7474 self .messages = cast (list [MessageParam ], [{"role" : "user" , "content" : "Test message" }])
7575
7676 @override_settings (GEMINI_API_KEY = "test-api-key" )
77- @patch ("products.llm_analytics.backend.providers .gemini.genai.Client" )
77+ @patch ("posthoganalytics.ai .gemini.genai.Client" )
7878 @patch ("posthoganalytics.default_client" )
7979 def test_basic_text_streaming (self , mock_posthog , mock_genai ):
8080 mock_posthog .return_value = self .mock_posthog_client
@@ -106,7 +106,7 @@ def mock_stream():
106106 assert json .loads (responses [1 ].replace ("data: " , "" ).strip ()) == {"type" : "text" , "text" : "world!" }
107107
108108 @override_settings (GEMINI_API_KEY = "test-api-key" )
109- @patch ("products.llm_analytics.backend.providers .gemini.genai.Client" )
109+ @patch ("posthoganalytics.ai .gemini.genai.Client" )
110110 @patch ("posthoganalytics.default_client" )
111111 def test_streaming_with_none_parts (self , mock_posthog , mock_genai ):
112112 mock_posthog .return_value = self .mock_posthog_client
@@ -136,7 +136,7 @@ def mock_stream():
136136 assert json .loads (responses [0 ].replace ("data: " , "" ).strip ()) == {"type" : "text" , "text" : "Test text" }
137137
138138 @override_settings (GEMINI_API_KEY = "test-api-key" )
139- @patch ("products.llm_analytics.backend.providers .gemini.genai.Client" )
139+ @patch ("posthoganalytics.ai .gemini.genai.Client" )
140140 @patch ("posthoganalytics.default_client" )
141141 def test_streaming_with_empty_parts (self , mock_posthog , mock_genai ):
142142 mock_posthog .return_value = self .mock_posthog_client
@@ -165,7 +165,7 @@ def mock_stream():
165165 assert len (responses ) == 0
166166
167167 @override_settings (GEMINI_API_KEY = "test-api-key" )
168- @patch ("products.llm_analytics.backend.providers .gemini.genai.Client" )
168+ @patch ("posthoganalytics.ai .gemini.genai.Client" )
169169 @patch ("posthoganalytics.default_client" )
170170 def test_streaming_with_function_calls (self , mock_posthog , mock_genai ):
171171 mock_posthog .return_value = self .mock_posthog_client
@@ -216,7 +216,7 @@ def mock_stream():
216216 assert json .loads (tool_response ["function" ]["arguments" ]) == {"location" : "San Francisco" }
217217
218218 @override_settings (GEMINI_API_KEY = "test-api-key" )
219- @patch ("products.llm_analytics.backend.providers .gemini.genai.Client" )
219+ @patch ("posthoganalytics.ai .gemini.genai.Client" )
220220 @patch ("posthoganalytics.default_client" )
221221 def test_streaming_with_text_in_parts (self , mock_posthog , mock_genai ):
222222 mock_posthog .return_value = self .mock_posthog_client
@@ -252,7 +252,7 @@ def mock_stream():
252252 assert json .loads (responses [0 ].replace ("data: " , "" ).strip ()) == {"type" : "text" , "text" : "Text from parts" }
253253
254254 @override_settings (GEMINI_API_KEY = "test-api-key" )
255- @patch ("products.llm_analytics.backend.providers .gemini.genai.Client" )
255+ @patch ("posthoganalytics.ai .gemini.genai.Client" )
256256 @patch ("posthoganalytics.default_client" )
257257 def test_streaming_with_mixed_parts (self , mock_posthog , mock_genai ):
258258 mock_posthog .return_value = self .mock_posthog_client
@@ -305,7 +305,7 @@ def mock_stream():
305305 assert tool_response ["function" ]["name" ] == "get_weather"
306306
307307 @override_settings (GEMINI_API_KEY = "test-api-key" )
308- @patch ("products.llm_analytics.backend.providers .gemini.genai.Client" )
308+ @patch ("posthoganalytics.ai .gemini.genai.Client" )
309309 @patch ("posthoganalytics.default_client" )
310310 def test_streaming_with_usage_metadata (self , mock_posthog , mock_genai ):
311311 mock_posthog .return_value = self .mock_posthog_client
@@ -345,7 +345,7 @@ def setUp(self):
345345 self .messages = cast (list [MessageParam ], [{"role" : "user" , "content" : "Test message" }])
346346
347347 @override_settings (GEMINI_API_KEY = "test-api-key" )
348- @patch ("products.llm_analytics.backend.providers .gemini.genai.Client" )
348+ @patch ("posthoganalytics.ai .gemini.genai.Client" )
349349 @patch ("posthoganalytics.default_client" )
350350 def test_api_error_handling (self , mock_posthog , mock_genai ):
351351 mock_posthog .return_value = self .mock_posthog_client
@@ -366,7 +366,7 @@ def test_api_error_handling(self, mock_posthog, mock_genai):
366366 assert error_response ["error" ] == "Gemini API error"
367367
368368 @override_settings (GEMINI_API_KEY = "test-api-key" )
369- @patch ("products.llm_analytics.backend.providers .gemini.genai.Client" )
369+ @patch ("posthoganalytics.ai .gemini.genai.Client" )
370370 @patch ("posthoganalytics.default_client" )
371371 def test_generic_exception_handling (self , mock_posthog , mock_genai ):
372372 mock_posthog .return_value = self .mock_posthog_client
@@ -385,7 +385,7 @@ def test_generic_exception_handling(self, mock_posthog, mock_genai):
385385 assert error_response ["error" ] == "Unexpected error"
386386
387387 @override_settings (GEMINI_API_KEY = "test-api-key" )
388- @patch ("products.llm_analytics.backend.providers .gemini.genai.Client" )
388+ @patch ("posthoganalytics.ai .gemini.genai.Client" )
389389 @patch ("posthoganalytics.default_client" )
390390 def test_missing_candidates_attribute (self , mock_posthog , mock_genai ):
391391 mock_posthog .return_value = self .mock_posthog_client
@@ -409,7 +409,7 @@ def mock_stream():
409409 assert json .loads (responses [0 ].replace ("data: " , "" ).strip ()) == {"type" : "text" , "text" : "Text response" }
410410
411411 @override_settings (GEMINI_API_KEY = "test-api-key" )
412- @patch ("products.llm_analytics.backend.providers .gemini.genai.Client" )
412+ @patch ("posthoganalytics.ai .gemini.genai.Client" )
413413 @patch ("posthoganalytics.default_client" )
414414 def test_candidate_without_content (self , mock_posthog , mock_genai ):
415415 mock_posthog .return_value = self .mock_posthog_client
@@ -438,7 +438,7 @@ def mock_stream():
438438
439439class TestGeminiIntegration (BaseTest ):
440440 @override_settings (GEMINI_API_KEY = "test-api-key" )
441- @patch ("products.llm_analytics.backend.providers .gemini.genai.Client" )
441+ @patch ("posthoganalytics.ai .gemini.genai.Client" )
442442 @patch ("posthoganalytics.default_client" )
443443 @patch ("products.llm_analytics.backend.providers.gemini.uuid.uuid4" )
444444 def test_trace_id_generation (self , mock_uuid , mock_posthog , mock_genai ):
@@ -471,7 +471,7 @@ def mock_stream():
471471 assert call_kwargs ["posthog_trace_id" ] == test_uuid
472472
473473 @override_settings (GEMINI_API_KEY = "test-api-key" )
474- @patch ("products.llm_analytics.backend.providers .gemini.genai.Client" )
474+ @patch ("posthoganalytics.ai .gemini.genai.Client" )
475475 @patch ("posthoganalytics.default_client" )
476476 def test_properties_include_ai_product (self , mock_posthog , mock_genai ):
477477 mock_posthog .return_value = MagicMock ()
@@ -508,7 +508,7 @@ def mock_stream():
508508 ]
509509 )
510510 @override_settings (GEMINI_API_KEY = "test-api-key" )
511- @patch ("products.llm_analytics.backend.providers .gemini.genai.Client" )
511+ @patch ("posthoganalytics.ai .gemini.genai.Client" )
512512 @patch ("posthoganalytics.default_client" )
513513 def test_temperature_and_max_tokens_handling (
514514 self , input_temp , input_max_tokens , expected_temp , expected_max_tokens , mock_posthog , mock_genai
0 commit comments