From f65a971141dfd1cb154a6aa7c14299c46f6ace03 Mon Sep 17 00:00:00 2001 From: Yamac Ay Date: Tue, 8 Sep 2026 15:00:31 +0200 Subject: [PATCH 1/5] fix proxy client init bug --- packages/gen/gen_ai_hub/proxy/langchain/init_models.py | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/gen/gen_ai_hub/proxy/langchain/init_models.py b/packages/gen/gen_ai_hub/proxy/langchain/init_models.py index 0f3794a8..e8da889b 100644 --- a/packages/gen/gen_ai_hub/proxy/langchain/init_models.py +++ b/packages/gen/gen_ai_hub/proxy/langchain/init_models.py @@ -97,6 +97,7 @@ def _init_model(proxy_client: Optional[BaseProxyClient], if init_func: return _init_custom_model(proxy_client=proxy_client, init_func=init_func, args=args, kwargs=kwargs, model_kwargs=model_kwargs) + proxy_client = proxy_client or get_proxy_client() model_name, model_identification_kwargs, kwargs = handle_model_args_kwargs(proxy_client=proxy_client, args=args, kwargs=kwargs) init_func = _get_init_func(model_name, model_type) From 21b3769af4e8bcc386300edb4efea84f03ae6d34 Mon Sep 17 00:00:00 2001 From: Yamac Ay Date: Tue, 8 Sep 2026 15:21:55 +0200 Subject: [PATCH 2/5] move up --- packages/gen/gen_ai_hub/proxy/langchain/init_models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/gen/gen_ai_hub/proxy/langchain/init_models.py b/packages/gen/gen_ai_hub/proxy/langchain/init_models.py index e8da889b..a5be61dc 100644 --- a/packages/gen/gen_ai_hub/proxy/langchain/init_models.py +++ b/packages/gen/gen_ai_hub/proxy/langchain/init_models.py @@ -93,11 +93,11 @@ def _init_model(proxy_client: Optional[BaseProxyClient], kwargs: Dict[str, Any], init_func: Optional[Callable] = None, model_kwargs: Optional[Dict[str, Any]] = None): + proxy_client = proxy_client or get_proxy_client() model_kwargs = model_kwargs or {} if init_func: return _init_custom_model(proxy_client=proxy_client, init_func=init_func, args=args, kwargs=kwargs, model_kwargs=model_kwargs) - proxy_client = proxy_client or get_proxy_client() model_name, model_identification_kwargs, kwargs = handle_model_args_kwargs(proxy_client=proxy_client, args=args, kwargs=kwargs) init_func = _get_init_func(model_name, model_type) From c61388058db2db09c6f27d86ad0211a2cc97a17b Mon Sep 17 00:00:00 2001 From: Yamac Ay Date: Tue, 8 Sep 2026 15:31:40 +0200 Subject: [PATCH 3/5] add tests --- .../proxy/langchain_/test_init_models.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/packages/gen/tests/proxy/langchain_/test_init_models.py b/packages/gen/tests/proxy/langchain_/test_init_models.py index bf78687d..ee57664b 100644 --- a/packages/gen/tests/proxy/langchain_/test_init_models.py +++ b/packages/gen/tests/proxy/langchain_/test_init_models.py @@ -1,4 +1,5 @@ import unittest +import unittest.mock from datetime import datetime from unittest.mock import MagicMock @@ -75,6 +76,24 @@ def test_init_embedding_model(self): model = init_embedding_model(model_name, proxy_client=self.proxy_client) self.assertIsInstance(model, model_class) + def test_init_llm_without_proxy_client(self): + """init_llm should fall back to get_proxy_client() when proxy_client is not passed.""" + with unittest.mock.patch( + 'gen_ai_hub.proxy.langchain.init_models.get_proxy_client', + return_value=self.proxy_client, + ): + model = init_llm('gpt-5') + self.assertIsInstance(model, openai.ChatOpenAI) + + def test_init_embedding_model_without_proxy_client(self): + """init_embedding_model should fall back to get_proxy_client() when proxy_client is not passed.""" + with unittest.mock.patch( + 'gen_ai_hub.proxy.langchain.init_models.get_proxy_client', + return_value=self.proxy_client, + ): + model = init_embedding_model('text-embedding-3-small') + self.assertIsInstance(model, openai.OpenAIEmbeddings) + def test_init_llm(self): model_kwargs = {'top_k': 3} for model_name, model_class in self.llm.items(): From 13fa27e869af6c6e41bed0a27b2148c3b017716f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 8 Sep 2026 14:37:50 +0000 Subject: [PATCH 4/5] fix(gen): retry flaky multiple execution integration test Co-authored-by: yamaceay <46201716+yamaceay@users.noreply.github.com> --- .../evaluations/test_multiple_execution_flow.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/gen/integration_tests/evaluations/test_multiple_execution_flow.py b/packages/gen/integration_tests/evaluations/test_multiple_execution_flow.py index 6e325d63..ab5c6adb 100755 --- a/packages/gen/integration_tests/evaluations/test_multiple_execution_flow.py +++ b/packages/gen/integration_tests/evaluations/test_multiple_execution_flow.py @@ -12,6 +12,7 @@ from gen_ai_hub.orchestration_v2.models.template_ref import TemplateRef, TemplateRefByID from gen_ai_hub.orchestration_v2.models.llm_model_details import LLMModelDetails as LLM from .test_base import EvaluationClientTestBase +from integration_tests.test_helpers import retry_on_429_or_503_class def get_auth_token(auth_url, client_id, client_secret): @@ -187,6 +188,7 @@ def delete_custom_metric(base_url, headers, metric_id): print(f"Warning: Error deleting custom metric {metric_id}: {e}") +@retry_on_429_or_503_class(max_retries=3, initial_delay=2.0, backoff_factor=2.0) class TestMultipleExecutionFlow(EvaluationClientTestBase): """Test multiple evaluation execution flow.""" From 8976fa42430835328c61123834b93971afc2de8d Mon Sep 17 00:00:00 2001 From: Yamac Ay Date: Tue, 8 Sep 2026 16:45:05 +0200 Subject: [PATCH 5/5] Revert "fix(gen): retry flaky multiple execution integration test" This reverts commit 13fa27e869af6c6e41bed0a27b2148c3b017716f. --- .../evaluations/test_multiple_execution_flow.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/gen/integration_tests/evaluations/test_multiple_execution_flow.py b/packages/gen/integration_tests/evaluations/test_multiple_execution_flow.py index ab5c6adb..6e325d63 100755 --- a/packages/gen/integration_tests/evaluations/test_multiple_execution_flow.py +++ b/packages/gen/integration_tests/evaluations/test_multiple_execution_flow.py @@ -12,7 +12,6 @@ from gen_ai_hub.orchestration_v2.models.template_ref import TemplateRef, TemplateRefByID from gen_ai_hub.orchestration_v2.models.llm_model_details import LLMModelDetails as LLM from .test_base import EvaluationClientTestBase -from integration_tests.test_helpers import retry_on_429_or_503_class def get_auth_token(auth_url, client_id, client_secret): @@ -188,7 +187,6 @@ def delete_custom_metric(base_url, headers, metric_id): print(f"Warning: Error deleting custom metric {metric_id}: {e}") -@retry_on_429_or_503_class(max_retries=3, initial_delay=2.0, backoff_factor=2.0) class TestMultipleExecutionFlow(EvaluationClientTestBase): """Test multiple evaluation execution flow."""