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