Skip to content

The agent engineering platform.

Fix issue where requests wrapper passes auth kwarg twice (#11010)

Nuno Campos956ee981c038
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