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 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 if the input data cannot be parsed to form a valid model.
- param apify_api_token: Optional[str] = None¶
- 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.
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: 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.
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: 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.
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: 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.
task_id (str) –
task_input (Dict) –
- Returns
- A loader that will fetch the records from the
task run’s default dataset.
- Return type