NLAToolkit#

class langchain_community.agent_toolkits.nla.toolkit.NLAToolkit[source]#

Bases: BaseToolkit

Natural Language API Toolkit.

Security Note: This toolkit creates tools that enable making calls

to an Open API compliant API.

The tools created by this toolkit may be able to make GET, POST, PATCH, PUT, DELETE requests to any of the exposed endpoints on the API.

Control access to who can use this toolkit.

See https://python.langchain.com/docs/security for more information.

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

param nla_tools: Sequence[NLATool] [Required]#

List of API Endpoint Tools.

classmethod from_llm_and_ai_plugin(llm: BaseLanguageModel, ai_plugin: AIPlugin, requests: Requests | None = None, verbose: bool = False, **kwargs: Any) NLAToolkit[source]#

Instantiate the toolkit from an OpenAPI Spec URL

Parameters:
Return type:

NLAToolkit

classmethod from_llm_and_ai_plugin_url(llm: BaseLanguageModel, ai_plugin_url: str, requests: Requests | None = None, verbose: bool = False, **kwargs: Any) NLAToolkit[source]#

Instantiate the toolkit from an OpenAPI Spec URL

Parameters:
Return type:

NLAToolkit

classmethod from_llm_and_spec(llm: BaseLanguageModel, spec: OpenAPISpec, requests: Requests | None = None, verbose: bool = False, **kwargs: Any) NLAToolkit[source]#

Instantiate the toolkit by creating tools for each operation.

Parameters:
  • llm (BaseLanguageModel) – The language model to use.

  • spec (OpenAPISpec) – The OpenAPI spec.

  • requests (Requests | None) – Optional requests object. Default is None.

  • verbose (bool) – Whether to print verbose output. Default is False.

  • kwargs (Any) – Additional arguments.

Returns:

The toolkit.

Return type:

NLAToolkit

classmethod from_llm_and_url(llm: BaseLanguageModel, open_api_url: str, requests: Requests | None = None, verbose: bool = False, **kwargs: Any) NLAToolkit[source]#

Instantiate the toolkit from an OpenAPI Spec URL.

Parameters:
  • llm (BaseLanguageModel) – The language model to use.

  • open_api_url (str) – The URL of the OpenAPI spec.

  • requests (Requests | None) – Optional requests object. Default is None.

  • verbose (bool) – Whether to print verbose output. Default is False.

  • kwargs (Any) – Additional arguments.

Returns:

The toolkit.

Return type:

NLAToolkit

get_tools() List[BaseTool][source]#

Get the tools for all the API operations.

Return type:

List[BaseTool]

Examples using NLAToolkit