Closed bugramatik closed 1 year ago
If langchain/utilities/requests.py line 60 is changed like this:
if self.auth:
async with session.request(
method, url, headers=self.headers, auth=self.auth, **kwargs
) as response:
yield response
else:
async with session.request(
method, url, headers=self.headers, **kwargs
) as response:
yield response
problem can be solved.
Thanks for reporting, this is fixed in #11010
System Info
Langchain version: 0.0.253 Python:3.11
Who can help?
@agola11 @hwchase17 @eyurtsev
Information
Related Components
Reproduction
Ensure you're using Python 3.11. Install the necessary libraries and dependencies:
Set up the APIChain utility using the provided API documentation and the chosen language model:
Use a tool like Uvicorn to start your FastAPI app:
Make a request to the FastAPI endpoint that uses the APIChain utility. This could be through tools like curl, Postman, or directly from a browser, depending on how your API is set up. Execute the Callback:
Inside the relevant endpoint, ensure you have the following snippet:
You should encounter a TypeError indicating a conflict with the auth argument in the aiohttp.client.ClientSession.request() method. Because of providing header to APIChain and running it with
arun
method.Expected behavior
Request Execution:
The chain.arun(user_query) method should interact with the intended external service or API without any issues. The auth parameter, when used in the underlying request to the external service (in aiohttp), should be correctly applied without conflicts or multiple definitions.