Skip to main content
`Ctrl`+`K`

# Tools

Core toolkit implementations.

pydantic model langchain.tools.AIPluginTool
  Validators

    - `set_callback_manager` » `callback_manager`

  field api_spec: str [Required]
  field plugin: AIPlugin [Required]
  classmethod from_plugin_url(url: str) → langchain.tools.plugin.AIPluginTool

pydantic model langchain.tools.APIOperation

  A model for a single API operation.

  field base_url: str [Required]

    The base URL of the operation.

  field description: Optional[str] = None

    The description of the operation.

  field method: langchain.tools.openapi.utils.openapi_utils.HTTPVerb [Required]

    The HTTP method of the operation.

  field operation_id: str [Required]

    The unique identifier of the operation.

  field path: str [Required]

    The path of the operation.

  field properties: Sequence[langchain.tools.openapi.utils.api_models.APIProperty] [Required]
  field request_body: Optional[langchain.tools.openapi.utils.api_models.APIRequestBody] = None

    The request body of the operation.

  classmethod from_openapi_spec(spec: langchain.tools.openapi.utils.openapi_utils.OpenAPISpec, path: str, method: str) → langchain.tools.openapi.utils.api_models.APIOperation

    Create an APIOperation from an OpenAPI spec.

  classmethod from_openapi_url(spec_url: str, path: str, method: str) → langchain.tools.openapi.utils.api_models.APIOperation

    Create an APIOperation from an OpenAPI URL.

  to_typescript() → str

    Get typescript string representation of the operation.

  static ts_type_from_python(type_: Union[str, Type, tuple, None, enum.Enum]) → str
  property body_params: List[str]
  property path_params: List[str]
  property query_params: List[str]

pydantic model langchain.tools.BaseTool

  Interface LangChain tools must implement.

  Validators

    - `set_callback_manager` » `callback_manager`

  field args_schema: Optional[Type[pydantic.main.BaseModel]] = None

    Pydantic model class to validate and parse the tool’s input arguments.

  field callback_manager: langchain.callbacks.base.BaseCallbackManager [Optional]
  field description: str [Required]
  field name: str [Required]
  field return_direct: bool = False
  field verbose: bool = False
  async arun(tool_input: Union[str, Dict], verbose: Optional[bool] = None, start_color: Optional[str] = 'green', color: Optional[str] = 'green', **kwargs: Any) → str

    Run the tool asynchronously.

  run(tool_input: Union[str, Dict], verbose: Optional[bool] = None, start_color: Optional[str] = 'green', color: Optional[str] = 'green', **kwargs: Any) → str

    Run the tool.

  property args: dict

pydantic model langchain.tools.DuckDuckGoSearchTool

  Tool that adds the capability to query the DuckDuckGo search API.

  Validators

    - `set_callback_manager` » `callback_manager`

  field api_wrapper: langchain.utilities.duckduckgo_search.DuckDuckGoSearchAPIWrapper [Optional]

pydantic model langchain.tools.GooglePlacesTool

  Tool that adds the capability to query the Google places API.

  Validators

    - `set_callback_manager` » `callback_manager`

  field api_wrapper: langchain.utilities.google_places_api.GooglePlacesAPIWrapper [Optional]

pydantic model langchain.tools.IFTTTWebhook

  IFTTT Webhook.

  Parameters

    - name – name of the tool

    - description – description of the tool

    - url – url to hit with the json event.

  Validators

    - `set_callback_manager` » `callback_manager`

  field url: str [Required]

pydantic model langchain.tools.OpenAPISpec

  OpenAPI Model that removes misformatted parts of the spec.

  field components: Optional[openapi_schema_pydantic.v3.v3_1_0.components.Components] = None

    An element to hold various schemas for the document.

  field externalDocs: Optional[openapi_schema_pydantic.v3.v3_1_0.external_documentation.ExternalDocumentation] = None

    Additional external documentation.

  field info: openapi_schema_pydantic.v3.v3_1_0.info.Info [Required]

    REQUIRED. Provides metadata about the API. The metadata MAY be used by tooling as required.

  field jsonSchemaDialect: Optional[str] = None

    The default value for the $schema keyword within [Schema Objects](#schemaObject) contained within this OAS document. This MUST be in the form of a URI.

  field openapi: str = '3.1.0'

    REQUIRED. This string MUST be the [version number](#versions) of the OpenAPI Specification that the OpenAPI document uses. The openapi field SHOULD be used by tooling to interpret the OpenAPI document. This is not related to the API [info.version](#infoVersion) string.

  field paths: Optional[Dict[str, openapi_schema_pydantic.v3.v3_1_0.path_item.PathItem]] = None

    The available paths and operations for the API.

  field security: Optional[List[Dict[str, List[str]]]] = None

    A declaration of which security mechanisms can be used across the API. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. Individual operations can override this definition. To make security optional, an empty security requirement ({}) can be included in the array.

  field servers: List[openapi_schema_pydantic.v3.v3_1_0.server.Server] = [Server(url='/', description=None, variables=None)]

    An array of Server Objects, which provide connectivity information to a target server. If the servers property is not provided, or is an empty array, the default value would be a [Server Object](#serverObject) with a [url](#serverUrl) value of /.

  field tags: Optional[List[openapi_schema_pydantic.v3.v3_1_0.tag.Tag]] = None

    A list of tags used by the document with additional metadata. The order of the tags can be used to reflect on their order by the parsing tools. Not all tags that are used by the [Operation Object](#operationObject) must be declared. The tags that are not declared MAY be organized randomly or based on the tools’ logic. Each tag name in the list MUST be unique.

  field webhooks: Optional[Dict[str, Union[openapi_schema_pydantic.v3.v3_1_0.path_item.PathItem, openapi_schema_pydantic.v3.v3_1_0.reference.Reference]]] = None

    The incoming webhooks that MAY be received as part of this API and that the API consumer MAY choose to implement. Closely related to the callbacks feature, this section describes requests initiated other than by an API call, for example by an out of band registration. The key name is a unique string to refer to each webhook, while the (optionally referenced) Path Item Object describes a request that may be initiated by the API provider and the expected responses. An [example](../examples/v3.1/webhook-example.yaml) is available.

  classmethod from_file(path: Union[str, pathlib.Path]) → langchain.tools.openapi.utils.openapi_utils.OpenAPISpec

    Get an OpenAPI spec from a file path.

  classmethod from_spec_dict(spec_dict: dict) → langchain.tools.openapi.utils.openapi_utils.OpenAPISpec

    Get an OpenAPI spec from a dict.

  classmethod from_text(text: str) → langchain.tools.openapi.utils.openapi_utils.OpenAPISpec

    Get an OpenAPI spec from a text.

  classmethod from_url(url: str) → langchain.tools.openapi.utils.openapi_utils.OpenAPISpec

    Get an OpenAPI spec from a URL.

  static get_cleaned_operation_id(operation: openapi_schema_pydantic.v3.v3_1_0.operation.Operation, path: str, method: str) → str

    Get a cleaned operation id from an operation id.

  get_methods_for_path(path: str) → List[str]

    Return a list of valid methods for the specified path.

  get_operation(path: str, method: str) → openapi_schema_pydantic.v3.v3_1_0.operation.Operation

    Get the operation object for a given path and HTTP method.

  get_parameters_for_operation(operation: openapi_schema_pydantic.v3.v3_1_0.operation.Operation) → List[openapi_schema_pydantic.v3.v3_1_0.parameter.Parameter]

    Get the components for a given operation.

  get_referenced_schema(ref: openapi_schema_pydantic.v3.v3_1_0.reference.Reference) → openapi_schema_pydantic.v3.v3_1_0.schema.Schema

    Get a schema (or nested reference) or err.

  get_request_body_for_operation(operation: openapi_schema_pydantic.v3.v3_1_0.operation.Operation) → Optional[openapi_schema_pydantic.v3.v3_1_0.request_body.RequestBody]

    Get the request body for a given operation.

  classmethod parse_obj(obj: dict) → langchain.tools.openapi.utils.openapi_utils.OpenAPISpec
  property base_url: str

    Get the base url.