create_openapi_agent#
- langchain_community.agent_toolkits.openapi.planner.create_openapi_agent(api_spec: ReducedOpenAPISpec, requests_wrapper: TextRequestsWrapper, llm: BaseLanguageModel, shared_memory: Any | None = None, callback_manager: BaseCallbackManager | None = None, verbose: bool = True, agent_executor_kwargs: Dict[str, Any] | None = None, allow_dangerous_requests: bool = False, allowed_operations: Sequence[Literal['GET', 'POST', 'PUT', 'DELETE', 'PATCH']] = ('GET', 'POST'), **kwargs: Any) Any [source]#
Construct an OpenAI API planner and controller for a given spec.
Inject credentials via requests_wrapper.
We use a top-level βorchestratorβ agent to invoke the planner and controller, rather than a top-level planner that invokes a controller with its plan. This is to keep the planner simple.
You need to set allow_dangerous_requests to True to use Agent with BaseRequestsTool. Requests can be dangerous and can lead to security vulnerabilities. For example, users can ask a server to make a request to an internal server. Itβs recommended to use requests through a proxy server and avoid accepting inputs from untrusted sources without proper sandboxing. Please see: https://python.langchain.com/docs/security for further security information.
- Parameters:
api_spec (ReducedOpenAPISpec) β The OpenAPI spec.
requests_wrapper (TextRequestsWrapper) β The requests wrapper.
llm (BaseLanguageModel) β The language model.
shared_memory (Any | None) β Optional. The shared memory. Default is None.
callback_manager (BaseCallbackManager | None) β Optional. The callback manager. Default is None.
verbose (bool) β Optional. Whether to print verbose output. Default is True.
agent_executor_kwargs (Dict[str, Any] | None) β Optional. Additional keyword arguments for the agent executor.
allow_dangerous_requests (bool) β Optional. Whether to allow dangerous requests. Default is False.
allowed_operations (Sequence[Literal['GET', 'POST', 'PUT', 'DELETE', 'PATCH']]) β Optional. The allowed operations. Default is (βGETβ, βPOSTβ).
kwargs (Any) β Additional arguments.
- Returns:
The agent executor.
- Return type:
Any
Examples using create_openapi_agent