@@ -16,7 +16,8 @@ def setUp(self):
1616 self .config = EmbeddingConfig (
1717 model = "text-embedding-ada-002" ,
1818 api_key = "test-key" ,
19- timeout = 30 ,
19+ timeout = 1 ,
20+ retry_delay = 0.01 ,
2021 )
2122
2223 @patch ("quantmind.llm.embedding.LITELLM_AVAILABLE" , True )
@@ -28,7 +29,7 @@ def test_init_success(self, mock_litellm):
2829 self .assertEqual (block .config , self .config )
2930 mock_litellm .set_verbose = False
3031 self .assertEqual (mock_litellm .num_retries , 3 )
31- self .assertEqual (mock_litellm .request_timeout , 30 )
32+ self .assertEqual (mock_litellm .request_timeout , 1 )
3233
3334 @patch ("quantmind.llm.embedding.LITELLM_AVAILABLE" , False )
3435 def test_init_litellm_unavailable (self ):
@@ -163,7 +164,7 @@ def test_call_with_retry_failure_then_success(
163164
164165 self .assertEqual (result , mock_response )
165166 self .assertEqual (mock_embedding .call_count , 2 )
166- mock_sleep .assert_called_once_with (1.0 )
167+ mock_sleep .assert_called_once_with (0.01 )
167168
168169 @patch ("quantmind.llm.embedding.LITELLM_AVAILABLE" , True )
169170 @patch ("quantmind.llm.embedding.litellm" )
@@ -271,7 +272,7 @@ def test_get_info(self, mock_litellm):
271272
272273 self .assertEqual (info ["model" ], "text-embedding-ada-002" )
273274 self .assertEqual (info ["provider" ], "openai" )
274- self .assertEqual (info ["timeout" ], 30 )
275+ self .assertEqual (info ["timeout" ], 1 )
275276 self .assertEqual (info ["retry_attempts" ], 3 )
276277
277278 @patch ("quantmind.llm.embedding.LITELLM_AVAILABLE" , True )
@@ -281,14 +282,14 @@ def test_update_config(self, mock_litellm):
281282 block = EmbeddingBlock (self .config )
282283
283284 # Check initial config
284- self .assertEqual (block .config .timeout , 30 )
285+ self .assertEqual (block .config .timeout , 1 )
285286 self .assertEqual (block .config .api_key , "test-key" )
286287
287288 # Update config
288- block .update_config (timeout = 60 , api_key = "new-key" )
289+ block .update_config (timeout = 2 , api_key = "new-key" )
289290
290291 # Check updated config
291- self .assertEqual (block .config .timeout , 60 )
292+ self .assertEqual (block .config .timeout , 2 )
292293 self .assertEqual (block .config .api_key , "new-key" )
293294 # Other values should remain unchanged
294295 self .assertEqual (block .config .model , "text-embedding-ada-002" )
@@ -300,14 +301,14 @@ def test_temporary_config(self, mock_litellm):
300301 block = EmbeddingBlock (self .config )
301302
302303 # Check initial config
303- self .assertEqual (block .config .timeout , 30 )
304+ self .assertEqual (block .config .timeout , 1 )
304305
305306 # Use temporary config
306- with block .temporary_config (timeout = 60 ):
307- self .assertEqual (block .config .timeout , 60 )
307+ with block .temporary_config (timeout = 2 ):
308+ self .assertEqual (block .config .timeout , 2 )
308309
309310 # Check config is restored
310- self .assertEqual (block .config .timeout , 30 )
311+ self .assertEqual (block .config .timeout , 1 )
311312
312313 @patch ("quantmind.llm.embedding.LITELLM_AVAILABLE" , True )
313314 @patch ("quantmind.llm.embedding.litellm" )
@@ -353,8 +354,8 @@ def test_batch_embed_with_delay(
353354 config = EmbeddingConfig (
354355 model = "text-embedding-ada-002" ,
355356 api_key = "test-key" ,
356- timeout = 30 ,
357- retry_delay = 0.1 ,
357+ timeout = 1 ,
358+ retry_delay = 0.01 ,
358359 )
359360
360361 mock_response = Mock ()
0 commit comments