From d315b112065909550a96f4b065752759f8652bfa Mon Sep 17 00:00:00 2001 From: raspawar Date: Tue, 27 Aug 2024 11:35:55 +0530 Subject: [PATCH] add reranker test case and url --- libs/ai-endpoints/langchain_nvidia_ai_endpoints/_common.py | 4 +++- libs/ai-endpoints/tests/unit_tests/test_base_url.py | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/libs/ai-endpoints/langchain_nvidia_ai_endpoints/_common.py b/libs/ai-endpoints/langchain_nvidia_ai_endpoints/_common.py index 687f2e13..2bde648a 100644 --- a/libs/ai-endpoints/langchain_nvidia_ai_endpoints/_common.py +++ b/libs/ai-endpoints/langchain_nvidia_ai_endpoints/_common.py @@ -133,7 +133,9 @@ def _preprocess_args(cls, values: Dict[str, Any]) -> Dict[str, Any]: f"Invalid base_url format. {expected_format} Got: {base_url}" ) - if base_url.endswith(("/embeddings", "/completions", "/rankings")): + if base_url.endswith( + ("/embeddings", "/completions", "/rankings", "/reranking") + ): warnings.warn(f"Using {base_url}, ignoring the rest") values["base_url"] = base_url diff --git a/libs/ai-endpoints/tests/unit_tests/test_base_url.py b/libs/ai-endpoints/tests/unit_tests/test_base_url.py index e8e393b2..0baaca6c 100644 --- a/libs/ai-endpoints/tests/unit_tests/test_base_url.py +++ b/libs/ai-endpoints/tests/unit_tests/test_base_url.py @@ -95,6 +95,7 @@ def test_param_base_url_hosted(public_class: type, base_url: str) -> None: "http://localhost:8888", "http://0.0.0.0:8888/v1", "http://0.0.0.0:8888/v1/", + "http://blah/some/other/path/v1", ], ) def test_param_base_url_not_hosted(public_class: type, base_url: str) -> None: