langchain_community.agent_toolkits.nla.toolkit.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: Optional[Requests] = 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: Optional[Requests] = None, verbose: bool = False, **kwargs: Any) NLAToolkit[source]ΒΆ

Instantiate the toolkit from an OpenAPI Spec URL

Parameters
  • llm (BaseLanguageModel) –

  • ai_plugin_url (str) –

  • requests (Optional[Requests]) –

  • verbose (bool) –

  • kwargs (Any) –

Return type

NLAToolkit

classmethod from_llm_and_spec(llm: BaseLanguageModel, spec: OpenAPISpec, requests: Optional[Requests] = 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 (Optional[Requests]) – 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: Optional[Requests] = 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 (Optional[Requests]) – 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ΒΆ