From fc6b913823319c5f2a5dbcb83d9e3fc032d5e837 Mon Sep 17 00:00:00 2001 From: raspawar Date: Thu, 29 Aug 2024 11:59:54 +0530 Subject: [PATCH] fix failing test cases for base url --- libs/ai-endpoints/langchain_nvidia_ai_endpoints/_common.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libs/ai-endpoints/langchain_nvidia_ai_endpoints/_common.py b/libs/ai-endpoints/langchain_nvidia_ai_endpoints/_common.py index 2bde648a..ae60d137 100644 --- a/libs/ai-endpoints/langchain_nvidia_ai_endpoints/_common.py +++ b/libs/ai-endpoints/langchain_nvidia_ai_endpoints/_common.py @@ -17,7 +17,7 @@ Tuple, Union, ) -from urllib.parse import urlparse +from urllib.parse import urlparse, urlunparse import requests from langchain_core.pydantic_v1 import ( @@ -138,7 +138,9 @@ def _preprocess_args(cls, values: Dict[str, Any]) -> Dict[str, Any]: ): warnings.warn(f"Using {base_url}, ignoring the rest") - values["base_url"] = base_url + values["base_url"] = base_url = urlunparse( + (parsed.scheme, parsed.netloc, "v1", None, None, None) + ) values["infer_path"] = values["infer_path"].format(base_url=base_url) return values