Load datasets from Apify web scraping, crawling, and data extraction platform.
For details, see https://docs.apify.com/platform/integrations/langchain
Example:
.. code-block:: python
from langchain_community.document_loaders import ApifyDatasetLoader from langchain_core.documents import Document
loader = ApifyDatasetLoader( dataset_id="YOUR-DATASET-ID", dataset_mapping_function=lambda dataset_item: Document( page_content=dataset_item["text"], metadata={"source": dataset_item["url"]} ), ) documents = loader.load()
The ID of the dataset on the Apify platform.
A function that takes a single dictionary (an Apify dataset item) and converts it to an instance of the Document class.
An instance of the ApifyClient class from the apify-client Python package.
The ID of the dataset on the Apify platform.
A custom function that takes a single dictionary (an Apify dataset item) and converts it to an instance of the Document class.
Validate environment.
Load documents.