viruPVS/langchain-docs huggingface dataset:
langchain_community.utilities.dataforseo_api_search.DataForSeoAPIWrapper¶
class langchain_community.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.
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¶
langchain_community.utilities.arcee.ArceeWrapper¶
class langchain_community.utilities.arcee.ArceeWrapper(arcee_api_key: Union[str, SecretStr], arcee_api_url: str, arcee_api_version: str, model_kwargs: Optional[Dict[str, Any]], model_name: str)[source]¶
Wrapper for Arcee API.
For more details, see: https://www.arcee.ai/
Initialize ArceeWrapper.
Parameters
arcee_api_key – API key for Arcee API.
arcee_api_url – URL for Arcee API.
arcee_api_version – Version of Arcee API.
model_kwargs – Keyword arguments for Arcee API.
model_name – Name of an Arcee model.
Methods
__init__(arcee_api_key, arcee_api_url, ...)
Initialize ArceeWrapper.
generate(prompt, **kwargs)
Generate text from Arcee DALM.
retrieve(query, **kwargs)
Retrieve {size} contexts with your retriever for a given query
validate_model_training_status()
__init__(arcee_api_key: Union[str, SecretStr], arcee_api_url: str, arcee_api_version: str, model_kwargs: Optional[Dict[str, Any]], model_name: str)[source]¶
Initialize ArceeWrapper.
Parameters
arcee_api_key – API key for Arcee API.
arcee_api_url – URL for Arcee API.
arcee_api_version – Version of Arcee API.
model_kwargs – Keyword arguments for Arcee API.
model_name – Name of an Arcee model.
generate(prompt: str, **kwargs: Any) → str[source]¶
Generate text from Arcee DALM.
Parameters
prompt – Prompt to generate text from.
size – The max number of context results to retrieve. Defaults to 3.
(Can be less if filters are provided).
(Can be less if filters are provided).
filters – Filters to apply to the context dataset.
retrieve(query: str, **kwargs: Any) → List[Document][source]¶
Retrieve {size} contexts with your retriever for a given query
Parameters
query – Query to submit to the model
size – The max number of context results to retrieve. Defaults to 3.
(Can be less if filters are provided).
filters – Filters to apply to the context dataset.
validate_model_training_status() → None[source]¶
langchain_community.utilities.stackexchange.StackExchangeAPIWrapper¶
class langchain_community.utilities.stackexchange.StackExchangeAPIWrapper[source]¶
Bases: BaseModel
Wrapper for Stack Exchange 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 fetch_params: Dict[str, Any] [Optional]¶
Additional params to pass to StackApi.fetch.
param max_results: int = 3¶
Max number of results to include in output.
param query_type: Literal['all', 'title', 'body'] = 'all'¶
Which part of StackOverflows items to match against. One of ‘all’, ‘title’,
‘body’. Defaults to ‘all’.
param result_separator: str = '\n\n'¶
Separator between question,answer pairs.
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
run(query: str) → str[source]¶
Run query through StackExchange API and parse 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¶
langchain_community.utilities.google_finance.GoogleFinanceAPIWrapper¶
class langchain_community.utilities.google_finance.GoogleFinanceAPIWrapper[source]¶
Bases: BaseModel
Wrapper for SerpApi’s Google Finance API
You can create SerpApi.com key by signing up at: https://serpapi.com/users/sign_up.
The wrapper uses the SerpApi.com python package:
https://serpapi.com/integrations/python
To use, you should have the environment variable SERPAPI_API_KEY
set with your API key, or pass serp_api_key as a named parameter
to the constructor.
.. rubric:: Example
from langchain_community.utilities import GoogleFinanceAPIWrapper
google_Finance = GoogleFinanceAPIWrapper()
google_Finance.run(‘langchain’)
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 serp_api_key: Optional[pydantic.types.SecretStr] = None¶
Constraints
type = string
writeOnly = True
format = password
param serp_search_engine: 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
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 query through Google Finance with Serpapi
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¶
langchain_community.utilities.arcee.DALMFilter¶
class langchain_community.utilities.arcee.DALMFilter[source]¶
Bases: BaseModel
Filters available for a DALM retrieval and generation.
Parameters
field_name – The field to filter on. Can be ‘document’ or ‘name’ to filter
on your document’s raw text or title. Any other field will be presumed
to be a metadata field you included when uploading your context data
filter_type – Currently ‘fuzzy_search’ and ‘strict_search’ are supported.
‘fuzzy_search’ means a fuzzy search on the provided field is performed.
The exact strict doesn’t need to exist in the document
for this to find a match.
Very useful for scanning a document for some keyword terms.
‘strict_search’ means that the exact string must appear
in the provided field.
This is NOT an exact eq filter. ie a document with content
“the happy dog crossed the street” will match on a strict_search of
“dog” but won’t match on “the dog”.
Python equivalent of return search_string in full_string.
value – The actual value to search for in the context data/metadata
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 field_name: str [Required]¶
param filter_type: langchain_community.utilities.arcee.DALMFilterType [Required]¶
param value: 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
langchain_community.utilities.graphql.GraphQLAPIWrapper¶
class langchain_community.utilities.graphql.GraphQLAPIWrapper[source]¶
Bases: BaseModel
Wrapper around GraphQL API.
To use, you should have the gql python package installed.
This wrapper will use the GraphQL API to conduct queries.
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 custom_headers: Optional[Dict[str, str]] = None¶
param graphql_endpoint: 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
run(query: str) → str[source]¶
Run a GraphQL query and get 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¶
Examples using GraphQLAPIWrapper¶
GraphQL
langchain_community.utilities.openapi.HTTPVerb¶
class langchain_community.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'¶
langchain_community.utilities.apify.ApifyWrapper¶
class langchain_community.utilities.apify.ApifyWrapper[source]¶
Bases: BaseModel
Wrapper around Apify.
To use, you should have the apify-client python package installed,
and the environment variable APIFY_API_TOKEN set with your API key, or pass
apify_api_token as a named parameter to the constructor.
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 apify_client: Any = None¶
param apify_client_async: Any = None¶
async acall_actor(actor_id: str, run_input: Dict, dataset_mapping_function: Callable[[Dict], Document], *, build: Optional[str] = None, memory_mbytes: Optional[int] = None, timeout_secs: Optional[int] = None) → ApifyDatasetLoader[source]¶
Run an Actor on the Apify platform and wait for results to be ready.
:param actor_id: The ID or name of the Actor on the Apify platform.
:type actor_id: str
:param run_input: The input object of the Actor that you’re trying to run.
:type run_input: Dict
:param dataset_mapping_function: A function that takes a single
dictionary (an Apify dataset item) and converts it to
an instance of the Document class.
Parameters
build (str, optional) – Optionally specifies the actor build to run.
It can be either a build tag or build number.
memory_mbytes (int, optional) – Optional memory limit for the run,
in megabytes.
timeout_secs (int, optional) – Optional timeout for the run, in seconds.
Returns
A loader that will fetch the records from theActor run’s default dataset.
Return type
ApifyDatasetLoader
Return type
ApifyDatasetLoader
async acall_actor_task(task_id: str, task_input: Dict, dataset_mapping_function: Callable[[Dict], Document], *, build: Optional[str] = None, memory_mbytes: Optional[int] = None, timeout_secs: Optional[int] = None) → ApifyDatasetLoader[source]¶
Run a saved Actor task on Apify and wait for results to be ready.
:param task_id: The ID or name of the task on the Apify platform.
:type task_id: str
:param task_input: The input object of the task that you’re trying to run.
Overrides the task’s saved input.
Parameters
dataset_mapping_function (Callable) – A function that takes a single
dictionary (an Apify dataset item) and converts it to an
instance of the Document class.
build (str, optional) – Optionally specifies the actor build to run.
It can be either a build tag or build number.
memory_mbytes (int, optional) – Optional memory limit for the run,
in megabytes.
timeout_secs (int, optional) – Optional timeout for the run, in seconds.
Returns
A loader that will fetch the records from thetask run’s default dataset.
Return type
ApifyDatasetLoader
call_actor(actor_id: str, run_input: Dict, dataset_mapping_function: Callable[[Dict], Document], *, build: Optional[str] = None, memory_mbytes: Optional[int] = None, timeout_secs: Optional[int] = None) → ApifyDatasetLoader[source]¶
Run an Actor on the Apify platform and wait for results to be ready.
:param actor_id: The ID or name of the Actor on the Apify platform.
:type actor_id: str
:param run_input: The input object of the Actor that you’re trying to run.
:type run_input: Dict
:type run_input: Dict
:param dataset_mapping_function: A function that takes a single
dictionary (an Apify dataset item) and converts it to an
instance of the Document class.
Parameters
build (str, optional) – Optionally specifies the actor build to run.
It can be either a build tag or build number.
memory_mbytes (int, optional) – Optional memory limit for the run,
in megabytes.
timeout_secs (int, optional) – Optional timeout for the run, in seconds.
Returns
A loader that will fetch the records from theActor run’s default dataset.
Return type
ApifyDatasetLoader
call_actor_task(task_id: str, task_input: Dict, dataset_mapping_function: Callable[[Dict], Document], *, build: Optional[str] = None, memory_mbytes: Optional[int] = None, timeout_secs: Optional[int] = None) → ApifyDatasetLoader[source]¶
Run a saved Actor task on Apify and wait for results to be ready.
:param task_id: The ID or name of the task on the Apify platform.
:type task_id: str
:param task_input: The input object of the task that you’re trying to run.
Overrides the task’s saved input.
Parameters
dataset_mapping_function (Callable) – A function that takes a single
dictionary (an Apify dataset item) and converts it to an
instance of the Document class.
build (str, optional) – Optionally specifies the actor build to run.
It can be either a build tag or build number.
memory_mbytes (int, optional) – Optional memory limit for the run,
in megabytes.
timeout_secs (int, optional) – Optional timeout for the run, in seconds.
Returns
A loader that will fetch the records from thetask run’s default dataset.
Return type
ApifyDatasetLoader
Return type
ApifyDatasetLoader
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.
classmethod from_orm(obj: Any) → Model¶
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¶
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 ApifyWrapper¶
Apify
langchain_community.utilities.google_scholar.GoogleScholarAPIWrapper¶
class langchain_community.utilities.google_scholar.GoogleScholarAPIWrapper[source]¶
Bases: BaseModel
Wrapper for Google Scholar API
You can create serpapi key by signing up at: https://serpapi.com/users/sign_up.
The wrapper uses the serpapi python package:
https://serpapi.com/integrations/python#search-google-scholar
To use, you should have the environment variable SERP_API_KEY
set with your API key, or pass serp_api_key as a named parameter
to the constructor.
top_k_results¶
number of results to return from google-scholar query search.
By default it returns top 10 results.
hl¶
attribute defines the language to use for the Google Scholar search.
It’s a two-letter language code.
(e.g., en for English, es for Spanish, or fr for French). Head to the
Google languages page for a full list of supported Google languages:
https://serpapi.com/google-languages
lr¶
attribute defines one or multiple languages to limit the search to.
It uses lang_{two-letter language code} to specify languages
and | as a delimiter. (e.g., lang_fr|lang_de will only search French
and German pages). Head to the Google lr languages for a full
list of supported languages: https://serpapi.com/google-lr-languages
Example:
from langchain_community.utilities import GoogleScholarAPIWrapper
google_scholar = GoogleScholarAPIWrapper()
google_scholar.run(‘langchain’)
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 hl: str = 'en'¶
param lr: str = 'lang_en'¶