id
stringlengths
14
15
text
stringlengths
49
2.47k
source
stringlengths
61
166
b3ca74d2fb4d-2
run(command: str, timeout: Optional[int] = None) → str[source]¶ Run command with own globals/locals and returns anything printed. Timeout after the specified number of seconds. classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶ classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶ classmethod update_forward_refs(**localns: Any) → None¶ Try to update ForwardRefs on fields based on this Model, globalns and localns. classmethod validate(value: Any) → Model¶ classmethod worker(command: str, globals: Optional[Dict], locals: Optional[Dict], queue: Queue) → None[source]¶ Examples using PythonREPL¶ Python REPL Dynamodb Chat Message History Python Agent
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.python.PythonREPL.html
8d3677c52b50-0
langchain.utilities.powerbi.PowerBIDataset¶ class langchain.utilities.powerbi.PowerBIDataset[source]¶ Bases: BaseModel Create PowerBI engine from dataset ID and credential or token. Use either the credential or a supplied token to authenticate. If both are supplied the credential is used to generate a token. The impersonated_user_name is the UPN of a user to be impersonated. If the model is not RLS enabled, this will be ignored. 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 aiosession: Optional[aiohttp.ClientSession] = None¶ param credential: Optional[TokenCredential] = None¶ param dataset_id: str [Required]¶ param group_id: Optional[str] = None¶ param impersonated_user_name: Optional[str] = None¶ param sample_rows_in_table_info: int = 1¶ Constraints exclusiveMinimum = 0 maximum = 10 param schemas: Dict[str, str] [Optional]¶ param table_names: List[str] [Required]¶ param token: Optional[str] = None¶ async aget_table_info(table_names: Optional[Union[List[str], str]] = None) → str[source]¶ Get information about specified tables. async arun(command: str) → Any[source]¶ Execute a DAX command and return the result asynchronously. classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) → Model¶ Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.powerbi.PowerBIDataset.html
8d3677c52b50-1
Behaves as if Config.extra = ‘allow’ was set since it adds all passed values copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, update: Optional[DictStrAny] = None, deep: bool = False) → Model¶ Duplicate a model, optionally choose which fields to include, exclude and change. Parameters include – fields to include in new model exclude – fields to exclude from new model, as with values this takes precedence over include update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data deep – set to True to make a deep copy of the model Returns new model instance dict(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False) → DictStrAny¶ Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. classmethod from_orm(obj: Any) → Model¶ get_schemas() → str[source]¶ Get the available schema’s. get_table_info(table_names: Optional[Union[List[str], str]] = None) → str[source]¶ Get information about specified tables. get_table_names() → Iterable[str][source]¶ Get names of tables available.
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.powerbi.PowerBIDataset.html
8d3677c52b50-2
get_table_names() → Iterable[str][source]¶ Get names of tables available. json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, encoder: Optional[Callable[[Any], Any]] = None, models_as_dict: bool = True, **dumps_kwargs: Any) → unicode¶ Generate a JSON representation of the model, include and exclude arguments as per dict(). encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps(). classmethod parse_file(path: Union[str, Path], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ classmethod parse_obj(obj: Any) → Model¶ classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ run(command: str) → Any[source]¶ Execute a DAX command and return a json representing the results. classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶ classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶ classmethod update_forward_refs(**localns: Any) → None¶ Try to update ForwardRefs on fields based on this Model, globalns and localns. classmethod validate(value: Any) → Model¶
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.powerbi.PowerBIDataset.html
8d3677c52b50-3
classmethod validate(value: Any) → Model¶ property headers: Dict[str, str]¶ Get the token. property request_url: str¶ Get the request url. property table_info: str¶ Information about all tables in the database. Examples using PowerBIDataset¶ PowerBI Dataset Agent
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.powerbi.PowerBIDataset.html
34de80d10fd9-0
langchain.utilities.awslambda.LambdaWrapper¶ class langchain.utilities.awslambda.LambdaWrapper[source]¶ Bases: BaseModel Wrapper for AWS Lambda SDK. To use, you should have the boto3 package installed and a lambda functions built from the AWS Console or CLI. Set up your AWS credentials with aws configure Example pip install boto3 aws configure 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 awslambda_tool_description: Optional[str] = None¶ If passing to an agent as a tool, the description param awslambda_tool_name: Optional[str] = None¶ If passing to an agent as a tool, the tool name param function_name: Optional[str] = None¶ The name of your lambda function param lambda_client: Any = None¶ The configured boto3 client classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) → Model¶ Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, update: Optional[DictStrAny] = None, deep: bool = False) → Model¶ Duplicate a model, optionally choose which fields to include, exclude and change. Parameters include – fields to include in new model exclude – fields to exclude from new model, as with values this takes precedence over include
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.awslambda.LambdaWrapper.html
34de80d10fd9-1
exclude – fields to exclude from new model, as with values this takes precedence over include update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data deep – set to True to make a deep copy of the model Returns new model instance dict(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False) → DictStrAny¶ Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. classmethod from_orm(obj: Any) → Model¶ json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, encoder: Optional[Callable[[Any], Any]] = None, models_as_dict: bool = True, **dumps_kwargs: Any) → unicode¶ Generate a JSON representation of the model, include and exclude arguments as per dict(). encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps(). classmethod parse_file(path: Union[str, Path], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ classmethod parse_obj(obj: Any) → Model¶
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.awslambda.LambdaWrapper.html
34de80d10fd9-2
classmethod parse_obj(obj: Any) → Model¶ classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ run(query: str) → str[source]¶ Invokes the lambda function and returns the result. Parameters query – an input to passed to the lambda function as the body of a JSON object. classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶ classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶ classmethod update_forward_refs(**localns: Any) → None¶ Try to update ForwardRefs on fields based on this Model, globalns and localns. classmethod validate(value: Any) → Model¶
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.awslambda.LambdaWrapper.html
87f175d194a2-0
langchain.utilities.bash.BashProcess¶ class langchain.utilities.bash.BashProcess(strip_newlines: bool = False, return_err_output: bool = False, persistent: bool = False)[source]¶ Wrapper class for starting subprocesses. Uses the python built-in subprocesses.run() Persistent processes are not available on Windows systems, as pexpect makes use of Unix pseudoterminals (ptys). MacOS and Linux are okay. Example from langchain.utilities.bash import BashProcess bash = BashProcess(strip_newlines = False, return_err_output = False, persistent = False ) bash.run(‘echo ‘hello world’’) Initializes with default settings Attributes persistent Whether or not to spawn a persistent session NOTE: Unavailable for Windows environments return_err_output Whether or not to return the output of a failed command, or just the error message and stacktrace strip_newlines Whether or not to run .strip() on the output Methods __init__([strip_newlines, ...]) Initializes with default settings process_output(output, command) Uses regex to remove the command from the output run(commands) Run commands in either an existing persistent subprocess or on in a new subprocess environment. __init__(strip_newlines: bool = False, return_err_output: bool = False, persistent: bool = False)[source]¶ Initializes with default settings process_output(output: str, command: str) → str[source]¶ Uses regex to remove the command from the output Parameters output – a process’ output string command – the executed command run(commands: Union[str, List[str]]) → str[source]¶ Run commands in either an existing persistent subprocess or on in a new subprocess environment. Parameters commands (List[str]) – a list of commands to execute in the session
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.bash.BashProcess.html
87f175d194a2-1
Parameters commands (List[str]) – a list of commands to execute in the session Examples using BashProcess¶ Bash chain
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.bash.BashProcess.html
f00e3e0e3b7d-0
langchain.utilities.dataforseo_api_search.DataForSeoAPIWrapper¶ class langchain.utilities.dataforseo_api_search.DataForSeoAPIWrapper[source]¶ Bases: BaseModel Wrapper around the DataForSeo API. 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 aiosession: Optional[aiohttp.client.ClientSession] = None¶ The aiohttp session to use for the DataForSEO SERP API. param api_login: Optional[str] = None¶ The API login to use for the DataForSEO SERP API. param api_password: Optional[str] = None¶ The API password to use for the DataForSEO SERP API. param default_params: dict = {'depth': 10, 'language_code': 'en', 'location_name': 'United States', 'se_name': 'google', 'se_type': 'organic'}¶ Default parameters to use for the DataForSEO SERP API. param json_result_fields: Optional[list] = None¶ The JSON result fields. param json_result_types: Optional[list] = None¶ The JSON result types. param params: dict = {}¶ Additional parameters to pass to the DataForSEO SERP API. param top_count: Optional[int] = None¶ The number of top results to return. async aresults(url: str) → list[source]¶ async arun(url: str) → str[source]¶ Run request to DataForSEO SERP API and parse result async. classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) → Model¶ Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed.
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.dataforseo_api_search.DataForSeoAPIWrapper.html
f00e3e0e3b7d-1
Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, update: Optional[DictStrAny] = None, deep: bool = False) → Model¶ Duplicate a model, optionally choose which fields to include, exclude and change. Parameters include – fields to include in new model exclude – fields to exclude from new model, as with values this takes precedence over include update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data deep – set to True to make a deep copy of the model Returns new model instance dict(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False) → DictStrAny¶ Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. classmethod from_orm(obj: Any) → Model¶
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.dataforseo_api_search.DataForSeoAPIWrapper.html
f00e3e0e3b7d-2
classmethod from_orm(obj: Any) → Model¶ json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, encoder: Optional[Callable[[Any], Any]] = None, models_as_dict: bool = True, **dumps_kwargs: Any) → unicode¶ Generate a JSON representation of the model, include and exclude arguments as per dict(). encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps(). classmethod parse_file(path: Union[str, Path], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ classmethod parse_obj(obj: Any) → Model¶ classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ results(url: str) → list[source]¶ run(url: str) → str[source]¶ Run request to DataForSEO SERP API and parse result async. classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶ classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶ classmethod update_forward_refs(**localns: Any) → None¶ Try to update ForwardRefs on fields based on this Model, globalns and localns. classmethod validate(value: Any) → Model¶
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.dataforseo_api_search.DataForSeoAPIWrapper.html
f00e3e0e3b7d-3
classmethod validate(value: Any) → Model¶ Examples using DataForSeoAPIWrapper¶ DataForSeo API Wrapper DataForSEO
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.dataforseo_api_search.DataForSeoAPIWrapper.html
f9266f0fb278-0
langchain.utilities.requests.TextRequestsWrapper¶ class langchain.utilities.requests.TextRequestsWrapper[source]¶ Bases: BaseModel Lightweight wrapper around requests library. The main purpose of this wrapper is to always return a text output. 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 aiosession: Optional[aiohttp.client.ClientSession] = None¶ param auth: Optional[Any] = None¶ param headers: Optional[Dict[str, str]] = None¶ async adelete(url: str, **kwargs: Any) → str[source]¶ DELETE the URL and return the text asynchronously. async aget(url: str, **kwargs: Any) → str[source]¶ GET the URL and return the text asynchronously. async apatch(url: str, data: Dict[str, Any], **kwargs: Any) → str[source]¶ PATCH the URL and return the text asynchronously. async apost(url: str, data: Dict[str, Any], **kwargs: Any) → str[source]¶ POST to the URL and return the text asynchronously. async aput(url: str, data: Dict[str, Any], **kwargs: Any) → str[source]¶ PUT the URL and return the text asynchronously. classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) → Model¶ Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.requests.TextRequestsWrapper.html
f9266f0fb278-1
Behaves as if Config.extra = ‘allow’ was set since it adds all passed values copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, update: Optional[DictStrAny] = None, deep: bool = False) → Model¶ Duplicate a model, optionally choose which fields to include, exclude and change. Parameters include – fields to include in new model exclude – fields to exclude from new model, as with values this takes precedence over include update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data deep – set to True to make a deep copy of the model Returns new model instance delete(url: str, **kwargs: Any) → str[source]¶ DELETE the URL and return the text. dict(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False) → DictStrAny¶ Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. classmethod from_orm(obj: Any) → Model¶ get(url: str, **kwargs: Any) → str[source]¶ GET the URL and return the text.
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.requests.TextRequestsWrapper.html
f9266f0fb278-2
GET the URL and return the text. json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, encoder: Optional[Callable[[Any], Any]] = None, models_as_dict: bool = True, **dumps_kwargs: Any) → unicode¶ Generate a JSON representation of the model, include and exclude arguments as per dict(). encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps(). classmethod parse_file(path: Union[str, Path], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ classmethod parse_obj(obj: Any) → Model¶ classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ patch(url: str, data: Dict[str, Any], **kwargs: Any) → str[source]¶ PATCH the URL and return the text. post(url: str, data: Dict[str, Any], **kwargs: Any) → str[source]¶ POST to the URL and return the text. put(url: str, data: Dict[str, Any], **kwargs: Any) → str[source]¶ PUT the URL and return the text. classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.requests.TextRequestsWrapper.html
f9266f0fb278-3
classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶ classmethod update_forward_refs(**localns: Any) → None¶ Try to update ForwardRefs on fields based on this Model, globalns and localns. classmethod validate(value: Any) → Model¶ property requests: langchain.utilities.requests.Requests¶ Examples using TextRequestsWrapper¶ Requests JSON Agent OpenAPI agents Tool Input Schema
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.requests.TextRequestsWrapper.html
32ca717df4b4-0
langchain.utilities.vertexai.init_vertexai¶ langchain.utilities.vertexai.init_vertexai(project: Optional[str] = None, location: Optional[str] = None, credentials: Optional[Credentials] = None) → None[source]¶ Init vertexai. Parameters project – The default GCP project to use when making Vertex API calls. location – The default location to use when making API calls. credentials – The default custom credentials to use when making API calls. If not provided credentials will be ascertained from the environment. Raises ImportError – If importing vertexai SDK did not succeed.
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.vertexai.init_vertexai.html
7102de8013a2-0
langchain.utilities.openapi.OpenAPISpec¶ class langchain.utilities.openapi.OpenAPISpec[source]¶ Bases: OpenAPI OpenAPI Model that removes misformatted parts of the spec. 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 components: Optional[openapi_schema_pydantic.v3.v3_1_0.components.Components] = None¶ An element to hold various schemas for the document. param externalDocs: Optional[openapi_schema_pydantic.v3.v3_1_0.external_documentation.ExternalDocumentation] = None¶ Additional external documentation. param 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. param 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. param 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. param paths: Optional[Dict[str, openapi_schema_pydantic.v3.v3_1_0.path_item.PathItem]] = None¶ The available paths and operations for the API. param security: Optional[List[Dict[str, List[str]]]] = None¶ A declaration of which security mechanisms can be used across the API.
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.openapi.OpenAPISpec.html
7102de8013a2-1
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. param 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 /. param 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. param 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,
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.openapi.OpenAPISpec.html
7102de8013a2-2
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 construct(_fields_set: Optional[SetStr] = None, **values: Any) → Model¶ Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, update: Optional[DictStrAny] = None, deep: bool = False) → Model¶ Duplicate a model, optionally choose which fields to include, exclude and change. Parameters include – fields to include in new model exclude – fields to exclude from new model, as with values this takes precedence over include update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data deep – set to True to make a deep copy of the model Returns new model instance dict(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False) → DictStrAny¶ Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.openapi.OpenAPISpec.html
7102de8013a2-3
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. classmethod from_file(path: Union[str, Path]) → OpenAPISpec[source]¶ Get an OpenAPI spec from a file path. classmethod from_orm(obj: Any) → Model¶ classmethod from_spec_dict(spec_dict: dict) → OpenAPISpec[source]¶ Get an OpenAPI spec from a dict. classmethod from_text(text: str) → OpenAPISpec[source]¶ Get an OpenAPI spec from a text. classmethod from_url(url: str) → OpenAPISpec[source]¶ Get an OpenAPI spec from a URL. static get_cleaned_operation_id(operation: Operation, path: str, method: str) → str[source]¶ Get a cleaned operation id from an operation id. get_methods_for_path(path: str) → List[str][source]¶ Return a list of valid methods for the specified path. get_operation(path: str, method: str) → Operation[source]¶ Get the operation object for a given path and HTTP method. get_parameters_for_operation(operation: Operation) → List[Parameter][source]¶ Get the components for a given operation. get_parameters_for_path(path: str) → List[Parameter][source]¶ get_referenced_schema(ref: Reference) → Schema[source]¶ Get a schema (or nested reference) or err. get_request_body_for_operation(operation: Operation) → Optional[RequestBody][source]¶ Get the request body for a given operation. get_schema(schema: Union[Reference, Schema]) → Schema[source]¶
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.openapi.OpenAPISpec.html
7102de8013a2-4
get_schema(schema: Union[Reference, Schema]) → Schema[source]¶ json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, encoder: Optional[Callable[[Any], Any]] = None, models_as_dict: bool = True, **dumps_kwargs: Any) → unicode¶ Generate a JSON representation of the model, include and exclude arguments as per dict(). encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps(). classmethod parse_file(path: Union[str, Path], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ classmethod parse_obj(obj: dict) → OpenAPISpec[source]¶ classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶ classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶ classmethod update_forward_refs(**localns: Any) → None¶ Try to update ForwardRefs on fields based on this Model, globalns and localns. classmethod validate(value: Any) → Model¶ property base_url: str¶ Get the base url. Examples using OpenAPISpec¶ Natural Language APIs
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.openapi.OpenAPISpec.html
7102de8013a2-5
Get the base url. Examples using OpenAPISpec¶ Natural Language APIs Evaluating an OpenAPI Chain OpenAPI chain
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.openapi.OpenAPISpec.html
a549033b0d78-0
langchain.utilities.google_search.GoogleSearchAPIWrapper¶ class langchain.utilities.google_search.GoogleSearchAPIWrapper[source]¶ Bases: BaseModel Wrapper for Google Search API. Adapted from: Instructions adapted from https://stackoverflow.com/questions/ 37083058/ programmatically-searching-google-in-python-using-custom-search TODO: DOCS for using it 1. Install google-api-python-client - If you don’t already have a Google account, sign up. - If you have never created a Google APIs Console project, read the Managing Projects page and create a project in the Google API Console. - Install the library using pip install google-api-python-client The current version of the library is 2.70.0 at this time 2. To create an API key: - Navigate to the APIs & Services→Credentials panel in Cloud Console. - Select Create credentials, then select API key from the drop-down menu. - The API key created dialog box displays your newly created key. - You now have an API_KEY 3. Setup Custom Search Engine so you can search the entire web - Create a custom search engine in this link. - In Sites to search, add any valid URL (i.e. www.stackoverflow.com). - That’s all you have to fill up, the rest doesn’t matter. In the left-side menu, click Edit search engine → {your search engine name} → Setup Set Search the entire web to ON. Remove the URL you added from the list of Sites to search. - Under Search engine ID you’ll find the search-engine-ID. 4. Enable the Custom Search API - Navigate to the APIs & Services→Dashboard panel in Cloud Console. - Click Enable APIs and Services. - Search for Custom Search API and click on it. - Click Enable.
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.google_search.GoogleSearchAPIWrapper.html
a549033b0d78-1
- Search for Custom Search API and click on it. - Click Enable. URL for it: https://console.cloud.google.com/apis/library/customsearch.googleapis .com 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 google_api_key: Optional[str] = None¶ param google_cse_id: Optional[str] = None¶ param k: int = 10¶ param siterestrict: bool = False¶ classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) → Model¶ Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, update: Optional[DictStrAny] = None, deep: bool = False) → Model¶ Duplicate a model, optionally choose which fields to include, exclude and change. Parameters include – fields to include in new model exclude – fields to exclude from new model, as with values this takes precedence over include update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data deep – set to True to make a deep copy of the model Returns new model instance
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.google_search.GoogleSearchAPIWrapper.html
a549033b0d78-2
deep – set to True to make a deep copy of the model Returns new model instance dict(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False) → DictStrAny¶ Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. classmethod from_orm(obj: Any) → Model¶ json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, encoder: Optional[Callable[[Any], Any]] = None, models_as_dict: bool = True, **dumps_kwargs: Any) → unicode¶ Generate a JSON representation of the model, include and exclude arguments as per dict(). encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps(). classmethod parse_file(path: Union[str, Path], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ classmethod parse_obj(obj: Any) → Model¶ classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.google_search.GoogleSearchAPIWrapper.html
a549033b0d78-3
results(query: str, num_results: int, search_params: Optional[Dict[str, str]] = None) → List[Dict][source]¶ Run query through GoogleSearch and return metadata. Parameters query – The query to search for. num_results – The number of results to return. search_params – Parameters to be passed on search Returns snippet - The description of the result. title - The title of the result. link - The link to the result. Return type A list of dictionaries with the following keys run(query: str) → str[source]¶ Run query through GoogleSearch and parse result. classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶ classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶ classmethod update_forward_refs(**localns: Any) → None¶ Try to update ForwardRefs on fields based on this Model, globalns and localns. classmethod validate(value: Any) → Model¶ Examples using GoogleSearchAPIWrapper¶ Google Search WebResearchRetriever Adding Message Memory backed by a database to an Agent How to add Memory to an Agent Shared memory across agents and tools
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.google_search.GoogleSearchAPIWrapper.html
f8f2552b1c97-0
langchain.utilities.requests.RequestsWrapper¶ langchain.utilities.requests.RequestsWrapper¶ alias of TextRequestsWrapper Examples using RequestsWrapper¶ OpenAPI agents
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.requests.RequestsWrapper.html
f3ec53fc7b8a-0
langchain.utilities.sql_database.truncate_word¶ langchain.utilities.sql_database.truncate_word(content: Any, *, length: int, suffix: str = '...') → str[source]¶ Truncate a string to a certain number of words, based on the max string length.
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.sql_database.truncate_word.html
843eb9d8566f-0
langchain.utilities.searx_search.SearxSearchWrapper¶ class langchain.utilities.searx_search.SearxSearchWrapper[source]¶ Bases: BaseModel Wrapper for Searx API. To use you need to provide the searx host by passing the named parameter searx_host or exporting the environment variable SEARX_HOST. In some situations you might want to disable SSL verification, for example if you are running searx locally. You can do this by passing the named parameter unsecure. You can also pass the host url scheme as http to disable SSL. Example from langchain.utilities import SearxSearchWrapper searx = SearxSearchWrapper(searx_host="http://localhost:8888") Example with SSL disabled:from langchain.utilities import SearxSearchWrapper # note the unsecure parameter is not needed if you pass the url scheme as # http searx = SearxSearchWrapper(searx_host="http://localhost:8888", unsecure=True) 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 aiosession: Optional[Any] = None¶ param categories: Optional[List[str]] = []¶ param engines: Optional[List[str]] = []¶ param headers: Optional[dict] = None¶ param k: int = 10¶ param params: dict [Optional]¶ param query_suffix: Optional[str] = ''¶ param searx_host: str = ''¶ param unsecure: bool = False¶ async aresults(query: str, num_results: int, engines: Optional[List[str]] = None, query_suffix: Optional[str] = '', **kwargs: Any) → List[Dict][source]¶
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.searx_search.SearxSearchWrapper.html
843eb9d8566f-1
Asynchronously query with json results. Uses aiohttp. See results for more info. async arun(query: str, engines: Optional[List[str]] = None, query_suffix: Optional[str] = '', **kwargs: Any) → str[source]¶ Asynchronously version of run. classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) → Model¶ Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, update: Optional[DictStrAny] = None, deep: bool = False) → Model¶ Duplicate a model, optionally choose which fields to include, exclude and change. Parameters include – fields to include in new model exclude – fields to exclude from new model, as with values this takes precedence over include update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data deep – set to True to make a deep copy of the model Returns new model instance dict(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False) → DictStrAny¶ Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.searx_search.SearxSearchWrapper.html
843eb9d8566f-2
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. classmethod from_orm(obj: Any) → Model¶ json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, encoder: Optional[Callable[[Any], Any]] = None, models_as_dict: bool = True, **dumps_kwargs: Any) → unicode¶ Generate a JSON representation of the model, include and exclude arguments as per dict(). encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps(). classmethod parse_file(path: Union[str, Path], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ classmethod parse_obj(obj: Any) → Model¶ classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ results(query: str, num_results: int, engines: Optional[List[str]] = None, categories: Optional[List[str]] = None, query_suffix: Optional[str] = '', **kwargs: Any) → List[Dict][source]¶ Run query through Searx API and returns the results with metadata. Parameters query – The query to search for. query_suffix – Extra suffix appended to the query. num_results – Limit the number of results to return. engines – List of engines to use for the query. categories – List of categories to use for the query.
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.searx_search.SearxSearchWrapper.html
843eb9d8566f-3
categories – List of categories to use for the query. **kwargs – extra parameters to pass to the searx API. Returns {snippet: The description of the result. title: The title of the result. link: The link to the result. engines: The engines used for the result. category: Searx category of the result. } Return type Dict with the following keys run(query: str, engines: Optional[List[str]] = None, categories: Optional[List[str]] = None, query_suffix: Optional[str] = '', **kwargs: Any) → str[source]¶ Run query through Searx API and parse results. You can pass any other params to the searx query API. Parameters query – The query to search for. query_suffix – Extra suffix appended to the query. engines – List of engines to use for the query. categories – List of categories to use for the query. **kwargs – extra parameters to pass to the searx API. Returns The result of the query. Return type str Raises ValueError – If an error occurred with the query. Example This will make a query to the qwant engine: from langchain.utilities import SearxSearchWrapper searx = SearxSearchWrapper(searx_host="http://my.searx.host") searx.run("what is the weather in France ?", engine="qwant") # the same result can be achieved using the `!` syntax of searx # to select the engine using `query_suffix` searx.run("what is the weather in France ?", query_suffix="!qwant") classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.searx_search.SearxSearchWrapper.html
843eb9d8566f-4
classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶ classmethod update_forward_refs(**localns: Any) → None¶ Try to update ForwardRefs on fields based on this Model, globalns and localns. classmethod validate(value: Any) → Model¶ Examples using SearxSearchWrapper¶ SearxNG Search API
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.searx_search.SearxSearchWrapper.html
47feaba66291-0
langchain.utilities.google_places_api.GooglePlacesAPIWrapper¶ class langchain.utilities.google_places_api.GooglePlacesAPIWrapper[source]¶ Bases: BaseModel Wrapper around Google Places API. To use, you should have the googlemaps python package installed,an API key for the google maps platform, and the environment variable ‘’GPLACES_API_KEY’’ set with your API key , or pass ‘gplaces_api_key’ as a named parameter to the constructor. By default, this will return the all the results on the input query.You can use the top_k_results argument to limit the number of results. Example from langchain import GooglePlacesAPIWrapper gplaceapi = GooglePlacesAPIWrapper() 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 gplaces_api_key: Optional[str] = None¶ param top_k_results: Optional[int] = None¶ classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) → Model¶ Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, update: Optional[DictStrAny] = None, deep: bool = False) → Model¶ Duplicate a model, optionally choose which fields to include, exclude and change. Parameters include – fields to include in new model exclude – fields to exclude from new model, as with values this takes precedence over include
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.google_places_api.GooglePlacesAPIWrapper.html
47feaba66291-1
exclude – fields to exclude from new model, as with values this takes precedence over include update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data deep – set to True to make a deep copy of the model Returns new model instance dict(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False) → DictStrAny¶ Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. fetch_place_details(place_id: str) → Optional[str][source]¶ format_place_details(place_details: Dict[str, Any]) → Optional[str][source]¶ classmethod from_orm(obj: Any) → Model¶ json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, encoder: Optional[Callable[[Any], Any]] = None, models_as_dict: bool = True, **dumps_kwargs: Any) → unicode¶ Generate a JSON representation of the model, include and exclude arguments as per dict(). encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps().
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.google_places_api.GooglePlacesAPIWrapper.html
47feaba66291-2
classmethod parse_file(path: Union[str, Path], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ classmethod parse_obj(obj: Any) → Model¶ classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ run(query: str) → str[source]¶ Run Places search and get k number of places that exists that match. classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶ classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶ classmethod update_forward_refs(**localns: Any) → None¶ Try to update ForwardRefs on fields based on this Model, globalns and localns. classmethod validate(value: Any) → Model¶
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.google_places_api.GooglePlacesAPIWrapper.html
1e6fd0ccb00a-0
langchain.utilities.spark_sql.SparkSQL¶ class langchain.utilities.spark_sql.SparkSQL(spark_session: Optional[SparkSession] = None, catalog: Optional[str] = None, schema: Optional[str] = None, ignore_tables: Optional[List[str]] = None, include_tables: Optional[List[str]] = None, sample_rows_in_table_info: int = 3)[source]¶ Methods __init__([spark_session, catalog, schema, ...]) from_uri(database_uri[, engine_args]) Creating a remote Spark Session via Spark connect. get_table_info([table_names]) get_table_info_no_throw([table_names]) Get information about specified tables. get_usable_table_names() Get names of tables available. run(command[, fetch]) run_no_throw(command[, fetch]) Execute a SQL command and return a string representing the results. __init__(spark_session: Optional[SparkSession] = None, catalog: Optional[str] = None, schema: Optional[str] = None, ignore_tables: Optional[List[str]] = None, include_tables: Optional[List[str]] = None, sample_rows_in_table_info: int = 3)[source]¶ classmethod from_uri(database_uri: str, engine_args: Optional[dict] = None, **kwargs: Any) → SparkSQL[source]¶ Creating a remote Spark Session via Spark connect. For example: SparkSQL.from_uri(“sc://localhost:15002”) get_table_info(table_names: Optional[List[str]] = None) → str[source]¶ get_table_info_no_throw(table_names: Optional[List[str]] = None) → str[source]¶ Get information about specified tables. Follows best practices as specified in: Rajkumar et al, 2022 (https://arxiv.org/abs/2204.00498)
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.spark_sql.SparkSQL.html
1e6fd0ccb00a-1
(https://arxiv.org/abs/2204.00498) If sample_rows_in_table_info, the specified number of sample rows will be appended to each table description. This can increase performance as demonstrated in the paper. get_usable_table_names() → Iterable[str][source]¶ Get names of tables available. run(command: str, fetch: str = 'all') → str[source]¶ run_no_throw(command: str, fetch: str = 'all') → str[source]¶ Execute a SQL command and return a string representing the results. If the statement returns rows, a string of the results is returned. If the statement returns no rows, an empty string is returned. If the statement throws an error, the error message is returned. Examples using SparkSQL¶ Spark SQL Agent
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.spark_sql.SparkSQL.html
7ec9e884ef02-0
langchain.utilities.openapi.HTTPVerb¶ class langchain.utilities.openapi.HTTPVerb(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶ Enumerator of the HTTP verbs. GET = 'get'¶ PUT = 'put'¶ POST = 'post'¶ DELETE = 'delete'¶ OPTIONS = 'options'¶ HEAD = 'head'¶ PATCH = 'patch'¶ TRACE = 'trace'¶
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.openapi.HTTPVerb.html
82e628af0d76-0
langchain.utilities.serpapi.HiddenPrints¶ class langchain.utilities.serpapi.HiddenPrints[source]¶ Context manager to hide prints. Methods __init__() __init__()¶
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.serpapi.HiddenPrints.html
9da6245029fd-0
langchain.utilities.vertexai.raise_vertex_import_error¶ langchain.utilities.vertexai.raise_vertex_import_error(minimum_expected_version: str = '1.26.1') → None[source]¶ Raise ImportError related to Vertex SDK being not available. Parameters minimum_expected_version – The lowest expected version of the SDK. Raises ImportError – an ImportError that mentions a required version of the SDK.
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.vertexai.raise_vertex_import_error.html
001005012986-0
langchain.utilities.portkey.Portkey¶ class langchain.utilities.portkey.Portkey[source]¶ Attributes base Methods Config(api_key[, trace_id, environment, ...]) __init__() static Config(api_key: str, trace_id: Optional[str] = None, environment: Optional[str] = None, user: Optional[str] = None, organisation: Optional[str] = None, prompt: Optional[str] = None, retry_count: Optional[int] = None, cache: Optional[str] = None, cache_force_refresh: Optional[str] = None, cache_age: Optional[int] = None) → Dict[str, str][source]¶ __init__()¶ Examples using Portkey¶ Log, Trace, and Monitor Langchain LLM Calls Portkey
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.portkey.Portkey.html
b3a823c9078f-0
langchain.utilities.metaphor_search.MetaphorSearchAPIWrapper¶ class langchain.utilities.metaphor_search.MetaphorSearchAPIWrapper[source]¶ Bases: BaseModel Wrapper for Metaphor Search API. 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 k: int = 10¶ param metaphor_api_key: str [Required]¶ classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) → Model¶ Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, update: Optional[DictStrAny] = None, deep: bool = False) → Model¶ Duplicate a model, optionally choose which fields to include, exclude and change. Parameters include – fields to include in new model exclude – fields to exclude from new model, as with values this takes precedence over include update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data deep – set to True to make a deep copy of the model Returns new model instance
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.metaphor_search.MetaphorSearchAPIWrapper.html
b3a823c9078f-1
deep – set to True to make a deep copy of the model Returns new model instance dict(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False) → DictStrAny¶ Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. classmethod from_orm(obj: Any) → Model¶ json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, encoder: Optional[Callable[[Any], Any]] = None, models_as_dict: bool = True, **dumps_kwargs: Any) → unicode¶ Generate a JSON representation of the model, include and exclude arguments as per dict(). encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps(). classmethod parse_file(path: Union[str, Path], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ classmethod parse_obj(obj: Any) → Model¶ classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.metaphor_search.MetaphorSearchAPIWrapper.html
b3a823c9078f-2
results(query: str, num_results: int, include_domains: Optional[List[str]] = None, exclude_domains: Optional[List[str]] = None, start_crawl_date: Optional[str] = None, end_crawl_date: Optional[str] = None, start_published_date: Optional[str] = None, end_published_date: Optional[str] = None, use_autoprompt: Optional[bool] = None) → List[Dict][source]¶ Run query through Metaphor Search and return metadata. Parameters query – The query to search for. num_results – The number of results to return. include_domains – A list of domains to include in the search. Only one of include_domains and exclude_domains should be defined. exclude_domains – A list of domains to exclude from the search. Only one of include_domains and exclude_domains should be defined. start_crawl_date – If specified, only pages we crawled after start_crawl_date will be returned. end_crawl_date – If specified, only pages we crawled before end_crawl_date will be returned. start_published_date – If specified, only pages published after start_published_date will be returned. end_published_date – If specified, only pages published before end_published_date will be returned. use_autoprompt – If true, we turn your query into a more Metaphor-friendly query. Adds latency. Returns title - The title of the page url - The url author - Author of the content, if applicable. Otherwise, None. published_date - Estimated date published in YYYY-MM-DD format. Otherwise, None. Return type A list of dictionaries with the following keys
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.metaphor_search.MetaphorSearchAPIWrapper.html
b3a823c9078f-3
Return type A list of dictionaries with the following keys async results_async(query: str, num_results: int, include_domains: Optional[List[str]] = None, exclude_domains: Optional[List[str]] = None, start_crawl_date: Optional[str] = None, end_crawl_date: Optional[str] = None, start_published_date: Optional[str] = None, end_published_date: Optional[str] = None, use_autoprompt: Optional[bool] = None) → List[Dict][source]¶ Get results from the Metaphor Search API asynchronously. classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶ classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶ classmethod update_forward_refs(**localns: Any) → None¶ Try to update ForwardRefs on fields based on this Model, globalns and localns. classmethod validate(value: Any) → Model¶ Examples using MetaphorSearchAPIWrapper¶ Metaphor Search
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.metaphor_search.MetaphorSearchAPIWrapper.html
15cfb071b782-0
langchain.utilities.duckduckgo_search.DuckDuckGoSearchAPIWrapper¶ class langchain.utilities.duckduckgo_search.DuckDuckGoSearchAPIWrapper[source]¶ Bases: BaseModel Wrapper for DuckDuckGo Search API. Free and does not require any setup. 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 max_results: int = 5¶ param region: Optional[str] = 'wt-wt'¶ param safesearch: str = 'moderate'¶ param time: Optional[str] = 'y'¶ classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) → Model¶ Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, update: Optional[DictStrAny] = None, deep: bool = False) → Model¶ Duplicate a model, optionally choose which fields to include, exclude and change. Parameters include – fields to include in new model exclude – fields to exclude from new model, as with values this takes precedence over include update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data deep – set to True to make a deep copy of the model Returns new model instance
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.duckduckgo_search.DuckDuckGoSearchAPIWrapper.html
15cfb071b782-1
deep – set to True to make a deep copy of the model Returns new model instance dict(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False) → DictStrAny¶ Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. classmethod from_orm(obj: Any) → Model¶ get_snippets(query: str) → List[str][source]¶ Run query through DuckDuckGo and return concatenated results. json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, encoder: Optional[Callable[[Any], Any]] = None, models_as_dict: bool = True, **dumps_kwargs: Any) → unicode¶ Generate a JSON representation of the model, include and exclude arguments as per dict(). encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps(). classmethod parse_file(path: Union[str, Path], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ classmethod parse_obj(obj: Any) → Model¶
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.duckduckgo_search.DuckDuckGoSearchAPIWrapper.html
15cfb071b782-2
classmethod parse_obj(obj: Any) → Model¶ classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ results(query: str, num_results: int, backend: str = 'api') → List[Dict[str, str]][source]¶ Run query through DuckDuckGo and return metadata. Parameters query – The query to search for. num_results – The number of results to return. Returns snippet - The description of the result. title - The title of the result. link - The link to the result. Return type A list of dictionaries with the following keys run(query: str) → str[source]¶ classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶ classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶ classmethod update_forward_refs(**localns: Any) → None¶ Try to update ForwardRefs on fields based on this Model, globalns and localns. classmethod validate(value: Any) → Model¶ Examples using DuckDuckGoSearchAPIWrapper¶ DuckDuckGo Search
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.duckduckgo_search.DuckDuckGoSearchAPIWrapper.html
8b3a3f47a917-0
langchain.utilities.max_compute.MaxComputeAPIWrapper¶ class langchain.utilities.max_compute.MaxComputeAPIWrapper(client: ODPS)[source]¶ Interface for querying Alibaba Cloud MaxCompute tables. Initialize MaxCompute document loader. Parameters client – odps.ODPS MaxCompute client object. Methods __init__(client) Initialize MaxCompute document loader. from_params(endpoint, project, *[, ...]) Convenience constructor that builds the odsp.ODPS MaxCompute client from lazy_query(query) query(query) __init__(client: ODPS)[source]¶ Initialize MaxCompute document loader. Parameters client – odps.ODPS MaxCompute client object. classmethod from_params(endpoint: str, project: str, *, access_id: Optional[str] = None, secret_access_key: Optional[str] = None) → MaxComputeAPIWrapper[source]¶ Convenience constructor that builds the odsp.ODPS MaxCompute client fromgiven parameters. Parameters endpoint – MaxCompute endpoint. project – A project is a basic organizational unit of MaxCompute, which is similar to a database. access_id – MaxCompute access ID. Should be passed in directly or set as the environment variable MAX_COMPUTE_ACCESS_ID. secret_access_key – MaxCompute secret access key. Should be passed in directly or set as the environment variable MAX_COMPUTE_SECRET_ACCESS_KEY. lazy_query(query: str) → Iterator[dict][source]¶ query(query: str) → List[dict][source]¶
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.max_compute.MaxComputeAPIWrapper.html
ed53c937c048-0
langchain.utilities.pubmed.PubMedAPIWrapper¶ class langchain.utilities.pubmed.PubMedAPIWrapper[source]¶ Bases: BaseModel Wrapper around PubMed API. This wrapper will use the PubMed API to conduct searches and fetch document summaries. By default, it will return the document summaries of the top-k results of an input search. Parameters top_k_results – number of the top-scored document used for the PubMed tool MAX_QUERY_LENGTH – maximum length of the query. Default is 300 characters. doc_content_chars_max – maximum length of the document content. Content will be truncated if it exceeds this length. Default is 2000 characters. max_retry – maximum number of retries for a request. Default is 5. sleep_time – time to wait between retries. Default is 0.2 seconds. email – email address to be used for the PubMed API. 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 doc_content_chars_max: int = 2000¶ param email: str = 'your_email@example.com'¶ param top_k_results: int = 3¶ classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) → Model¶ Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, update: Optional[DictStrAny] = None, deep: bool = False) → Model¶
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.pubmed.PubMedAPIWrapper.html
ed53c937c048-1
Duplicate a model, optionally choose which fields to include, exclude and change. Parameters include – fields to include in new model exclude – fields to exclude from new model, as with values this takes precedence over include update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data deep – set to True to make a deep copy of the model Returns new model instance dict(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False) → DictStrAny¶ Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. classmethod from_orm(obj: Any) → Model¶ json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, encoder: Optional[Callable[[Any], Any]] = None, models_as_dict: bool = True, **dumps_kwargs: Any) → unicode¶ Generate a JSON representation of the model, include and exclude arguments as per dict(). encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps(). lazy_load(query: str) → Iterator[dict][source]¶ Search PubMed for documents matching the query. Return an iterator of dictionaries containing the document metadata.
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.pubmed.PubMedAPIWrapper.html
ed53c937c048-2
Search PubMed for documents matching the query. Return an iterator of dictionaries containing the document metadata. lazy_load_docs(query: str) → Iterator[Document][source]¶ load(query: str) → List[dict][source]¶ Search PubMed for documents matching the query. Return a list of dictionaries containing the document metadata. load_docs(query: str) → List[Document][source]¶ classmethod parse_file(path: Union[str, Path], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ classmethod parse_obj(obj: Any) → Model¶ classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ retrieve_article(uid: str, webenv: str) → dict[source]¶ run(query: str) → str[source]¶ Run PubMed search and get the article meta information. See https://www.ncbi.nlm.nih.gov/books/NBK25499/#chapter4.ESearch It uses only the most informative fields of article meta information. classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶ classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶ classmethod update_forward_refs(**localns: Any) → None¶ Try to update ForwardRefs on fields based on this Model, globalns and localns. classmethod validate(value: Any) → Model¶
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.pubmed.PubMedAPIWrapper.html
c16d3c4f76f0-0
langchain.utilities.openweathermap.OpenWeatherMapAPIWrapper¶ class langchain.utilities.openweathermap.OpenWeatherMapAPIWrapper[source]¶ Bases: BaseModel Wrapper for OpenWeatherMap API using PyOWM. Docs for using: Go to OpenWeatherMap and sign up for an API key Save your API KEY into OPENWEATHERMAP_API_KEY env variable pip install pyowm 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 openweathermap_api_key: Optional[str] = None¶ param owm: Any = None¶ classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) → Model¶ Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, update: Optional[DictStrAny] = None, deep: bool = False) → Model¶ Duplicate a model, optionally choose which fields to include, exclude and change. Parameters include – fields to include in new model exclude – fields to exclude from new model, as with values this takes precedence over include update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data deep – set to True to make a deep copy of the model Returns new model instance
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.openweathermap.OpenWeatherMapAPIWrapper.html
c16d3c4f76f0-1
deep – set to True to make a deep copy of the model Returns new model instance dict(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False) → DictStrAny¶ Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. classmethod from_orm(obj: Any) → Model¶ json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, encoder: Optional[Callable[[Any], Any]] = None, models_as_dict: bool = True, **dumps_kwargs: Any) → unicode¶ Generate a JSON representation of the model, include and exclude arguments as per dict(). encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps(). classmethod parse_file(path: Union[str, Path], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ classmethod parse_obj(obj: Any) → Model¶ classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ run(location: str) → str[source]¶
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.openweathermap.OpenWeatherMapAPIWrapper.html
c16d3c4f76f0-2
run(location: str) → str[source]¶ Get the current weather information for a specified location. classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶ classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶ classmethod update_forward_refs(**localns: Any) → None¶ Try to update ForwardRefs on fields based on this Model, globalns and localns. classmethod validate(value: Any) → Model¶ Examples using OpenWeatherMapAPIWrapper¶ OpenWeatherMap API OpenWeatherMap
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.openweathermap.OpenWeatherMapAPIWrapper.html
91b4233fe0f8-0
langchain.utilities.golden_query.GoldenQueryAPIWrapper¶ class langchain.utilities.golden_query.GoldenQueryAPIWrapper[source]¶ Bases: BaseModel Wrapper for Golden. Docs for using: Go to https://golden.com and sign up for an account Get your API Key from https://golden.com/settings/api Save your API Key into GOLDEN_API_KEY env variable 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 golden_api_key: Optional[str] = None¶ classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) → Model¶ Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, update: Optional[DictStrAny] = None, deep: bool = False) → Model¶ Duplicate a model, optionally choose which fields to include, exclude and change. Parameters include – fields to include in new model exclude – fields to exclude from new model, as with values this takes precedence over include update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data deep – set to True to make a deep copy of the model Returns new model instance
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.golden_query.GoldenQueryAPIWrapper.html
91b4233fe0f8-1
deep – set to True to make a deep copy of the model Returns new model instance dict(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False) → DictStrAny¶ Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. classmethod from_orm(obj: Any) → Model¶ json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, encoder: Optional[Callable[[Any], Any]] = None, models_as_dict: bool = True, **dumps_kwargs: Any) → unicode¶ Generate a JSON representation of the model, include and exclude arguments as per dict(). encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps(). classmethod parse_file(path: Union[str, Path], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ classmethod parse_obj(obj: Any) → Model¶ classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ run(query: str) → str[source]¶
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.golden_query.GoldenQueryAPIWrapper.html
91b4233fe0f8-2
run(query: str) → str[source]¶ Run query through Golden Query API and return the JSON raw result. classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶ classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶ classmethod update_forward_refs(**localns: Any) → None¶ Try to update ForwardRefs on fields based on this Model, globalns and localns. classmethod validate(value: Any) → Model¶ Examples using GoldenQueryAPIWrapper¶ Golden Query Golden
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.golden_query.GoldenQueryAPIWrapper.html
ceeb2e37533e-0
langchain.utilities.bing_search.BingSearchAPIWrapper¶ class langchain.utilities.bing_search.BingSearchAPIWrapper[source]¶ Bases: BaseModel Wrapper for Bing Search API. In order to set this up, follow instructions at: https://levelup.gitconnected.com/api-tutorial-how-to-use-bing-web-search-api-in-python-4165d5592a7e 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 bing_search_url: str [Required]¶ param bing_subscription_key: str [Required]¶ param k: int = 10¶ classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) → Model¶ Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, update: Optional[DictStrAny] = None, deep: bool = False) → Model¶ Duplicate a model, optionally choose which fields to include, exclude and change. Parameters include – fields to include in new model exclude – fields to exclude from new model, as with values this takes precedence over include update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data deep – set to True to make a deep copy of the model Returns new model instance
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.bing_search.BingSearchAPIWrapper.html
ceeb2e37533e-1
deep – set to True to make a deep copy of the model Returns new model instance dict(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False) → DictStrAny¶ Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. classmethod from_orm(obj: Any) → Model¶ json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, encoder: Optional[Callable[[Any], Any]] = None, models_as_dict: bool = True, **dumps_kwargs: Any) → unicode¶ Generate a JSON representation of the model, include and exclude arguments as per dict(). encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps(). classmethod parse_file(path: Union[str, Path], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ classmethod parse_obj(obj: Any) → Model¶ classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ results(query: str, num_results: int) → List[Dict][source]¶
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.bing_search.BingSearchAPIWrapper.html
ceeb2e37533e-2
results(query: str, num_results: int) → List[Dict][source]¶ Run query through BingSearch and return metadata. Parameters query – The query to search for. num_results – The number of results to return. Returns snippet - The description of the result. title - The title of the result. link - The link to the result. Return type A list of dictionaries with the following keys run(query: str) → str[source]¶ Run query through BingSearch and parse result. classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶ classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶ classmethod update_forward_refs(**localns: Any) → None¶ Try to update ForwardRefs on fields based on this Model, globalns and localns. classmethod validate(value: Any) → Model¶ Examples using BingSearchAPIWrapper¶ Bing Search
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.bing_search.BingSearchAPIWrapper.html
7240f790fad0-0
langchain.utilities.searx_search.SearxResults¶ class langchain.utilities.searx_search.SearxResults(data: str)[source]¶ Dict like wrapper around search api results. Take a raw result from Searx and make it into a dict like object. Attributes answers Helper accessor on the json result. results Silence mypy for accessing this field. Methods __init__(data) Take a raw result from Searx and make it into a dict like object. clear() copy() fromkeys([value]) Create a new dictionary with keys from iterable and values set to value. get(key[, default]) Return the value for key if key is in the dictionary, else default. items() keys() pop(k[,d]) If the key is not found, return the default if given; otherwise, raise a KeyError. popitem() Remove and return a (key, value) pair as a 2-tuple. setdefault(key[, default]) Insert key with a value of default if key is not in the dictionary. update([E, ]**F) If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k] values() __init__(data: str)[source]¶ Take a raw result from Searx and make it into a dict like object. clear() → None.  Remove all items from D.¶ copy() → a shallow copy of D¶ fromkeys(value=None, /)¶
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.searx_search.SearxResults.html
7240f790fad0-1
copy() → a shallow copy of D¶ fromkeys(value=None, /)¶ Create a new dictionary with keys from iterable and values set to value. get(key, default=None, /)¶ Return the value for key if key is in the dictionary, else default. items() → a set-like object providing a view on D's items¶ keys() → a set-like object providing a view on D's keys¶ pop(k[, d]) → v, remove specified key and return the corresponding value.¶ If the key is not found, return the default if given; otherwise, raise a KeyError. popitem()¶ Remove and return a (key, value) pair as a 2-tuple. Pairs are returned in LIFO (last-in, first-out) order. Raises KeyError if the dict is empty. setdefault(key, default=None, /)¶ Insert key with a value of default if key is not in the dictionary. Return the value for key if key is in the dictionary, else default. update([E, ]**F) → None.  Update D from dict/iterable E and F.¶ If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k] values() → an object providing a view on D's values¶
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.searx_search.SearxResults.html
e81646f17cd4-0
langchain.utilities.dalle_image_generator.DallEAPIWrapper¶ class langchain.utilities.dalle_image_generator.DallEAPIWrapper[source]¶ Bases: BaseModel Wrapper for OpenAI’s DALL-E Image Generator. Docs for using: 1. pip install openai 2. save your OPENAI_API_KEY in an environment variable 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 n: int = 1¶ size of image to generate param openai_api_key: Optional[str] = None¶ number of images to generate param size: str = '1024x1024'¶ classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) → Model¶ Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, update: Optional[DictStrAny] = None, deep: bool = False) → Model¶ Duplicate a model, optionally choose which fields to include, exclude and change. Parameters include – fields to include in new model exclude – fields to exclude from new model, as with values this takes precedence over include update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data deep – set to True to make a deep copy of the model Returns new model instance
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.dalle_image_generator.DallEAPIWrapper.html
e81646f17cd4-1
deep – set to True to make a deep copy of the model Returns new model instance dict(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False) → DictStrAny¶ Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. classmethod from_orm(obj: Any) → Model¶ json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, encoder: Optional[Callable[[Any], Any]] = None, models_as_dict: bool = True, **dumps_kwargs: Any) → unicode¶ Generate a JSON representation of the model, include and exclude arguments as per dict(). encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps(). classmethod parse_file(path: Union[str, Path], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ classmethod parse_obj(obj: Any) → Model¶ classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ run(query: str) → str[source]¶
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.dalle_image_generator.DallEAPIWrapper.html
e81646f17cd4-2
run(query: str) → str[source]¶ Run query through OpenAI and parse result. classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶ classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶ classmethod update_forward_refs(**localns: Any) → None¶ Try to update ForwardRefs on fields based on this Model, globalns and localns. classmethod validate(value: Any) → Model¶
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.dalle_image_generator.DallEAPIWrapper.html
8481c5a75996-0
langchain.utilities.wikipedia.WikipediaAPIWrapper¶ class langchain.utilities.wikipedia.WikipediaAPIWrapper[source]¶ Bases: BaseModel Wrapper around WikipediaAPI. To use, you should have the wikipedia python package installed. This wrapper will use the Wikipedia API to conduct searches and fetch page summaries. By default, it will return the page summaries of the top-k results. It limits the Document content by doc_content_chars_max. 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 doc_content_chars_max: int = 4000¶ param lang: str = 'en'¶ param load_all_available_meta: bool = False¶ param top_k_results: int = 3¶ classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) → Model¶ Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, update: Optional[DictStrAny] = None, deep: bool = False) → Model¶ Duplicate a model, optionally choose which fields to include, exclude and change. Parameters include – fields to include in new model exclude – fields to exclude from new model, as with values this takes precedence over include update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data deep – set to True to make a deep copy of the model Returns
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.wikipedia.WikipediaAPIWrapper.html
8481c5a75996-1
deep – set to True to make a deep copy of the model Returns new model instance dict(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False) → DictStrAny¶ Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. classmethod from_orm(obj: Any) → Model¶ json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, encoder: Optional[Callable[[Any], Any]] = None, models_as_dict: bool = True, **dumps_kwargs: Any) → unicode¶ Generate a JSON representation of the model, include and exclude arguments as per dict(). encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps(). load(query: str) → List[Document][source]¶ Run Wikipedia search and get the article text plus the meta information. See Returns: a list of documents. classmethod parse_file(path: Union[str, Path], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ classmethod parse_obj(obj: Any) → Model¶
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.wikipedia.WikipediaAPIWrapper.html
8481c5a75996-2
classmethod parse_obj(obj: Any) → Model¶ classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ run(query: str) → str[source]¶ Run Wikipedia search and get page summaries. classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶ classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶ classmethod update_forward_refs(**localns: Any) → None¶ Try to update ForwardRefs on fields based on this Model, globalns and localns. classmethod validate(value: Any) → Model¶ Examples using WikipediaAPIWrapper¶ Wikipedia Zep Memory
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.wikipedia.WikipediaAPIWrapper.html
2e9361d9df91-0
langchain.utilities.zapier.ZapierNLAWrapper¶ class langchain.utilities.zapier.ZapierNLAWrapper[source]¶ Bases: BaseModel Wrapper for Zapier NLA. Full docs here: https://nla.zapier.com/start/ This wrapper supports both API Key and OAuth Credential auth methods. API Key is the fastest way to get started using this wrapper. Call this wrapper with either zapier_nla_api_key or zapier_nla_oauth_access_token arguments, or set the ZAPIER_NLA_API_KEY environment variable. If both arguments are set, the Access Token will take precedence. For use-cases where LangChain + Zapier NLA is powering a user-facing application, and LangChain needs access to the end-user’s connected accounts on Zapier.com, you’ll need to use OAuth. Review the full docs above to learn how to create your own provider and generate credentials. 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 zapier_nla_api_base: str = 'https://nla.zapier.com/api/v1/'¶ param zapier_nla_api_key: str [Required]¶ param zapier_nla_oauth_access_token: str [Required]¶ async alist() → List[Dict][source]¶ Returns a list of all exposed (enabled) actions associated with current user (associated with the set api_key). Change your exposed actions here: https://nla.zapier.com/demo/start/ The return list can be empty if no actions exposed. Else will contain a list of action objects: [{“id”: str, “description”: str, “params”: Dict[str, str] }] params will always contain an instructions key, the only required
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.zapier.ZapierNLAWrapper.html
2e9361d9df91-1
}] params will always contain an instructions key, the only required param. All others optional and if provided will override any AI guesses (see “understanding the AI guessing flow” here: https://nla.zapier.com/api/v1/docs) async alist_as_str() → str[source]¶ Same as list, but returns a stringified version of the JSON for insertting back into an LLM. async apreview(action_id: str, instructions: str, params: Optional[Dict] = None) → Dict[source]¶ Same as run, but instead of actually executing the action, will instead return a preview of params that have been guessed by the AI in case you need to explicitly review before executing. async apreview_as_str(*args, **kwargs) → str[source]¶ Same as preview, but returns a stringified version of the JSON for insertting back into an LLM. async arun(action_id: str, instructions: str, params: Optional[Dict] = None) → Dict[source]¶ Executes an action that is identified by action_id, must be exposed (enabled) by the current user (associated with the set api_key). Change your exposed actions here: https://nla.zapier.com/demo/start/ The return JSON is guaranteed to be less than ~500 words (350 tokens) making it safe to inject into the prompt of another LLM call. async arun_as_str(*args, **kwargs) → str[source]¶ Same as run, but returns a stringified version of the JSON for insertting back into an LLM. classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) → Model¶ Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data.
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.zapier.ZapierNLAWrapper.html
2e9361d9df91-2
Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, update: Optional[DictStrAny] = None, deep: bool = False) → Model¶ Duplicate a model, optionally choose which fields to include, exclude and change. Parameters include – fields to include in new model exclude – fields to exclude from new model, as with values this takes precedence over include update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data deep – set to True to make a deep copy of the model Returns new model instance dict(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False) → DictStrAny¶ Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. classmethod from_orm(obj: Any) → Model¶
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.zapier.ZapierNLAWrapper.html
2e9361d9df91-3
classmethod from_orm(obj: Any) → Model¶ json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, encoder: Optional[Callable[[Any], Any]] = None, models_as_dict: bool = True, **dumps_kwargs: Any) → unicode¶ Generate a JSON representation of the model, include and exclude arguments as per dict(). encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps(). list() → List[Dict][source]¶ Returns a list of all exposed (enabled) actions associated with current user (associated with the set api_key). Change your exposed actions here: https://nla.zapier.com/demo/start/ The return list can be empty if no actions exposed. Else will contain a list of action objects: [{“id”: str, “description”: str, “params”: Dict[str, str] }] params will always contain an instructions key, the only required param. All others optional and if provided will override any AI guesses (see “understanding the AI guessing flow” here: https://nla.zapier.com/docs/using-the-api#ai-guessing) list_as_str() → str[source]¶ Same as list, but returns a stringified version of the JSON for insertting back into an LLM. classmethod parse_file(path: Union[str, Path], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.zapier.ZapierNLAWrapper.html
2e9361d9df91-4
classmethod parse_obj(obj: Any) → Model¶ classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ preview(action_id: str, instructions: str, params: Optional[Dict] = None) → Dict[source]¶ Same as run, but instead of actually executing the action, will instead return a preview of params that have been guessed by the AI in case you need to explicitly review before executing. preview_as_str(*args, **kwargs) → str[source]¶ Same as preview, but returns a stringified version of the JSON for insertting back into an LLM. run(action_id: str, instructions: str, params: Optional[Dict] = None) → Dict[source]¶ Executes an action that is identified by action_id, must be exposed (enabled) by the current user (associated with the set api_key). Change your exposed actions here: https://nla.zapier.com/demo/start/ The return JSON is guaranteed to be less than ~500 words (350 tokens) making it safe to inject into the prompt of another LLM call. run_as_str(*args, **kwargs) → str[source]¶ Same as run, but returns a stringified version of the JSON for insertting back into an LLM. classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶ classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶ classmethod update_forward_refs(**localns: Any) → None¶ Try to update ForwardRefs on fields based on this Model, globalns and localns.
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.zapier.ZapierNLAWrapper.html
2e9361d9df91-5
Try to update ForwardRefs on fields based on this Model, globalns and localns. classmethod validate(value: Any) → Model¶ Examples using ZapierNLAWrapper¶ Zapier Natural Language Actions API
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.zapier.ZapierNLAWrapper.html
12da92612645-0
langchain.utilities.requests.Requests¶ class langchain.utilities.requests.Requests[source]¶ Bases: BaseModel Wrapper around requests to handle auth and async. The main purpose of this wrapper is to handle authentication (by saving headers) and enable easy async methods on the same base object. 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 aiosession: Optional[aiohttp.client.ClientSession] = None¶ param auth: Optional[Any] = None¶ param headers: Optional[Dict[str, str]] = None¶ adelete(url: str, **kwargs: Any) → AsyncGenerator[ClientResponse, None][source]¶ DELETE the URL and return the text asynchronously. aget(url: str, **kwargs: Any) → AsyncGenerator[ClientResponse, None][source]¶ GET the URL and return the text asynchronously. apatch(url: str, data: Dict[str, Any], **kwargs: Any) → AsyncGenerator[ClientResponse, None][source]¶ PATCH the URL and return the text asynchronously. apost(url: str, data: Dict[str, Any], **kwargs: Any) → AsyncGenerator[ClientResponse, None][source]¶ POST to the URL and return the text asynchronously. aput(url: str, data: Dict[str, Any], **kwargs: Any) → AsyncGenerator[ClientResponse, None][source]¶ PUT the URL and return the text asynchronously. classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) → Model¶ Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed.
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.requests.Requests.html
12da92612645-1
Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, update: Optional[DictStrAny] = None, deep: bool = False) → Model¶ Duplicate a model, optionally choose which fields to include, exclude and change. Parameters include – fields to include in new model exclude – fields to exclude from new model, as with values this takes precedence over include update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data deep – set to True to make a deep copy of the model Returns new model instance delete(url: str, **kwargs: Any) → Response[source]¶ DELETE the URL and return the text. dict(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False) → DictStrAny¶ Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. classmethod from_orm(obj: Any) → Model¶ get(url: str, **kwargs: Any) → Response[source]¶ GET the URL and return the text.
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.requests.Requests.html
12da92612645-2
GET the URL and return the text. json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, encoder: Optional[Callable[[Any], Any]] = None, models_as_dict: bool = True, **dumps_kwargs: Any) → unicode¶ Generate a JSON representation of the model, include and exclude arguments as per dict(). encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps(). classmethod parse_file(path: Union[str, Path], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ classmethod parse_obj(obj: Any) → Model¶ classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ patch(url: str, data: Dict[str, Any], **kwargs: Any) → Response[source]¶ PATCH the URL and return the text. post(url: str, data: Dict[str, Any], **kwargs: Any) → Response[source]¶ POST to the URL and return the text. put(url: str, data: Dict[str, Any], **kwargs: Any) → Response[source]¶ PUT the URL and return the text. classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.requests.Requests.html
12da92612645-3
classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶ classmethod update_forward_refs(**localns: Any) → None¶ Try to update ForwardRefs on fields based on this Model, globalns and localns. classmethod validate(value: Any) → Model¶ Examples using Requests¶ Natural Language APIs Evaluating an OpenAPI Chain OpenAPI chain
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.requests.Requests.html
98b8b0fdb736-0
langchain.utilities.jira.JiraAPIWrapper¶ class langchain.utilities.jira.JiraAPIWrapper[source]¶ Bases: BaseModel Wrapper for Jira API. 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 confluence: Any = None¶ param jira_api_token: Optional[str] = None¶ param jira_instance_url: Optional[str] = None¶ param jira_username: Optional[str] = None¶ classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) → Model¶ Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, update: Optional[DictStrAny] = None, deep: bool = False) → Model¶ Duplicate a model, optionally choose which fields to include, exclude and change. Parameters include – fields to include in new model exclude – fields to exclude from new model, as with values this takes precedence over include update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data deep – set to True to make a deep copy of the model Returns new model instance
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.jira.JiraAPIWrapper.html
98b8b0fdb736-1
deep – set to True to make a deep copy of the model Returns new model instance dict(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False) → DictStrAny¶ Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. classmethod from_orm(obj: Any) → Model¶ issue_create(query: str) → str[source]¶ json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, encoder: Optional[Callable[[Any], Any]] = None, models_as_dict: bool = True, **dumps_kwargs: Any) → unicode¶ Generate a JSON representation of the model, include and exclude arguments as per dict(). encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps(). other(query: str) → str[source]¶ page_create(query: str) → str[source]¶ classmethod parse_file(path: Union[str, Path], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ parse_issues(issues: Dict) → List[dict][source]¶ classmethod parse_obj(obj: Any) → Model¶
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.jira.JiraAPIWrapper.html
98b8b0fdb736-2
classmethod parse_obj(obj: Any) → Model¶ parse_projects(projects: List[dict]) → List[dict][source]¶ classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ project() → str[source]¶ run(mode: str, query: str) → str[source]¶ classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶ classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶ search(query: str) → str[source]¶ classmethod update_forward_refs(**localns: Any) → None¶ Try to update ForwardRefs on fields based on this Model, globalns and localns. classmethod validate(value: Any) → Model¶ Examples using JiraAPIWrapper¶ Jira
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.jira.JiraAPIWrapper.html
79da32ce4daf-0
langchain.utilities.wolfram_alpha.WolframAlphaAPIWrapper¶ class langchain.utilities.wolfram_alpha.WolframAlphaAPIWrapper[source]¶ Bases: BaseModel Wrapper for Wolfram Alpha. Docs for using: Go to wolfram alpha and sign up for a developer account Create an app and get your APP ID Save your APP ID into WOLFRAM_ALPHA_APPID env variable pip install wolframalpha 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 wolfram_alpha_appid: Optional[str] = None¶ classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) → Model¶ Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, update: Optional[DictStrAny] = None, deep: bool = False) → Model¶ Duplicate a model, optionally choose which fields to include, exclude and change. Parameters include – fields to include in new model exclude – fields to exclude from new model, as with values this takes precedence over include update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data deep – set to True to make a deep copy of the model Returns new model instance
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.wolfram_alpha.WolframAlphaAPIWrapper.html
79da32ce4daf-1
deep – set to True to make a deep copy of the model Returns new model instance dict(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False) → DictStrAny¶ Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. classmethod from_orm(obj: Any) → Model¶ json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, encoder: Optional[Callable[[Any], Any]] = None, models_as_dict: bool = True, **dumps_kwargs: Any) → unicode¶ Generate a JSON representation of the model, include and exclude arguments as per dict(). encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps(). classmethod parse_file(path: Union[str, Path], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ classmethod parse_obj(obj: Any) → Model¶ classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ run(query: str) → str[source]¶
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.wolfram_alpha.WolframAlphaAPIWrapper.html
79da32ce4daf-2
run(query: str) → str[source]¶ Run query through WolframAlpha and parse result. classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶ classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶ classmethod update_forward_refs(**localns: Any) → None¶ Try to update ForwardRefs on fields based on this Model, globalns and localns. classmethod validate(value: Any) → Model¶ Examples using WolframAlphaAPIWrapper¶ Wolfram Alpha
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.wolfram_alpha.WolframAlphaAPIWrapper.html
0fc92d6c3850-0
langchain.utilities.powerbi.json_to_md¶ langchain.utilities.powerbi.json_to_md(json_contents: List[Dict[str, Union[str, int, float]]], table_name: Optional[str] = None) → str[source]¶ Converts a JSON object to a markdown table.
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.powerbi.json_to_md.html
4d9216640ade-0
langchain.utilities.brave_search.BraveSearchWrapper¶ class langchain.utilities.brave_search.BraveSearchWrapper[source]¶ Bases: BaseModel Wrapper around the Brave search engine. 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 api_key: str [Required]¶ The API key to use for the Brave search engine. param base_url = 'https://api.search.brave.com/res/v1/web/search'¶ The base URL for the Brave search engine. param search_kwargs: dict [Optional]¶ Additional keyword arguments to pass to the search request. classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) → Model¶ Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, update: Optional[DictStrAny] = None, deep: bool = False) → Model¶ Duplicate a model, optionally choose which fields to include, exclude and change. Parameters include – fields to include in new model exclude – fields to exclude from new model, as with values this takes precedence over include update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data deep – set to True to make a deep copy of the model Returns new model instance
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.brave_search.BraveSearchWrapper.html
4d9216640ade-1
deep – set to True to make a deep copy of the model Returns new model instance dict(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False) → DictStrAny¶ Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. download_documents(query: str) → List[Document][source]¶ Query the Brave search engine and return the results as a list of Documents. Parameters query – The query to search for. Returns: The results as a list of Documents. classmethod from_orm(obj: Any) → Model¶ json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, encoder: Optional[Callable[[Any], Any]] = None, models_as_dict: bool = True, **dumps_kwargs: Any) → unicode¶ Generate a JSON representation of the model, include and exclude arguments as per dict(). encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps(). classmethod parse_file(path: Union[str, Path], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ classmethod parse_obj(obj: Any) → Model¶
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.brave_search.BraveSearchWrapper.html
4d9216640ade-2
classmethod parse_obj(obj: Any) → Model¶ classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ run(query: str) → str[source]¶ Query the Brave search engine and return the results as a JSON string. Parameters query – The query to search for. Returns: The results as a JSON string. classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶ classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶ classmethod update_forward_refs(**localns: Any) → None¶ Try to update ForwardRefs on fields based on this Model, globalns and localns. classmethod validate(value: Any) → Model¶
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.brave_search.BraveSearchWrapper.html
5b554dd97385-0
langchain.utilities.redis.get_client¶ langchain.utilities.redis.get_client(redis_url: str, **kwargs: Any) → RedisType[source]¶ Get a redis client from the connection url given. This helper accepts urls for Redis server (TCP with/without TLS or UnixSocket) as well as Redis Sentinel connections. Redis Cluster is not supported. Before creating a connection the existence of the database driver is checked an and ValueError raised otherwise To use, you should have the redis python package installed. Example from langchain.utilities.redis import get_client redis_client = get_client( redis_url="redis://username:password@localhost:6379" index_name="my-index", embedding_function=embeddings.embed_query, ) To use a redis replication setup with multiple redis server and redis sentinels set “redis_url” to “redis+sentinel://” scheme. With this url format a path is needed holding the name of the redis service within the sentinels to get the correct redis server connection. The default service name is “mymaster”. The optional second part of the path is the redis db number to connect to. An optional username or password is used for booth connections to the rediserver and the sentinel, different passwords for server and sentinel are not supported. And as another constraint only one sentinel instance can be given: Example from langchain.utilities.redis import get_client redis_client = get_client( redis_url="redis+sentinel://username:password@sentinelhost:26379/mymaster/0" index_name="my-index", embedding_function=embeddings.embed_query, )
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.redis.get_client.html
d8ddb170274c-0
langchain.utilities.bibtex.BibtexparserWrapper¶ class langchain.utilities.bibtex.BibtexparserWrapper[source]¶ Bases: BaseModel Wrapper around bibtexparser. To use, you should have the bibtexparser python package installed. https://bibtexparser.readthedocs.io/en/master/ This wrapper will use bibtexparser to load a collection of references from a bibtex file and fetch document summaries. 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. classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) → Model¶ Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, update: Optional[DictStrAny] = None, deep: bool = False) → Model¶ Duplicate a model, optionally choose which fields to include, exclude and change. Parameters include – fields to include in new model exclude – fields to exclude from new model, as with values this takes precedence over include update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data deep – set to True to make a deep copy of the model Returns new model instance
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.bibtex.BibtexparserWrapper.html
d8ddb170274c-1
deep – set to True to make a deep copy of the model Returns new model instance dict(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False) → DictStrAny¶ Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. classmethod from_orm(obj: Any) → Model¶ get_metadata(entry: Mapping[str, Any], load_extra: bool = False) → Dict[str, Any][source]¶ Get metadata for the given entry. json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, encoder: Optional[Callable[[Any], Any]] = None, models_as_dict: bool = True, **dumps_kwargs: Any) → unicode¶ Generate a JSON representation of the model, include and exclude arguments as per dict(). encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps(). load_bibtex_entries(path: str) → List[Dict[str, Any]][source]¶ Load bibtex entries from the bibtex file at the given path. classmethod parse_file(path: Union[str, Path], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.bibtex.BibtexparserWrapper.html
d8ddb170274c-2
classmethod parse_obj(obj: Any) → Model¶ classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶ classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶ classmethod update_forward_refs(**localns: Any) → None¶ Try to update ForwardRefs on fields based on this Model, globalns and localns. classmethod validate(value: Any) → Model¶
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.bibtex.BibtexparserWrapper.html
7bf0abc60dd5-0
langchain.utilities.arxiv.ArxivAPIWrapper¶ class langchain.utilities.arxiv.ArxivAPIWrapper[source]¶ Bases: BaseModel Wrapper around ArxivAPI. To use, you should have the arxiv python package installed. https://lukasschwab.me/arxiv.py/index.html This wrapper will use the Arxiv API to conduct searches and fetch document summaries. By default, it will return the document summaries of the top-k results. It limits the Document content by doc_content_chars_max. Set doc_content_chars_max=None if you don’t want to limit the content size. top_k_results¶ number of the top-scored document used for the arxiv tool ARXIV_MAX_QUERY_LENGTH¶ the cut limit on the query used for the arxiv tool. load_max_docs¶ a limit to the number of loaded documents load_all_available_meta¶ if True: the metadata of the loaded Documents contains all available meta info (see https://lukasschwab.me/arxiv.py/index.html#Result), if False: the metadata contains only the published date, title, authors and summary. doc_content_chars_max¶ an optional cut limit for the length of a document’s content Example from langchain.utilities.arxiv import ArxivAPIWrapper arxiv = ArxivAPIWrapper( top_k_results = 3, ARXIV_MAX_QUERY_LENGTH = 300, load_max_docs = 3, load_all_available_meta = False, doc_content_chars_max = 40000 ) arxiv.run("tree of thought llm) 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 arxiv_exceptions: Any = None¶
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.arxiv.ArxivAPIWrapper.html
7bf0abc60dd5-1
param arxiv_exceptions: Any = None¶ param doc_content_chars_max: Optional[int] = 4000¶ param load_all_available_meta: bool = False¶ param load_max_docs: int = 100¶ param top_k_results: int = 3¶ classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) → Model¶ Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, update: Optional[DictStrAny] = None, deep: bool = False) → Model¶ Duplicate a model, optionally choose which fields to include, exclude and change. Parameters include – fields to include in new model exclude – fields to exclude from new model, as with values this takes precedence over include update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data deep – set to True to make a deep copy of the model Returns new model instance dict(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False) → DictStrAny¶ Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.arxiv.ArxivAPIWrapper.html
7bf0abc60dd5-2
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. classmethod from_orm(obj: Any) → Model¶ json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, encoder: Optional[Callable[[Any], Any]] = None, models_as_dict: bool = True, **dumps_kwargs: Any) → unicode¶ Generate a JSON representation of the model, include and exclude arguments as per dict(). encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps(). load(query: str) → List[Document][source]¶ Run Arxiv search and get the article texts plus the article meta information. See https://lukasschwab.me/arxiv.py/index.html#Search Returns: a list of documents with the document.page_content in text format Performs an arxiv search, downloads the top k results as PDFs, loads them as Documents, and returns them in a List. Parameters query – a plaintext search query classmethod parse_file(path: Union[str, Path], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ classmethod parse_obj(obj: Any) → Model¶ classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ run(query: str) → str[source]¶ Performs an arxiv search and A single string
https://api.python.langchain.com/en/latest/utilities/langchain.utilities.arxiv.ArxivAPIWrapper.html