mirror of
https://github.com/hwchase17/langchain
synced 2024-11-08 07:10:35 +00:00
Add max_execution_time to openapi, pandas, and sql creators (#2779)
In #2399 we added the ability to set `max_execution_time` when creating an AgentExecutor. This PR adds the `max_execution_time` argument to the built-in pandas, sql, and openapi agents. Co-authored-by: Zachary Jones <zjones@zetaglobal.com>
This commit is contained in:
parent
f0be3b0689
commit
abfca72c0b
@ -22,6 +22,9 @@ def create_openapi_agent(
|
|||||||
suffix: str = OPENAPI_SUFFIX,
|
suffix: str = OPENAPI_SUFFIX,
|
||||||
format_instructions: str = FORMAT_INSTRUCTIONS,
|
format_instructions: str = FORMAT_INSTRUCTIONS,
|
||||||
input_variables: Optional[List[str]] = None,
|
input_variables: Optional[List[str]] = None,
|
||||||
|
max_iterations: Optional[int] = 15,
|
||||||
|
max_execution_time: Optional[float] = None,
|
||||||
|
early_stopping_method: str = "force",
|
||||||
verbose: bool = False,
|
verbose: bool = False,
|
||||||
return_intermediate_steps: bool = False,
|
return_intermediate_steps: bool = False,
|
||||||
**kwargs: Any,
|
**kwargs: Any,
|
||||||
@ -47,4 +50,7 @@ def create_openapi_agent(
|
|||||||
tools=toolkit.get_tools(),
|
tools=toolkit.get_tools(),
|
||||||
verbose=verbose,
|
verbose=verbose,
|
||||||
return_intermediate_steps=return_intermediate_steps,
|
return_intermediate_steps=return_intermediate_steps,
|
||||||
|
max_iterations=max_iterations,
|
||||||
|
max_execution_time=max_execution_time,
|
||||||
|
early_stopping_method=early_stopping_method,
|
||||||
)
|
)
|
||||||
|
@ -20,6 +20,7 @@ def create_pandas_dataframe_agent(
|
|||||||
verbose: bool = False,
|
verbose: bool = False,
|
||||||
return_intermediate_steps: bool = False,
|
return_intermediate_steps: bool = False,
|
||||||
max_iterations: Optional[int] = 15,
|
max_iterations: Optional[int] = 15,
|
||||||
|
max_execution_time: Optional[float] = None,
|
||||||
early_stopping_method: str = "force",
|
early_stopping_method: str = "force",
|
||||||
**kwargs: Any,
|
**kwargs: Any,
|
||||||
) -> AgentExecutor:
|
) -> AgentExecutor:
|
||||||
@ -48,5 +49,6 @@ def create_pandas_dataframe_agent(
|
|||||||
verbose=verbose,
|
verbose=verbose,
|
||||||
return_intermediate_steps=return_intermediate_steps,
|
return_intermediate_steps=return_intermediate_steps,
|
||||||
max_iterations=max_iterations,
|
max_iterations=max_iterations,
|
||||||
|
max_execution_time=max_execution_time,
|
||||||
early_stopping_method=early_stopping_method,
|
early_stopping_method=early_stopping_method,
|
||||||
)
|
)
|
||||||
|
@ -21,6 +21,7 @@ def create_sql_agent(
|
|||||||
input_variables: Optional[List[str]] = None,
|
input_variables: Optional[List[str]] = None,
|
||||||
top_k: int = 10,
|
top_k: int = 10,
|
||||||
max_iterations: Optional[int] = 15,
|
max_iterations: Optional[int] = 15,
|
||||||
|
max_execution_time: Optional[float] = None,
|
||||||
early_stopping_method: str = "force",
|
early_stopping_method: str = "force",
|
||||||
verbose: bool = False,
|
verbose: bool = False,
|
||||||
**kwargs: Any,
|
**kwargs: Any,
|
||||||
@ -47,5 +48,6 @@ def create_sql_agent(
|
|||||||
tools=tools,
|
tools=tools,
|
||||||
verbose=verbose,
|
verbose=verbose,
|
||||||
max_iterations=max_iterations,
|
max_iterations=max_iterations,
|
||||||
|
max_execution_time=max_execution_time,
|
||||||
early_stopping_method=early_stopping_method,
|
early_stopping_method=early_stopping_method,
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user