forked from Archives/langchain
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
13d1df2140
`AgentExecutor` already has support for limiting the number of iterations. But the amount of time taken for each iteration can vary quite a bit, so it is difficult to place limits on the execution time. This PR adds a new field `max_execution_time` to the `AgentExecutor` model. When called asynchronously, the agent loop is wrapped in an `asyncio.timeout()` context which triggers the early stopping response if the time limit is reached. When called synchronously, the agent loop checks for both the max_iteration limit and the time limit after each iteration. When used asynchronously `max_execution_time` gives really tight control over the max time for an execution chain. When used synchronously, the chain can unfortunately exceed max_execution_time, but it still gives more control than trying to estimate the number of max_iterations needed to cap the execution time. --------- Co-authored-by: Zachary Jones <zjones@zetaglobal.com> |
1 year ago | |
---|---|---|
.. | ||
__init__.py | 1 year ago | |
apify.py | 1 year ago | |
asyncio.py | 1 year ago | |
bash.py | 1 year ago | |
bing_search.py | 1 year ago | |
google_search.py | 1 year ago | |
google_serper.py | 1 year ago | |
loading.py | 1 year ago | |
openweathermap.py | 1 year ago | |
searx_search.py | 1 year ago | |
serpapi.py | 1 year ago | |
wikipedia.py | 1 year ago | |
wolfram_alpha.py | 1 year ago | |
zapier.py | 1 year ago |