langchain.utilities.apify.ApifyWrapper¶
class langchain.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