@@ -111,6 +111,8 @@ def test_init_default(self, monkeypatch):
111111 assert component .api_base_url == "https://api.llama.com/compat/v1/"
112112 assert component .streaming_callback is None
113113 assert not component .generation_kwargs
114+ assert component .timeout is None
115+ assert component .max_retries is None
114116
115117 def test_init_fail_wo_api_key (self , monkeypatch ):
116118 monkeypatch .delenv ("LLAMA_API_KEY" , raising = False )
@@ -124,6 +126,8 @@ def test_init_with_parameters(self):
124126 streaming_callback = print_streaming_chunk ,
125127 api_base_url = "test-base-url" ,
126128 generation_kwargs = {"max_tokens" : 10 , "some_test_param" : "test-params" },
129+ timeout = 15.0 ,
130+ max_retries = 3 ,
127131 )
128132 assert component .client .api_key == "test-api-key"
129133 assert component .model == "Llama-4-Scout-17B-16E-Instruct-FP8"
@@ -132,6 +136,8 @@ def test_init_with_parameters(self):
132136 "max_tokens" : 10 ,
133137 "some_test_param" : "test-params" ,
134138 }
139+ assert component .timeout == 15.0
140+ assert component .max_retries == 3
135141
136142 def test_to_dict_default (self , monkeypatch ):
137143 monkeypatch .setenv ("LLAMA_API_KEY" , "test-api-key" )
@@ -153,6 +159,8 @@ def test_to_dict_default(self, monkeypatch):
153159 "streaming_callback" : None ,
154160 "api_base_url" : "https://api.llama.com/compat/v1/" ,
155161 "generation_kwargs" : {},
162+ "timeout" : None ,
163+ "max_retries" : None ,
156164 }
157165
158166 for key , value in expected_params .items ():
@@ -212,6 +220,8 @@ class NobelPrizeInfo(BaseModel):
212220 "api_base_url" : "test-base-url" ,
213221 "streaming_callback" : "haystack.components.generators.utils.print_streaming_chunk" ,
214222 "generation_kwargs" : {"max_tokens" : 10 , "some_test_param" : "test-params" , "response_format" : schema },
223+ "timeout" : None ,
224+ "max_retries" : None ,
215225 }
216226
217227 for key , value in expected_params .items ():
@@ -234,6 +244,8 @@ def test_from_dict(self, monkeypatch):
234244 "max_tokens" : 10 ,
235245 "some_test_param" : "test-params" ,
236246 },
247+ "timeout" : 30.0 ,
248+ "max_retries" : 5 ,
237249 },
238250 }
239251 component = MetaLlamaChatGenerator .from_dict (data )
@@ -245,6 +257,8 @@ def test_from_dict(self, monkeypatch):
245257 "some_test_param" : "test-params" ,
246258 }
247259 assert component .api_key == Secret .from_env_var ("LLAMA_API_KEY" )
260+ assert component .timeout == 30.0
261+ assert component .max_retries == 5
248262
249263 def test_from_dict_fail_wo_env_var (self , monkeypatch ):
250264 monkeypatch .delenv ("LLAMA_API_KEY" , raising = False )
@@ -263,6 +277,8 @@ def test_from_dict_fail_wo_env_var(self, monkeypatch):
263277 "max_tokens" : 10 ,
264278 "some_test_param" : "test-params" ,
265279 },
280+ "timeout" : 30.0 ,
281+ "max_retries" : 5 ,
266282 },
267283 }
268284 with pytest .raises (ValueError , match = r"None of the .* environment variables are set" ):
@@ -561,6 +577,8 @@ def test_serde_in_pipeline(self, monkeypatch):
561577 "streaming_callback" : "haystack.components.generators.utils.print_streaming_chunk" ,
562578 "api_base_url" : "https://api.llama.com/compat/v1/" ,
563579 "generation_kwargs" : {"temperature" : 0.7 },
580+ "timeout" : None ,
581+ "max_retries" : None ,
564582 "tools" : [
565583 {
566584 "type" : "haystack.tools.tool.Tool" ,
0 commit comments