ApifyWrapper#
- class langchain_community.utilities.apify.ApifyWrapper[source]#
Bases:
BaseModel
Deprecated since version 0.3.18: This class is deprecated and will be removed in a future version. You can swap to using the ApifyWrapper implementation in langchain_apify package. See <apify/langchain-apify> Use
:class:`~langchain_apify.ApifyWrapper`
instead.Wrapper around Apify. To use, you should have the
apify-client
python package installed, and the environment variableAPIFY_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][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- param apify_api_token: str | None = None#
- param apify_client: Any [Required]#
- param apify_client_async: Any [Required]#
- async acall_actor(
- actor_id: str,
- run_input: Dict,
- dataset_mapping_function: Callable[[Dict], Document],
- *,
- build: str | None = None,
- memory_mbytes: int | None = None,
- timeout_secs: int | None = None,
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.
actor_id (str)
run_input (Dict)
dataset_mapping_function (Callable)
- Returns:
- A loader that will fetch the records from the
Actor run’s default dataset.
- Return type:
- async acall_actor_task(
- task_id: str,
- task_input: Dict,
- dataset_mapping_function: Callable[[Dict], Document],
- *,
- build: str | None = None,
- memory_mbytes: int | None = None,
- timeout_secs: int | None = None,
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.
task_id (str)
task_input (Dict)
- Returns:
- A loader that will fetch the records from the
task run’s default dataset.
- Return type:
- call_actor(
- actor_id: str,
- run_input: Dict,
- dataset_mapping_function: Callable[[Dict], Document],
- *,
- build: str | None = None,
- memory_mbytes: int | None = None,
- timeout_secs: int | None = None,
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.
actor_id (str)
run_input (Dict)
dataset_mapping_function (Callable)
- Returns:
- A loader that will fetch the records from the
Actor run’s default dataset.
- Return type:
- call_actor_task(
- task_id: str,
- task_input: Dict,
- dataset_mapping_function: Callable[[Dict], Document],
- *,
- build: str | None = None,
- memory_mbytes: int | None = None,
- timeout_secs: int | None = None,
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.
task_id (str)
task_input (Dict)
- Returns:
- A loader that will fetch the records from the
task run’s default dataset.
- Return type:
Examples using ApifyWrapper