id
stringlengths
14
15
text
stringlengths
49
2.47k
source
stringlengths
61
166
01e330ed0de2-0
Source code for langchain.document_loaders.base """Abstract interface for document loader implementations.""" from abc import ABC, abstractmethod from typing import Iterator, List, Optional from langchain.document_loaders.blob_loaders import Blob from langchain.schema import Document from langchain.text_splitter import...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/base.html
01e330ed0de2-1
# implemented in all the existing subclasses. [docs] def lazy_load( self, ) -> Iterator[Document]: """A lazy loader for Documents.""" raise NotImplementedError( f"{self.__class__.__name__} does not implement lazy_load()" ) [docs]class BaseBlobParser(ABC): ...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/base.html
159912d219c2-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
159912d219c2-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
159912d219c2-2
firefox_options = FirefoxOptions() for arg in self.arguments: firefox_options.add_argument(arg) if self.headless: firefox_options.add_argument("--headless") if self.binary_location is not None: firefox_options.binary_location = self.bin...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/url_selenium.html
13fc9bc7b719-0
Source code for langchain.document_loaders.blackboard """Loads all documents from a blackboard course.""" import contextlib import re from pathlib import Path from typing import Any, List, Optional, Tuple from urllib.parse import unquote from langchain.docstore.document import Document from langchain.document_loaders.d...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/blackboard.html
13fc9bc7b719-1
bbrouter: str, load_all_recursively: bool = True, basic_auth: Optional[Tuple[str, str]] = None, cookies: Optional[dict] = None, continue_on_failure: Optional[bool] = False, ): """Initialize with blackboard course url. The BbRouter cookie is required for most blackboar...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/blackboard.html
13fc9bc7b719-2
self.continue_on_failure = continue_on_failure self.check_bs4() [docs] def check_bs4(self) -> None: """Check if BeautifulSoup4 is installed. Raises: ImportError: If BeautifulSoup4 is not installed. """ try: import bs4 # noqa: F401 except Import...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/blackboard.html
13fc9bc7b719-3
course_name = soup.find("span", {"id": "crumb_1"}) if course_name is None: raise ValueError("No course name found.") course_name = course_name.text.strip() # Prepare the folder path course_name_clean = ( unquote(course_name) .replace(" ", "_") ...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/blackboard.html
13fc9bc7b719-4
attachment: Tag # type: ignore for link in attachment.find_all("a"): link: Tag # type: ignore href = link.get("href") # Only add if href is not None and does not start with # if href is not None and not href.startswith("#"): ...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/blackboard.html
13fc9bc7b719-5
"""Download a file from an url. Args: path: Path to the file. """ # Get the file content response = self.session.get(self.base_url + path, allow_redirects=True) # Get the filename filename = self.parse_filename(response.url) # Write the file to disk ...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/blackboard.html
13fc9bc7b719-6
return filename if __name__ == "__main__": loader = BlackboardLoader( "https://<YOUR BLACKBOARD URL" " HERE>/webapps/blackboard/content/listContent.jsp?course_id=_<YOUR COURSE ID" " HERE>_1&content_id=_<YOUR CONTENT ID HERE>_1&mode=reset", "<YOUR BBROUTER COOKIE HERE>", load_...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/blackboard.html
c306242295f5-0
Source code for langchain.document_loaders.diffbot """Loader that uses Diffbot to load webpages in text format.""" import logging from typing import Any, List import requests from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader logger = logging.getLogger(__name__) [doc...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/diffbot.html
c306242295f5-1
"""Extract text from Diffbot on all the URLs and return Documents""" docs: List[Document] = list() for url in self.urls: try: data = self._get_diffbot_data(url) text = data["objects"][0]["text"] if "objects" in data else "" metadata = {"source"...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/diffbot.html
86c31f8fe515-0
Source code for langchain.document_loaders.larksuite """Loads LarkSuite (FeiShu) document json dump.""" 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(BaseLoad...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/larksuite.html
86c31f8fe515-1
) raw_content_json = self._get_larksuite_api_json_data( 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"]["revi...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/larksuite.html
2701945504d7-0
Source code for langchain.document_loaders.joplin import json import urllib from datetime import datetime from typing import Iterator, List, Optional from langchain.document_loaders.base import BaseLoader from langchain.schema import Document from langchain.utils import get_from_env LINK_NOTE_TEMPLATE = "joplin://x-cal...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/joplin.html
2701945504d7-1
f"{base_url}/notes?token={access_token}" 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/{{i...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/joplin.html
2701945504d7-2
def _get_tags(self, note_id: str) -> List[str]: 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 _c...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/joplin.html
7a7b4153010f-0
Source code for langchain.document_loaders.ifixit """Loads iFixit data.""" from typing import List, Optional import requests from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader from langchain.document_loaders.web_base import WebBaseLoader IFIXIT_BASE_URL = "https://ww...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/ifixit.html
7a7b4153010f-1
"""Teardowns are just guides by a different name""" self.page_type = pieces[0] if pieces[0] != "Teardown" else "Guide" if self.page_type == "Guide" or self.page_type == "Answers": self.id = pieces[2] else: self.id = pieces[1] self.web_path = web_path [docs] def...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/ifixit.html
7a7b4153010f-2
if loader.page_type == "Device": output += loader.load_device(include_guides=False) else: output += loader.load() except ValueError: continue return output [docs] def load_questions_and_answers( self, url_override: Op...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/ifixit.html
7a7b4153010f-3
[docs] def load_device( self, url_override: Optional[str] = None, include_guides: bool = True ) -> List[Document]: """Loads a device Args: url_override: A URL to override the default URL. include_guides: Whether to include guides linked to from the device. ...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/ifixit.html
7a7b4153010f-4
else: url = url_override res = requests.get(url) if res.status_code != 200: raise ValueError( "Could not load guide: " + self.web_path + "\n" + res.json() ) data = res.json() doc_parts = ["# " + data["title"], data["introduction_raw"]] ...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/ifixit.html
14dbe94e8f57-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): """Loads a query result ...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/pubmed.html
f6c47e0c3569-0
Source code for langchain.document_loaders.onedrive """Loads data from OneDrive""" from __future__ import annotations import logging import os import tempfile from enum import Enum from pathlib import Path from typing import TYPE_CHECKING, Dict, List, Optional, Type, Union from pydantic import BaseModel, BaseSettings, ...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/onedrive.html
f6c47e0c3569-1
mime_types_mapping[ file_type.value ] = "application/vnd.openxmlformats-officedocument.wordprocessingml.document" # noqa: E501 elif file_type.value == "pdf": mime_types_mapping[file_type.value] = "application/pdf" return mime_types_mapping [docs]c...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/onedrive.html
f6c47e0c3569-2
self.settings.client_id, self.settings.client_secret.get_secret_value(), ), scopes=SCOPES, token_backend=token_backend, **{"raise_http_errors": False}, ) else: token_backend = FileSystemTokenBackend( ...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/onedrive.html
f6c47e0c3569-3
items = subfolder_drive.get_items() except (IndexError, AttributeError): raise FileNotFoundError("Path {} not exist.".format(self.folder_path)) return subfolder_drive def _load_from_folder(self, folder: Type[Folder]) -> List[Document]: """ Loads all supported docu...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/onedrive.html
f6c47e0c3569-4
file_mime_types = file_types.fetch_mime_types() with tempfile.TemporaryDirectory() as temp_dir: file_path = f"{temp_dir}" os.makedirs(os.path.dirname(file_path), exist_ok=True) for object_id in self.object_ids if self.object_ids else [""]: file = drive.get_ite...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/onedrive.html
6ecaff7bdb66-0
Source code for langchain.document_loaders.airbyte """Loads local airbyte json files.""" from typing import Any, Callable, Iterator, List, Mapping, Optional from libs.langchain.langchain.utils.utils import guard_import from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoad...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/airbyte.html
6ecaff7bdb66-1
return self._integration._load_data( stream_name=self._stream_name, state=self._state ) [docs]class AirbyteHubspotLoader(AirbyteCDKLoader): [docs] def __init__( self, config: Mapping[str, Any], stream_name: str, record_handler: Optional[RecordHandler] = None, ...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/airbyte.html
6ecaff7bdb66-2
state: Optional[Any] = None, ) -> None: source_class = guard_import( "source_typeform", pip_name="airbyte-source-typeform" ).SourceTypeform super().__init__( config=config, source_class=source_class, stream_name=stream_name, record_...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/airbyte.html
6ecaff7bdb66-3
record_handler=record_handler, state=state, ) [docs]class AirbyteSalesforceLoader(AirbyteCDKLoader): [docs] def __init__( self, config: Mapping[str, Any], stream_name: str, record_handler: Optional[RecordHandler] = None, state: Optional[Any] = None, ) -...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/airbyte.html
2f79ebb12472-0
Source code for langchain.document_loaders.whatsapp_chat import re from pathlib import Path from typing import List from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader [docs]def concatenate_rows(date: str, sender: str, text: str) -> str: """Combine message informa...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/whatsapp_chat.html
2f79ebb12472-1
) if result: date, sender, text = result.groups() if text not in ignore_lines: text_content += concatenate_rows(date, sender, text) metadata = {"source": str(p)} return [Document(page_content=text_content, metadata=metadata)]
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/whatsapp_chat.html
050ca86ec9c9-0
Source code for langchain.document_loaders.docugami """Loads processed documents from 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 pydantic import BaseModel, root_validator from langchain.do...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/docugami.html
050ca86ec9c9-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
050ca86ec9c9-2
if len(doppelgangers) > 1: idx_of_self = doppelgangers.index(chunk) qname = f"{qname}[{idx_of_self + 1}]" return qname def _xpath_for_chunk(chunk: Any) -> str: """Get the xpath for a chunk.""" ancestor_chain = chunk.xpath("ancestor-or-s...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/docugami.html
050ca86ec9c9-3
"""Get the leaf structural nodes of a node.""" if _is_structural(node) and not _has_structural_descendant(node): return [node] else: leaf_nodes = [] for child in node: leaf_nodes.extend(_leaf_structural_nodes(child)) ...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/docugami.html
050ca86ec9c9-4
# small chunk at the end left over, just append to last chunk chunks[-1].page_content += " " + prev_small_chunk_text return chunks def _document_details_for_docset_id(self, docset_id: str) -> List[Dict]: """Gets all document details for the given docset ID""" url = f"{self.api}/d...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/docugami.html
050ca86ec9c9-5
"""Gets project metadata for all files""" project_id = project.get("id") url = f"{self.api}/projects/{project_id}/artifacts/latest" all_artifacts = [] while url: response = requests.request( "GET", url, headers={"Authorization":...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/docugami.html
050ca86ec9c9-6
for entry in entries: heading = entry.xpath("./pr:Heading", namespaces=ns)[0].text value = " ".join( entry.xpath("./pr:Value", namespaces=ns)[0].itertext() ).strip() metadata[heading] = value ...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/docugami.html
050ca86ec9c9-7
] _project_details = self._project_details_for_docset_id(self.docset_id) combined_project_metadata = {} if _project_details: # if there are any projects for this docset, load project metadata for project in _project_details: metadat...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/docugami.html
321e9965eec1-0
Source code for langchain.document_loaders.web_base """Web base loader class.""" import asyncio import logging import warnings from typing import Any, Dict, Iterator, List, Optional, Union import aiohttp import requests from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoa...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/web_base.html
321e9965eec1-1
requests_kwargs: Dict[str, Any] = {} """kwargs for requests""" raise_for_status: bool = False """Raise an exception if http status code denotes an error.""" bs_get_text_kwargs: Dict[str, Any] = {} """kwargs for beatifulsoup4 get_text""" [docs] def __init__( self, web_path: Union[s...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/web_base.html
321e9965eec1-2
self.session.headers = dict(headers) self.session.verify = verify_ssl self.continue_on_failure = continue_on_failure if proxies: self.session.proxies.update(proxies) @property def web_path(self) -> str: if len(self.web_paths) > 1: raise ValueError("Multipl...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/web_base.html
321e9965eec1-3
) return "" logger.exception( f"Error fetching {url} and aborting, use continue_on_failure=True " "to continue loading urls after encountering an error." ) raise e [docs] async def fetch_all(self, urls: List[s...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/web_base.html
321e9965eec1-4
if parser is None: if url.endswith(".xml"): parser = "xml" else: parser = self.default_parser self._check_parser(parser) final_results.append(BeautifulSoup(result, parser)) return final_results def _scrape(se...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/web_base.html
321e9965eec1-5
"""Load text from the urls in web_path async into Documents.""" results = self.scrape_all(self.web_paths) docs = [] for i in range(len(results)): soup = results[i] text = soup.get_text(**self.bs_get_text_kwargs) metadata = _build_metadata(soup, self.web_paths[...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/web_base.html
61316a877410-0
Source code for langchain.document_loaders.figma """Loads Figma files json dump.""" import json import urllib.request from typing import Any, List from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader from langchain.utils import stringify_dict [docs]class FigmaFileLoade...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/figma.html
a0b5a21f5622-0
Source code for langchain.document_loaders.azlyrics """Loads AZLyrics.""" from typing import List from langchain.docstore.document import Document from langchain.document_loaders.web_base import WebBaseLoader [docs]class AZLyricsLoader(WebBaseLoader): """Loads AZLyrics webpages.""" [docs] def load(self) -> List[...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/azlyrics.html
42f0ad1bf8ed-0
Source code for langchain.document_loaders.csv_loader import csv from typing import Any, Dict, List, Optional from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader from langchain.document_loaders.unstructured import ( UnstructuredFileLoader, validate_unstructure...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/csv_loader.html
42f0ad1bf8ed-1
encoding: The encoding of the CSV file. Optional. Defaults to None. """ self.file_path = file_path self.source_column = source_column self.encoding = encoding self.csv_args = csv_args or {} [docs] def load(self) -> List[Document]: """Load data into document objects."""...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/csv_loader.html
42f0ad1bf8ed-2
-------- from langchain.document_loaders.csv_loader import UnstructuredCSVLoader loader = UnstructuredCSVLoader("stanley-cups.csv", mode="elements") docs = loader.load() """ [docs] def __init__( self, file_path: str, mode: str = "single", **unstructured_kwargs: Any ): """ ...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/csv_loader.html
d23f5667795f-0
Source code for langchain.document_loaders.helpers """Document loader helpers.""" import concurrent.futures from typing import List, NamedTuple, Optional, cast [docs]class FileEncoding(NamedTuple): """A file encoding as the NamedTuple.""" encoding: Optional[str] """The encoding of the file.""" confidenc...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/helpers.html
50d80b24e52c-0
Source code for langchain.document_loaders.azure_blob_storage_container """Loading logic for loading documents from an Azure Blob Storage container.""" from typing import List from langchain.docstore.document import Document from langchain.document_loaders.azure_blob_storage_file import ( AzureBlobStorageFileLoader...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/azure_blob_storage_container.html
fe8c9e6f606f-0
Source code for langchain.document_loaders.gcs_directory """Loading logic for loading documents from an GCS directory.""" from typing import Callable, List, Optional from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader from langchain.document_loaders.gcs_file import GC...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/gcs_directory.html
fe8c9e6f606f-1
# intermediate directories on the fly if blob.name.endswith("/"): continue loader = GCSFileLoader( self.project_name, self.bucket, blob.name, loader_func=self._loader_func ) docs.extend(loader.load()) return docs
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/gcs_directory.html
1b6c6038d0b5-0
Source code for langchain.document_loaders.duckdb_loader from typing import Dict, List, Optional, cast from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader [docs]class DuckDBLoader(BaseLoader): """Loads a query result from DuckDB into a list of documents. Each ...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/duckdb_loader.html
1b6c6038d0b5-1
self.page_content_columns = page_content_columns self.metadata_columns = metadata_columns [docs] def load(self) -> List[Document]: try: import duckdb except ImportError: raise ImportError( "Could not import duckdb python package. " "Plea...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/duckdb_loader.html
478cab0255f0-0
Source code for langchain.document_loaders.twitter """Twitter document loader.""" 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_CHEC...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/twitter.html
478cab0255f0-1
tweets = api.user_timeline(screen_name=username, count=self.number_tweets) 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: dic...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/twitter.html
478cab0255f0-2
auth = tweepy.OAuthHandler( 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, nu...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/twitter.html
362517d1472f-0
Source code for langchain.document_loaders.epub """Loads EPub files.""" from typing import List from langchain.document_loaders.unstructured import ( UnstructuredFileLoader, satisfies_min_unstructured_version, ) [docs]class UnstructuredEPubLoader(UnstructuredFileLoader): """Loader that uses Unstructured to ...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/epub.html
629ca59cfc20-0
Source code for langchain.document_loaders.dataframe """Load from a Dataframe object""" from typing import Any, Iterator, List from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader [docs]class DataFrameLoader(BaseLoader): """Load Pandas DataFrame.""" [docs] def _...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/dataframe.html
f31fa817b477-0
Source code for langchain.document_loaders.image """Loads image files.""" from typing import List from langchain.document_loaders.unstructured import UnstructuredFileLoader [docs]class UnstructuredImageLoader(UnstructuredFileLoader): """Loader that uses Unstructured to load PNG and JPG files. You can run the lo...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/image.html
8a7a2428ae7e-0
Source code for langchain.document_loaders.tomarkdown """Loads HTML to markdown using 2markdown.""" from __future__ import annotations from typing import Iterator, List import requests from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader [docs]class ToMarkdownLoader(Ba...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/tomarkdown.html
9f0e51363552-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): """Loader that uses unstruc...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/xml.html
5cf557109c7f-0
Source code for langchain.document_loaders.readthedocs """Loads ReadTheDocs documentation directory dump.""" from pathlib import Path from typing import Any, List, Optional, Tuple, Union from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader [docs]class ReadTheDocsLoader...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/readthedocs.html
5cf557109c7f-1
from bs4 import BeautifulSoup except ImportError: raise ImportError( "Could not import python packages. " "Please install it with `pip install beautifulsoup4`. " ) try: _ = BeautifulSoup( "<html><body>Parser builder libr...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/readthedocs.html
5cf557109c7f-2
if text is not None: break if text is not None: text = text.get_text() else: text = "" # trim empty lines return "\n".join([t for t in text.split("\n") if t])
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/readthedocs.html
267a3c92ed94-0
Source code for langchain.document_loaders.modern_treasury """Loader that fetches data from 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 lan...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/modern_treasury.html
267a3c92ed94-1
[docs] def __init__( self, 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...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/modern_treasury.html
267a3c92ed94-2
[docs] def load(self) -> List[Document]: return self._get_resource()
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/modern_treasury.html
d864fc580dc9-0
Source code for langchain.document_loaders.reddit """Reddit document loader.""" from __future__ import annotations from typing import TYPE_CHECKING, Iterable, List, Optional, Sequence from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader if TYPE_CHECKING: import pra...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/reddit.html
d864fc580dc9-1
self.client_secret = client_secret self.user_agent = user_agent self.search_queries = search_queries self.mode = mode self.categories = categories self.number_posts = number_posts [docs] def load(self) -> List[Document]: """Load reddits.""" praw = _dependable_p...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/reddit.html
d864fc580dc9-2
"post_category": category, "post_title": post.title, "post_score": post.score, "post_id": post.id, "post_url": post.url, "post_author": post.author, } yield Document( page_content=post.selftext, ...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/reddit.html
c70f394f7ee2-0
Source code for langchain.document_loaders.gitbook """Loads GitBook.""" from typing import Any, List, Optional from urllib.parse import urljoin, urlparse from langchain.docstore.document import Document from langchain.document_loaders.web_base import WebBaseLoader [docs]class GitbookLoader(WebBaseLoader): """Load G...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/gitbook.html
c70f394f7ee2-1
self.base_url = self.base_url[:-1] if load_all_paths: # set web_path to the sitemap if we want to crawl all paths web_paths = f"{self.base_url}/sitemap.xml" else: web_paths = web_page super().__init__(web_paths) self.load_all_paths = load_all_paths ...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/gitbook.html
c70f394f7ee2-2
metadata = {"source": custom_url or self.web_path, "title": title} return Document(page_content=content, metadata=metadata) def _get_paths(self, soup: Any) -> List[str]: """Fetch all relative paths in the navbar.""" return [urlparse(loc.text).path for loc in soup.find_all("loc")]
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/gitbook.html
6eb2b0cdcf19-0
Source code for langchain.document_loaders.cube_semantic import json import logging import time from typing import List import requests from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader logger = logging.getLogger(__name__) [docs]class CubeSemanticLoader(BaseLoader):...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/cube_semantic.html
6eb2b0cdcf19-1
self.dimension_values_retry_delay = dimension_values_retry_delay def _get_dimension_values(self, dimension_name: str) -> List[str]: """Makes a call to Cube's REST API load endpoint to retrieve values for dimensions. These values can be used to achieve a more accurate filtering. """ ...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/cube_semantic.html
6eb2b0cdcf19-2
"""Makes a call to Cube's REST API metadata endpoint. Returns: A list of documents with attributes: - page_content=column_title + column_description - metadata - table_name - column_name - column_data_type ...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/cube_semantic.html
6eb2b0cdcf19-3
column_values=dimension_values, ) page_content = f"{str(item.get('title'))}, " page_content += f"{str(item.get('description'))}" docs.append(Document(page_content=page_content, metadata=metadata)) return docs
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/cube_semantic.html
29615da9cc25-0
Source code for langchain.document_loaders.conllu """Load CoNLL-U files.""" import csv from typing import List from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader [docs]class CoNLLULoader(BaseLoader): """Load CoNLL-U files.""" [docs] def __init__(self, file_pat...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/conllu.html
d006de552f09-0
Source code for langchain.document_loaders.python import tokenize from langchain.document_loaders.text import TextLoader [docs]class PythonLoader(TextLoader): """ Load Python files, respecting any non-default encoding if specified. """ [docs] def __init__(self, file_path: str): """Initialize with...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/python.html
8cf9ec13df96-0
Source code for langchain.document_loaders.bilibili import json import re import warnings from typing import List, Tuple import requests from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader [docs]class BiliBiliLoader(BaseLoader): """Loads bilibili transcripts.""" [...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/bilibili.html
8cf9ec13df96-1
raise ValueError(f"{url} is not bilibili url.") else: raise ValueError(f"{url} is not bilibili url.") video_info = sync(v.get_info()) video_info.update({"url": url}) sub = sync(v.get_subtitle(video_info["cid"])) # Get subtitle url sub_list = sub["subti...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/bilibili.html
74397fff01dc-0
Source code for langchain.document_loaders.generic from __future__ import annotations from pathlib import Path from typing import Iterator, List, Literal, Optional, Sequence, Union from langchain.document_loaders.base import BaseBlobParser, BaseLoader from langchain.document_loaders.blob_loaders import BlobLoader, File...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/generic.html
74397fff01dc-1
from langchain.document_loaders.parsers.pdf import PyPDFParser # Recursively load all text files in a directory. loader = GenericLoader.from_filesystem( "/path/to/dir", glob="**/*.pdf", parser=PyPDFParser() ) """ [docs] def __ini...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/generic.html
74397fff01dc-2
*, glob: str = "**/[!.]*", suffixes: Optional[Sequence[str]] = None, show_progress: bool = False, parser: Union[DEFAULT, BaseBlobParser] = "default", ) -> GenericLoader: """Create a generic document loader using a filesystem blob loader. Args: path: The pa...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/generic.html
ec9849910e08-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 typing import List, Optional from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader logger = logging....
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/url_playwright.html
ec9849910e08-1
[docs] def load(self) -> List[Document]: """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 from unstructured.part...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/url_playwright.html
ec9849910e08-2
docs: List[Document] = list() async with async_playwright() as p: browser = await p.chromium.launch(headless=self.headless) for url in self.urls: try: page = await browser.new_page() await page.goto(url) for sele...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/url_playwright.html
370668585036-0
Source code for langchain.document_loaders.directory """Load documents from a directory.""" import concurrent import logging 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...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/directory.html
370668585036-1
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 files. Defaults to UnstructuredFileLoader. loader_kwargs: Keyword arguments to pass to loader_c...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/directory.html
370668585036-2
docs.extend(sub_docs) except Exception as e: if self.silent_errors: logger.warning(f"Error loading file {str(item)}: {e}") else: raise e finally: if pbar: p...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/directory.html
316adfeb76b6-0
Source code for langchain.document_loaders.notebook """Loads .ipynb notebook files.""" import json from pathlib import Path from typing import Any, List from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader [docs]def concatenate_cells( cell: dict, include_outputs: b...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/notebook.html
316adfeb76b6-1
output = output[0]["text"] min_output = min(max_output_length, len(output)) return ( f"'{cell_type}' cell: '{source}'\n with " f"output: '{output[:min_output]}'\n\n" ) else: return f"'{cell_type}' cell: '{source}'\n\n" return "" [docs]d...
https://api.python.langchain.com/en/latest/_modules/langchain/document_loaders/notebook.html