id
stringlengths
14
15
text
stringlengths
44
2.47k
source
stringlengths
61
181
0732117b3058-1
f"&fields=id,parent_id,title,body,created_time,updated_time&page={{page}}" ) self._get_folder_url = ( f"{base_url}/folders/{{id}}?token={access_token}&fields=title" ) self._get_tag_url = ( f"{base_url}/notes/{{id}}/tags?token={access_token}&fields=title" )...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/joplin.html
0732117b3058-2
req_tag = urllib.request.Request(self._get_tag_url.format(id=note_id)) with urllib.request.urlopen(req_tag) as response: json_data = json.loads(response.read().decode()) return [tag["title"] for tag in json_data["items"]] def _convert_date(self, date: int) -> str: return date...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/joplin.html
4d2e002c67d5-0
Source code for langchain.document_loaders.markdown from typing import List from langchain.document_loaders.unstructured import UnstructuredFileLoader [docs]class UnstructuredMarkdownLoader(UnstructuredFileLoader): """Load `Markdown` files using `Unstructured`. You can run the loader in one of two modes: "singl...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/markdown.html
4d2e002c67d5-1
f"You are on unstructured version {__unstructured_version__}. " "Partitioning markdown files is only supported in unstructured>=0.4.16." ) return partition_md(filename=self.file_path, **self.unstructured_kwargs)
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/markdown.html
8bc1403f7e6e-0
Source code for langchain.document_loaders.notion from pathlib import Path from typing import List from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader [docs]class NotionDirectoryLoader(BaseLoader): """Load `Notion directory` dump.""" [docs] def __init__(self, p...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/notion.html
7340b5284f2c-0
Source code for langchain.document_loaders.airtable from typing import Iterator, List from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader [docs]class AirtableLoader(BaseLoader): """Load the `Airtable` tables.""" [docs] def __init__(self, api_token: str, table_i...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/airtable.html
37a2e62b50a1-0
Source code for langchain.document_loaders.merge from typing import Iterator, List from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader [docs]class MergedDataLoader(BaseLoader): """Merge documents from a list of loaders""" [docs] def __init__(self, loaders: List...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/merge.html
3a52aa78bea0-0
Source code for langchain.document_loaders.directory import concurrent import logging import random from pathlib import Path from typing import Any, List, Optional, Type, Union from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader from langchain.document_loaders.html_bs...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/directory.html
3a52aa78bea0-1
glob: Glob pattern to use to find files. Defaults to "**/[!.]*" (all files except hidden). silent_errors: Whether to silently ignore errors. Defaults to False. load_hidden: Whether to load hidden files. Defaults to False. loader_cls: Loader class to use for loading fil...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/directory.html
3a52aa78bea0-2
) -> None: """Load a file. Args: item: File path. path: Directory path. docs: List of documents to append to. pbar: Progress bar. Defaults to None. """ if item.is_file(): if _is_visible(item.relative_to(path)) or self.load_hidde...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/directory.html
3a52aa78bea0-3
except ImportError as e: logger.warning( "To log the progress of DirectoryLoader you need to install tqdm, " "`pip install tqdm`" ) if self.silent_errors: logger.warning(e) else: ...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/directory.html
75e22491c889-0
Source code for langchain.document_loaders.url_selenium """Loader that uses Selenium to load a page, then uses unstructured to load the html. """ import logging from typing import TYPE_CHECKING, List, Literal, Optional, Union if TYPE_CHECKING: from selenium.webdriver import Chrome, Firefox from langchain.docstore.d...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/url_selenium.html
75e22491c889-1
import selenium # noqa:F401 except ImportError: raise ImportError( "selenium package not found, please install it with " "`pip install selenium`" ) try: import unstructured # noqa:F401 except ImportError: raise Imp...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/url_selenium.html
75e22491c889-2
elif self.browser.lower() == "firefox": from selenium.webdriver import Firefox from selenium.webdriver.firefox.options import Options as FirefoxOptions from selenium.webdriver.firefox.service import Service firefox_options = FirefoxOptions() for arg in self.ar...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/url_selenium.html
72543fc87d30-0
Source code for langchain.document_loaders.larksuite import json import urllib.request from typing import Any, Iterator, List from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader [docs]class LarkSuiteDocLoader(BaseLoader): """Load from `LarkSuite` (`FeiShu`).""" [d...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/larksuite.html
72543fc87d30-1
f"{api_url_prefix}/{self.document_id}/raw_content" ) text = raw_content_json["data"]["content"] metadata = { "document_id": self.document_id, "revision_id": metadata_json["data"]["document"]["revision_id"], "title": metadata_json["data"]["document"]["title"], ...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/larksuite.html
082a5f10fe0e-0
Source code for langchain.document_loaders.apify_dataset from typing import Any, Callable, Dict, List from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader from langchain.pydantic_v1 import BaseModel, root_validator [docs]class ApifyDatasetLoader(BaseLoader, BaseModel):...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/apify_dataset.html
082a5f10fe0e-1
dictionary (an Apify dataset item) and converts it to an instance of the Document class. """ super().__init__( dataset_id=dataset_id, dataset_mapping_function=dataset_mapping_function ) @root_validator() def validate_environment(cls, values: Dict) -> Dict: ...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/apify_dataset.html
e2a2bfb403f0-0
Source code for langchain.document_loaders.rss import logging from typing import Any, Iterator, List, Optional, Sequence from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader from langchain.document_loaders.news import NewsURLLoader logger = logging.getLogger(__name__) ...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/rss.html
e2a2bfb403f0-1
https://newspaper.readthedocs.io/en/latest/ """ # noqa: E501 [docs] def __init__( self, urls: Optional[Sequence[str]] = None, opml: Optional[str] = None, continue_on_failure: bool = True, show_progress_bar: bool = False, **newsloader_kwargs: Any, ) -> None: ...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/rss.html
e2a2bfb403f0-2
"Please install with 'pip install listparser' or use the " "urls arg instead." ) from e rss = listparser.parse(self.opml) return [feed.url for feed in rss.feeds] [docs] def lazy_load(self) -> Iterator[Document]: try: import feedparser # noqa:F401 ...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/rss.html
e0a38de9abb7-0
Source code for langchain.document_loaders.evernote """Load documents from Evernote. https://gist.github.com/foxmask/7b29c43a161e001ff04afdb2f181e31c """ import hashlib import logging from base64 import b64decode from time import strptime from typing import Any, Dict, Iterator, List, Optional from langchain.docstore.do...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/evernote.html
e0a38de9abb7-1
"""Initialize with file path.""" self.file_path = file_path self.load_single_document = load_single_document [docs] def load(self) -> List[Document]: """Load documents from EverNote export file.""" documents = [ Document( page_content=note["content"], ...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/evernote.html
e0a38de9abb7-2
if elem.tag == "data": # Sometimes elem.text is None rsc_dict[elem.tag] = b64decode(elem.text) if elem.text else b"" rsc_dict["hash"] = hashlib.md5(rsc_dict[elem.tag]).hexdigest() else: rsc_dict[elem.tag] = elem.text return rsc_dict ...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/evernote.html
e0a38de9abb7-3
@staticmethod def _parse_note_xml(xml_file: str) -> Iterator[Dict[str, Any]]: """Parse Evernote xml.""" # Without huge_tree set to True, parser may complain about huge text node # Try to recover, because there may be " ", which will cause # "XMLSyntaxError: Entity 'nbsp' not def...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/evernote.html
c83e57c576dc-0
Source code for langchain.document_loaders.twitter from __future__ import annotations from typing import TYPE_CHECKING, Any, Dict, Iterable, List, Optional, Sequence, Union from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader if TYPE_CHECKING: import tweepy fro...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/twitter.html
c83e57c576dc-1
user = api.get_user(screen_name=username) docs = self._format_tweets(tweets, user) results.extend(docs) return results def _format_tweets( self, tweets: List[Dict[str, Any]], user_info: dict ) -> Iterable[Document]: """Format tweets into a string.""" for t...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/twitter.html
c83e57c576dc-2
access_token=access_token, access_token_secret=access_token_secret, consumer_key=consumer_key, consumer_secret=consumer_secret, ) return cls( auth_handler=auth, twitter_users=twitter_users, number_tweets=number_tweets, )
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/twitter.html
41a34ea588f8-0
Source code for langchain.document_loaders.excel """Loads Microsoft Excel files.""" from typing import Any, List from langchain.document_loaders.unstructured import ( UnstructuredFileLoader, validate_unstructured_version, ) [docs]class UnstructuredExcelLoader(UnstructuredFileLoader): """Load Microsoft Excel...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/excel.html
41a34ea588f8-1
from unstructured.partition.xlsx import partition_xlsx return partition_xlsx(filename=self.file_path, **self.unstructured_kwargs)
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/excel.html
c7247b1b9e68-0
Source code for langchain.document_loaders.azure_blob_storage_container from typing import List from langchain.docstore.document import Document from langchain.document_loaders.azure_blob_storage_file import ( AzureBlobStorageFileLoader, ) from langchain.document_loaders.base import BaseLoader [docs]class AzureBlob...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/azure_blob_storage_container.html
ee87fd53d108-0
Source code for langchain.document_loaders.xml """Loads Microsoft Excel files.""" from typing import Any, List from langchain.document_loaders.unstructured import ( UnstructuredFileLoader, validate_unstructured_version, ) [docs]class UnstructuredXMLLoader(UnstructuredFileLoader): """Load `XML` file using `U...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/xml.html
8ac7302f0c20-0
Source code for langchain.document_loaders.pdf import json import logging import os import tempfile import time from abc import ABC from io import StringIO from pathlib import Path from typing import Any, Dict, Iterator, List, Mapping, Optional, Sequence, Union from urllib.parse import urlparse import requests from lan...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/pdf.html
8ac7302f0c20-1
""" def _get_elements(self) -> List: from unstructured.partition.pdf import partition_pdf return partition_pdf(filename=self.file_path, **self.unstructured_kwargs) [docs]class BasePDFLoader(BaseLoader, ABC): """Base Loader class for `PDF` files. If the file is a web path, it will download it...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/pdf.html
8ac7302f0c20-2
% r.status_code ) with open(temp_pdf, mode="wb") as f: f.write(r.content) self.file_path = str(temp_pdf) elif not os.path.isfile(self.file_path): raise ValueError("File path %s is not a valid file or url" % self.file_path) d...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/pdf.html
8ac7302f0c20-3
headers: Optional[Dict] = None, ) -> None: """Initialize with a file path.""" try: import pypdf # noqa:F401 except ImportError: raise ImportError( "pypdf package not found, please install it with " "`pip install pypdf`" ) self.pars...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/pdf.html
8ac7302f0c20-4
Loader also stores page numbers in metadata. """ [docs] def __init__( self, path: str, glob: str = "**/[!.]*.pdf", silent_errors: bool = False, load_hidden: bool = False, recursive: bool = False, ): self.path = path self.glob = glob self...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/pdf.html
8ac7302f0c20-5
except ImportError: raise ImportError( "`pdfminer` package not found, please install it with " "`pip install pdfminer.six`" ) super().__init__(file_path, headers=headers) self.parser = PDFMinerParser() [docs] def load(self) -> List[Document]: ...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/pdf.html
8ac7302f0c20-6
codec="", laparams=LAParams(), output_type="html", ) metadata = {"source": self.file_path} return [Document(page_content=output_string.getvalue(), metadata=metadata)] [docs]class PyMuPDFLoader(BasePDFLoader): """Load `PDF` files using `PyMuPDF`.""" [docs] ...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/pdf.html
8ac7302f0c20-7
Args: file_path: a file for loading. processed_file_format: a format of the processed file. Default is "md". max_wait_time_seconds: a maximum time to wait for the response from the server. Default is 500. should_clean_pdf: a flag to clean the PDF file. Defaul...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/pdf.html
8ac7302f0c20-8
response_data = response.json() if "pdf_id" in response_data: pdf_id = response_data["pdf_id"] return pdf_id else: raise ValueError("Unable to send PDF to Mathpix.") [docs] def wait_for_processing(self, pdf_id: str) -> None: """Wait for processing to comple...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/pdf.html
8ac7302f0c20-9
contents = contents.replace("\\section{", "# ").replace("}", "") # replace the "\" slash that Mathpix adds to escape $, %, (, etc. contents = ( contents.replace(r"\$", "$") .replace(r"\%", "%") .replace(r"\(", "(") .replace(r"\)", ")") ) re...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/pdf.html
8ac7302f0c20-10
blob = Blob.from_path(self.file_path) return parser.parse(blob) [docs]class AmazonTextractPDFLoader(BasePDFLoader): """Load `PDF` files from a local file system, HTTP or S3. To authenticate, the AWS client uses the following methods to automatically load credentials: https://boto3.amazonaws.com/...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/pdf.html
8ac7302f0c20-11
client: boto3 textract client (Optional) credentials_profile_name: AWS profile name, if not default (Optional) region_name: AWS region, eg us-east-1 (Optional) endpoint_url: endpoint url for the textract service (Optional) """ super().__init__(file_path, headers=heade...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/pdf.html
8ac7302f0c20-12
"profile name are valid." ) from e self.parser = AmazonTextractPDFParser(textract_features=features, client=client) [docs] def load(self) -> List[Document]: """Load given path as pages.""" return list(self.lazy_load()) [docs] def lazy_load( self, ) -> Iterator[D...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/pdf.html
8ac7302f0c20-13
return len(pdf_reader.pages) elif blob.mimetype == "image/tiff": num_pages = 0 img = Image.open(blob.as_bytes()) for _, _ in enumerate(ImageSequence.Iterator(img)): num_pages += 1 return num_pages elif blob.mimetype in ["image/png", "image/...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/pdf.html
8ac7302f0c20-14
super().__init__(file_path, headers=headers) [docs] def load(self) -> List[Document]: """Load given path as pages.""" return list(self.lazy_load()) [docs] def lazy_load( self, ) -> Iterator[Document]: """Lazy load given path as pages.""" blob = Blob.from_path(self.file_...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/pdf.html
31ced9d1664e-0
Source code for langchain.document_loaders.pubmed from typing import Iterator, List, Optional from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader from langchain.utilities.pubmed import PubMedAPIWrapper [docs]class PubMedLoader(BaseLoader): """Load from the `PubMed...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/pubmed.html
6bddade94e1d-0
Source code for langchain.document_loaders.arcgis_loader """Document Loader for ArcGIS FeatureLayers.""" from __future__ import annotations import json import re import warnings from datetime import datetime, timezone from typing import TYPE_CHECKING, Any, Iterator, List, Optional, Union from langchain.docstore.documen...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/arcgis_loader.html
6bddade94e1d-1
else: self.url = layer.url self.layer = layer self.layer_properties = self._get_layer_properties(lyr_desc) self.where = where if isinstance(out_fields, str): self.out_fields = out_fields elif out_fields is None: self.out_fields = "*" ...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/arcgis_loader.html
6bddade94e1d-2
item_desc = item_desc or _NOT_PROVIDED except KeyError: item_desc = _NOT_PROVIDED return { "layer_description": lyr_desc, "item_description": item_desc, "layer_properties": props, } [docs] def lazy_load(self) -> Iterator[Document]: """La...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/arcgis_loader.html
83f11042527c-0
Source code for langchain.document_loaders.discord from __future__ import annotations from typing import TYPE_CHECKING, List from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader if TYPE_CHECKING: import pandas as pd [docs]class DiscordChatLoader(BaseLoader): ""...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/discord.html
16384366aac4-0
Source code for langchain.document_loaders.roam from pathlib import Path from typing import List from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader [docs]class RoamLoader(BaseLoader): """Load `Roam` files from a directory.""" [docs] def __init__(self, path: st...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/roam.html
147c2e679e20-0
Source code for langchain.document_loaders.datadog_logs from datetime import datetime, timedelta from typing import List, Optional from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader [docs]class DatadogLogsLoader(BaseLoader): """Load `Datadog` logs. Logs are w...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/datadog_logs.html
147c2e679e20-1
raise ImportError( "Could not import datadog_api_client python package. " "Please install it with `pip install datadog_api_client`." ) from ex self.query = query configuration = Configuration() configuration.api_key["apiKeyAuth"] = api_key conf...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/datadog_logs.html
147c2e679e20-2
from datadog_api_client.v2.api.logs_api import LogsApi from datadog_api_client.v2.model.logs_list_request import LogsListRequest from datadog_api_client.v2.model.logs_list_request_page import ( LogsListRequestPage, ) from datadog_api_client.v2.model.logs_q...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/datadog_logs.html
6af616e41fbd-0
Source code for langchain.document_loaders.onedrive """Loads data from OneDrive""" from __future__ import annotations import logging from typing import TYPE_CHECKING, Iterator, List, Optional, Sequence, Union from langchain.docstore.document import Document from langchain.document_loaders.base_o365 import ( O365Bas...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/onedrive.html
6af616e41fbd-1
located at the specified path. Raises: FileNotFoundError: If the path does not exist. """ subfolder_drive = drive if self.folder_path is None: return subfolder_drive subfolders = [f for f in self.folder_path.split("/") if f != ""] if len(subfolders...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/onedrive.html
6af616e41fbd-2
"""Load all documents.""" return list(self.lazy_load())
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/onedrive.html
2435ee690776-0
Source code for langchain.document_loaders.chromium import asyncio import logging from typing import Iterator, List from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader logger = logging.getLogger(__name__) [docs]class AsyncChromiumLoader(BaseLoader): """Scrape HTML...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/chromium.html
2435ee690776-1
logger.info("Content scraped") except Exception as e: results = f"Error: {e}" await browser.close() return results [docs] def lazy_load(self) -> Iterator[Document]: """ Lazily load text content from the provided URLs. This method yields Document...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/chromium.html
adfe36d488f5-0
Source code for langchain.document_loaders.nuclia import json import uuid from typing import List from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader from langchain.tools.nuclia.tool import NucliaUnderstandingAPI [docs]class NucliaLoader(BaseLoader): """Load from ...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/nuclia.html
5f2ec46a489f-0
Source code for langchain.document_loaders.org_mode from typing import Any, List from langchain.document_loaders.unstructured import ( UnstructuredFileLoader, validate_unstructured_version, ) [docs]class UnstructuredOrgModeLoader(UnstructuredFileLoader): """Load `Org-Mode` files using `Unstructured`. Yo...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/org_mode.html
5f2ec46a489f-1
from unstructured.partition.org import partition_org return partition_org(filename=self.file_path, **self.unstructured_kwargs)
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/org_mode.html
be0ddfec41bd-0
Source code for langchain.document_loaders.json_loader import json from pathlib import Path from typing import Any, Callable, Dict, List, Optional, Union from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader [docs]class JSONLoader(BaseLoader): """Load a `JSON` file ...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/json_loader.html
be0ddfec41bd-1
json_lines (bool): Boolean flag to indicate whether the input is in JSON Lines format. """ try: import jq # noqa:F401 except ImportError: raise ImportError( "jq package not found, please install it with `pip install jq`" ) ...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/json_loader.html
be0ddfec41bd-2
text = self._get_text(sample=sample) metadata = self._get_metadata( sample=sample, source=str(self.file_path), seq_num=i ) docs.append(Document(page_content=text, metadata=metadata)) def _get_text(self, sample: Any) -> str: """Convert sample to string form...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/json_loader.html
be0ddfec41bd-3
if not isinstance(sample, dict): raise ValueError( f"Expected the jq schema to result in a list of objects (dict), \ so sample must be a dict but got `{type(sample)}`" ) if sample.get(self._content_key) is None: raise ValueError( ...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/json_loader.html
4450488a98e6-0
Source code for langchain.document_loaders.geodataframe from typing import Any, Iterator, List from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader [docs]class GeoDataFrameLoader(BaseLoader): """Load `geopandas` Dataframe.""" [docs] def __init__(self, data_frame...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/geodataframe.html
4450488a98e6-1
# assumes all geometries in GeoSeries are same CRS and Geom Type crs_str = self.data_frame.crs.to_string() if self.data_frame.crs else None geometry_type = self.data_frame.geometry.geom_type.iloc[0] for _, row in self.data_frame.iterrows(): geom = row[self.page_content_column] ...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/geodataframe.html
cfe012cd5a4d-0
Source code for langchain.document_loaders.s3_directory from __future__ import annotations from typing import TYPE_CHECKING, List, Optional, Union from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader from langchain.document_loaders.s3_file import S3FileLoader if TYPE_C...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/s3_directory.html
cfe012cd5a4d-1
:param use_ssl: Whether to use SSL. By default, SSL is used. Note that not all services support non-ssl connections. :param verify: Whether to verify SSL certificates. By default SSL certificates are verified. You can provide the following values: * False - do n...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/s3_directory.html
cfe012cd5a4d-2
:param boto_config: Advanced boto3 client configuration options. If a value is specified in the client config, its value will take precedence over environment variables and configuration values, but not over a value passed explicitly to the method. If a default config obj...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/s3_directory.html
cfe012cd5a4d-3
loader = S3FileLoader( self.bucket, obj.key, region_name=self.region_name, api_version=self.api_version, use_ssl=self.use_ssl, verify=self.verify, endpoint_url=self.endpoint_url, aws_access_ke...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/s3_directory.html
6ee43d233eed-0
Source code for langchain.document_loaders.image_captions from typing import Any, List, Tuple, Union import requests from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader [docs]class ImageCaptionLoader(BaseLoader): """Load image captions. By default, the loader ...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/image_captions.html
6ee43d233eed-1
results = [] for path_image in self.image_paths: caption, metadata = self._get_captions_and_metadata( model=model, processor=processor, path_image=path_image ) doc = Document(page_content=caption, metadata=metadata) results.append(doc) retu...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/image_captions.html
c820fb4c6caa-0
Source code for langchain.document_loaders.url_playwright """Loader that uses Playwright to load a page, then uses unstructured to load the html. """ import logging from abc import ABC, abstractmethod from typing import TYPE_CHECKING, List, Optional from langchain.docstore.document import Document from langchain.docume...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/url_playwright.html
c820fb4c6caa-1
text: The text content of the page. """ pass [docs]class UnstructuredHtmlEvaluator(PlaywrightEvaluator): """Evaluates the page HTML content using the `unstructured` library.""" [docs] def __init__(self, remove_selectors: Optional[List[str]] = None): """Initialize UnstructuredHtmlEvaluator...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/url_playwright.html
c820fb4c6caa-2
page_source = await page.content() elements = partition_html(text=page_source) return "\n\n".join([str(el) for el in elements]) [docs]class PlaywrightURLLoader(BaseLoader): """Load `HTML` pages with `Playwright` and parse with `Unstructured`. This is useful for loading pages that require javascr...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/url_playwright.html
c820fb4c6caa-3
"""Load the specified URLs using Playwright and create Document instances. Returns: List[Document]: A list of Document instances with loaded content. """ from playwright.sync_api import sync_playwright docs: List[Document] = list() with sync_playwright() as p: ...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/url_playwright.html
c820fb4c6caa-4
raise ValueError(f"page.goto() returned None for url {url}") text = await self.evaluator.evaluate_async(page, browser, response) metadata = {"source": url} docs.append(Document(page_content=text, metadata=metadata)) except Exception as e: ...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/url_playwright.html
60672482f2ec-0
Source code for langchain.document_loaders.modern_treasury import json import urllib.request from base64 import b64encode from typing import List, Optional from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader from langchain.utils import get_from_env, stringify_value MO...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/modern_treasury.html
60672482f2ec-1
resource: str, organization_id: Optional[str] = None, api_key: Optional[str] = None, ) -> None: """ Args: resource: The Modern Treasury resource to load. organization_id: The Modern Treasury organization ID. It can also be specified via the envi...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/modern_treasury.html
9c8cf2637bc2-0
Source code for langchain.document_loaders.dataframe from typing import Any, Iterator, List from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader [docs]class BaseDataFrameLoader(BaseLoader): [docs] def __init__(self, data_frame: Any, *, page_content_column: str = "te...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/dataframe.html
9c8cf2637bc2-1
if not isinstance(data_frame, pd.DataFrame): raise ValueError( f"Expected data_frame to be a pd.DataFrame, got {type(data_frame)}" ) super().__init__(data_frame, page_content_column=page_content_column)
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/dataframe.html
aaeb9af0431c-0
Source code for langchain.document_loaders.epub from typing import List from langchain.document_loaders.unstructured import ( UnstructuredFileLoader, satisfies_min_unstructured_version, ) [docs]class UnstructuredEPubLoader(UnstructuredFileLoader): """Load `EPub` files using `Unstructured`. You can run t...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/epub.html
dc2a85938d89-0
Source code for langchain.document_loaders.psychic from typing import List, Optional from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader [docs]class PsychicLoader(BaseLoader): """Load from `Psychic.dev`.""" [docs] def __init__( self, api_key: str, accou...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/psychic.html
f2e10c08ef33-0
Source code for langchain.document_loaders.etherscan import os import re from typing import Iterator, List import requests from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader [docs]class EtherscanLoader(BaseLoader): """Load transactions from `Ethereum` mainnet. ...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/etherscan.html
f2e10c08ef33-1
]: raise ValueError(f"Invalid filter {filter}") [docs] def lazy_load(self) -> Iterator[Document]: """Lazy load Documents from table.""" result = [] if self.filter == "normal_transaction": result = self.getNormTx() elif self.filter == "internal_transaction": ...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/etherscan.html
f2e10c08ef33-2
if len(items) == 0: return [Document(page_content="")] for item in items: content = str(item) metadata = {"from": item["from"], "tx_hash": item["hash"], "to": item["to"]} result.append(Document(page_content=content, metadata=metadata)) print(len(result)) ...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/etherscan.html
f2e10c08ef33-3
for item in items: content = str(item) metadata = {"from": item["from"], "tx_hash": item["hash"], "to": item["to"]} result.append(Document(page_content=content, metadata=metadata)) return result [docs] def getERC20Tx(self) -> List[Document]: url = ( f"h...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/etherscan.html
f2e10c08ef33-4
) try: response = requests.get(url) response.raise_for_status() except requests.exceptions.RequestException as e: print("Error occurred while making the request:", e) items = response.json()["result"] result = [] if len(items) == 0: ...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/etherscan.html
995aa1272f5a-0
Source code for langchain.document_loaders.async_html import asyncio import logging import warnings from concurrent.futures import ThreadPoolExecutor from typing import Any, Dict, Iterator, List, Optional, Union, cast import aiohttp import requests from langchain.docstore.document import Document from langchain.documen...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/async_html.html
995aa1272f5a-1
self.web_paths = web_path headers = header_template or default_header_template if not headers.get("User-Agent"): try: from fake_useragent import UserAgent headers["User-Agent"] = UserAgent().random except ImportError: logger.info( ...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/async_html.html
995aa1272f5a-2
) await asyncio.sleep(cooldown * backoff**i) raise ValueError("retry count exceeded") async def _fetch_with_rate_limit( self, url: str, semaphore: asyncio.Semaphore ) -> str: async with semaphore: return await self._fetch(url) [docs] async def fetch...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/async_html.html
995aa1272f5a-3
results = future.result() except RuntimeError: results = asyncio.run(self.fetch_all(self.web_paths)) docs = [] for i, text in enumerate(cast(List[str], results)): metadata = {"source": self.web_paths[i]} docs.append(Document(page_content=text, metadata=metadat...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/async_html.html
304510f02b91-0
Source code for langchain.document_loaders.hn from typing import Any, List from langchain.docstore.document import Document from langchain.document_loaders.web_base import WebBaseLoader [docs]class HNLoader(WebBaseLoader): """Load `Hacker News` data. It loads data from either main page results or the comments p...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/hn.html
304510f02b91-1
ranking = lineItem.select_one("span[class='rank']").text link = lineItem.find("span", {"class": "titleline"}).find("a").get("href") title = lineItem.find("span", {"class": "titleline"}).text.strip() metadata = { "source": self.web_path, "title": title,...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/hn.html
50bfdee85d1c-0
Source code for langchain.document_loaders.docugami import io import logging import os import re from pathlib import Path from typing import Any, Dict, List, Mapping, Optional, Sequence, Union import requests from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader from la...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/docugami.html
50bfdee85d1c-1
"""The minimum chunk size to use when parsing DGML. Defaults to 32.""" @root_validator def validate_local_or_remote(cls, values: Dict[str, Any]) -> Dict[str, Any]: """Validate that either local file paths are given, or remote API docset ID. Args: values: The values to validate. ...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/docugami.html