From 956ee981c03874d6e413a51eed9f7b437e52f07c Mon Sep 17 00:00:00 2001 From: Nuno Campos Date: Mon, 25 Sep 2023 15:45:04 +0100 Subject: [PATCH] Fix issue where requests wrapper passes auth kwarg twice (#11010) Closes #8842 --- libs/langchain/langchain/utilities/requests.py | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/libs/langchain/langchain/utilities/requests.py b/libs/langchain/langchain/utilities/requests.py index 21f988a02c..2652eb0915 100644 --- a/libs/langchain/langchain/utilities/requests.py +++ b/libs/langchain/langchain/utilities/requests.py @@ -73,7 +73,7 @@ class Requests(BaseModel): self, url: str, **kwargs: Any ) -> AsyncGenerator[aiohttp.ClientResponse, None]: """GET the URL and return the text asynchronously.""" - async with self._arequest("GET", url, auth=self.auth, **kwargs) as response: + async with self._arequest("GET", url, **kwargs) as response: yield response @asynccontextmanager @@ -81,9 +81,7 @@ class Requests(BaseModel): self, url: str, data: Dict[str, Any], **kwargs: Any ) -> AsyncGenerator[aiohttp.ClientResponse, None]: """POST to the URL and return the text asynchronously.""" - async with self._arequest( - "POST", url, json=data, auth=self.auth, **kwargs - ) as response: + async with self._arequest("POST", url, json=data, **kwargs) as response: yield response @asynccontextmanager @@ -91,9 +89,7 @@ class Requests(BaseModel): self, url: str, data: Dict[str, Any], **kwargs: Any ) -> AsyncGenerator[aiohttp.ClientResponse, None]: """PATCH the URL and return the text asynchronously.""" - async with self._arequest( - "PATCH", url, json=data, auth=self.auth, **kwargs - ) as response: + async with self._arequest("PATCH", url, json=data, **kwargs) as response: yield response @asynccontextmanager @@ -101,9 +97,7 @@ class Requests(BaseModel): self, url: str, data: Dict[str, Any], **kwargs: Any ) -> AsyncGenerator[aiohttp.ClientResponse, None]: """PUT the URL and return the text asynchronously.""" - async with self._arequest( - "PUT", url, json=data, auth=self.auth, **kwargs - ) as response: + async with self._arequest("PUT", url, json=data, **kwargs) as response: yield response @asynccontextmanager @@ -111,7 +105,7 @@ class Requests(BaseModel): self, url: str, **kwargs: Any ) -> AsyncGenerator[aiohttp.ClientResponse, None]: """DELETE the URL and return the text asynchronously.""" - async with self._arequest("DELETE", url, auth=self.auth, **kwargs) as response: + async with self._arequest("DELETE", url, **kwargs) as response: yield response