id
stringlengths
14
16
text
stringlengths
13
2.7k
source
stringlengths
57
178
97f84442c522-1
raise ImportError( "Could not import git python package. " "Please install it with `pip install GitPython`." ) from ex if not os.path.exists(self.repo_path) and self.clone_url is None: raise ValueError(f"Path {self.repo_path} does not exist") elif ...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/git.html
97f84442c522-2
content = f.read() file_type = os.path.splitext(item.name)[1] # loads only text files try: text_content = content.decode("utf-8") except UnicodeDecodeError: continue metada...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/git.html
2fa6a7c0b438-0
Source code for langchain.document_loaders.arxiv from typing import Any, List, Optional from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader from langchain.utilities.arxiv import ArxivAPIWrapper [docs]class ArxivLoader(BaseLoader): """Load a query result from `Arxi...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/arxiv.html
4c3e6a6e11bc-0
Source code for langchain.document_loaders.email import os from typing import Any, List from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader from langchain.document_loaders.unstructured import ( UnstructuredFileLoader, satisfies_min_unstructured_version, ) [doc...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/email.html
4c3e6a6e11bc-1
unstructured_kwargs["attachment_partitioner"] = partition super().__init__(file_path=file_path, mode=mode, **unstructured_kwargs) def _get_elements(self) -> List: from unstructured.file_utils.filetype import FileType, detect_filetype filetype = detect_filetype(self.file_path) if file...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/email.html
4c3e6a6e11bc-2
import extract_msg msg = extract_msg.Message(self.file_path) return [ Document( page_content=msg.body, metadata={ "source": self.file_path, "subject": msg.subject, "sender": msg.sender, ...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/email.html
4d3ea93e8697-0
Source code for langchain.document_loaders.srt from typing import List from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader [docs]class SRTLoader(BaseLoader): """Load `.srt` (subtitle) files.""" [docs] def __init__(self, file_path: str): """Initialize wi...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/srt.html
3e4df9f1cdb5-0
Source code for langchain.document_loaders.text import logging from typing import List, Optional from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader from langchain.document_loaders.helpers import detect_file_encodings logger = logging.getLogger(__name__) [docs]class T...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/text.html
3e4df9f1cdb5-1
except Exception as e: raise RuntimeError(f"Error loading {self.file_path}") from e metadata = {"source": self.file_path} return [Document(page_content=text, metadata=metadata)]
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/text.html
4f4d1453f19a-0
Source code for langchain.document_loaders.notiondb from typing import Any, Dict, List, Optional import requests from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader NOTION_BASE_URL = "https://api.notion.com/v1" DATABASE_URL = NOTION_BASE_URL + "/databases/{database_id...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/notiondb.html
4f4d1453f19a-1
Returns: List[Document]: List of documents. """ page_summaries = self._retrieve_page_summaries() return list(self.load_page(page_summary) for page_summary in page_summaries) def _retrieve_page_summaries( self, query_dict: Dict[str, Any] = {"page_size": 100} ) -> List[...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/notiondb.html
4f4d1453f19a-2
) elif prop_type == "multi_select": value = ( [item["name"] for item in prop_data["multi_select"]] if prop_data["multi_select"] else [] ) elif prop_type == "url": value = prop_data["url"] ...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/notiondb.html
4f4d1453f19a-3
else: value = None metadata[prop_name.lower()] = value metadata["id"] = page_id return Document(page_content=self._load_blocks(page_id), metadata=metadata) def _load_blocks(self, block_id: str, num_tabs: int = 0) -> str: """Read a block and its children.""" ...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/notiondb.html
0e4808abcab7-0
Source code for langchain.document_loaders.rocksetdb from typing import Any, Callable, Iterator, List, Optional, Tuple from langchain.document_loaders.base import BaseLoader from langchain.schema import Document [docs]def default_joiner(docs: List[Tuple[str, Any]]) -> str: """Default joiner for content columns.""" ...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/rocksetdb.html
0e4808abcab7-1
): """Initialize with Rockset client. Args: client: Rockset client object. query: Rockset query object. content_keys: The collection columns to be written into the `page_content` of the Documents. metadata_keys: The collection columns to be...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/rocksetdb.html
0e4808abcab7-2
self.paginator = QueryPaginator self.request_model = QueryRequestSql try: self.client.set_application("langchain") except AttributeError: # ignore pass [docs] def load(self) -> List[Document]: return list(self.lazy_load()) [docs] def lazy_load(se...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/rocksetdb.html
9eaac0915f95-0
Source code for langchain.document_loaders.college_confidential from typing import List from langchain.docstore.document import Document from langchain.document_loaders.web_base import WebBaseLoader [docs]class CollegeConfidentialLoader(WebBaseLoader): """Load `College Confidential` webpages.""" [docs] def load(...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/college_confidential.html
c060b3c53d31-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...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/xml.html
b0eff740e71a-0
Source code for langchain.document_loaders.spreedly import json import urllib.request from typing import List from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader from langchain.utils import stringify_dict SPREEDLY_ENDPOINTS = { "gateways_options": "https://core.sp...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/spreedly.html
b0eff740e71a-1
with urllib.request.urlopen(request) as response: json_data = json.loads(response.read().decode()) text = stringify_dict(json_data) metadata = {"source": url} return [Document(page_content=text, metadata=metadata)] def _get_resource(self) -> List[Document]: en...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/spreedly.html
0ea0cdc21abc-0
Source code for langchain.document_loaders.gutenberg from typing import List from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader [docs]class GutenbergLoader(BaseLoader): """Load from `Gutenberg.org`.""" [docs] def __init__(self, file_path: str): """Init...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/gutenberg.html
6148429fcbdd-0
Source code for langchain.document_loaders.base_o365 """Base class for all loaders that uses O365 Package""" from __future__ import annotations import logging import os import tempfile from abc import abstractmethod from enum import Enum from pathlib import Path from typing import TYPE_CHECKING, Dict, Iterable, List, S...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/base_o365.html
6148429fcbdd-1
elif file_type.value == "docx": 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 mi...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/base_o365.html
6148429fcbdd-2
the files loaded from the folder. """ file_mime_types = self._fetch_mime_types items = folder.get_items() with tempfile.TemporaryDirectory() as temp_dir: os.makedirs(os.path.dirname(temp_dir), exist_ok=True) for file in items: if file.is_file: ...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/base_o365.html
6148429fcbdd-3
if file.is_file: if file.mime_type in list(file_mime_types.values()): file.download(to_path=temp_dir, chunk_size=self.chunk_size) loader = FileSystemBlobLoader(path=temp_dir) yield from loader.yield_blobs() def _auth(self) -> Account: """Au...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/base_o365.html
8e40727bb64a-0
Source code for langchain.document_loaders.lakefs import os import tempfile import urllib.parse from typing import Any, List, Optional from urllib.parse import urljoin import requests from requests.auth import HTTPBasicAuth from langchain.document_loaders.base import BaseLoader from langchain.document_loaders.unstructu...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/lakefs.html
8e40727bb64a-1
return list( map( lambda res: (res["path"], res["physical_address"]), olsr_json["results"] ) ) [docs] def is_presign_supported(self) -> bool: config_endpoint = self.__endpoint + "config" response = requests.get(config_endpoint, auth=self.__auth) ...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/lakefs.html
8e40727bb64a-2
self.repo = "" if repo is None or repo == "" else str(repo) self.ref = "main" if ref is None or ref == "" else str(ref) self.path = "" if path is None else str(path) [docs] def set_path(self, path: str) -> None: self.path = path [docs] def set_ref(self, ref: str) -> None: self.ref ...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/lakefs.html
8e40727bb64a-3
[docs] def __init__( self, url: str, repo: str, ref: str = "main", path: str = "", presign: bool = True, **unstructured_kwargs: Any, ): """ Args: :param lakefs_access_key: :param lakefs_secret_key: :param lakefs_endpo...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/lakefs.html
5a5bad3b6d65-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...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/azure_blob_storage_container.html
0a296f521c5a-0
Source code for langchain.document_loaders.quip import logging import re import xml.etree.cElementTree import xml.sax.saxutils from io import BytesIO from typing import List, Optional, Sequence from xml.etree.ElementTree import ElementTree from langchain.docstore.document import Document from langchain.document_loaders...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/quip.html
0a296f521c5a-1
include_all_folders: bool = False, include_comments: bool = False, include_images: bool = False, ) -> List[Document]: """ Args: :param folder_ids: List of specific folder IDs to load, defaults to None :param thread_ids: List of specific thread IDs to load, def...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/quip.html
0a296f521c5a-2
[docs] def get_thread_ids_by_folder_id( self, folder_id: str, depth: int, thread_ids: List[str] ) -> None: """Get thread ids by folder id and update in thread_ids""" from quip_api.quip import HTTPError, QuipError try: folder = self.quip_client.get_folder(folder_id) ...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/quip.html
0a296f521c5a-3
docs = [] for thread_id in thread_ids: doc = self.process_thread(thread_id, include_images, include_messages) if doc is not None: docs.append(doc) return docs [docs] def process_thread( self, thread_id: str, include_images: bool, include_messages: bool ...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/quip.html
0a296f521c5a-4
metadata=metadata, ) return None [docs] def process_thread_images(self, tree: ElementTree) -> str: text = "" try: from PIL import Image from pytesseract import pytesseract except ImportError: raise ImportError( "`Pillow o...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/quip.html
0a296f521c5a-5
sanitized_title = re.sub(r"\s", " ", title) sanitized_title = re.sub(r"(?u)[^- \w.]", "", sanitized_title) if len(sanitized_title) > _MAXIMUM_TITLE_LENGTH: sanitized_title = sanitized_title[:_MAXIMUM_TITLE_LENGTH] return sanitized_title
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/quip.html
85064aaaa60e-0
Source code for langchain.document_loaders.word_document """Loads word documents.""" import os import tempfile from abc import ABC from typing import List from urllib.parse import urlparse import requests from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader from langch...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/word_document.html
85064aaaa60e-1
if hasattr(self, "temp_file"): self.temp_file.close() [docs] def load(self) -> List[Document]: """Load given path as single page.""" import docx2txt return [ Document( page_content=docx2txt.process(self.file_path), metadata={"source": se...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/word_document.html
85064aaaa60e-2
from unstructured.file_utils.filetype import FileType, detect_filetype unstructured_version = tuple( [int(x) for x in __unstructured_version__.split(".")] ) # NOTE(MthwRobinson) - magic will raise an import error if the libmagic # system dependency isn't installed. If it's no...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/word_document.html
c017b274f59d-0
Source code for langchain.document_loaders.s3_file from __future__ import annotations import os import tempfile from typing import TYPE_CHECKING, List, Optional, Union from langchain.document_loaders.unstructured import UnstructuredBaseLoader if TYPE_CHECKING: import botocore [docs]class S3FileLoader(UnstructuredBa...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/s3_file.html
c017b274f59d-1
Note that not all services support non-ssl connections. :param verify: Whether or not to verify SSL certificates. By default SSL certificates are verified. You can provide the following values: * False - do not validate SSL certificates. SSL will still be used...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/s3_file.html
c017b274f59d-2
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 object is set on the session, the config object used when creating the client w...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/s3_file.html
c017b274f59d-3
os.makedirs(os.path.dirname(file_path), exist_ok=True) s3.download_file(self.bucket, self.key, file_path) return partition(filename=file_path) def _get_metadata(self) -> dict: return {"source": f"s3://{self.bucket}/{self.key}"}
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/s3_file.html
9de608e668e0-0
Source code for langchain.document_loaders.trello from __future__ import annotations from typing import TYPE_CHECKING, Any, List, Literal, Optional, Tuple from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader from langchain.utils import get_from_env if TYPE_CHECKING: ...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/trello.html
9de608e668e0-1
self.include_card_name = include_card_name self.include_comments = include_comments self.include_checklist = include_checklist self.extra_metadata = extra_metadata self.card_filter = card_filter [docs] @classmethod def from_credentials( cls, board_name: str, ...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/trello.html
9de608e668e0-2
token = token or get_from_env("token", "TRELLO_TOKEN") client = TrelloClient(api_key=api_key, token=token) return cls(client, board_name, **kwargs) [docs] def load(self) -> List[Document]: """Loads all cards from the specified Trello board. You can filter the cards, metadata and text ...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/trello.html
9de608e668e0-3
if self.include_card_name: text_content = card.name + "\n" if card.description.strip(): text_content += BeautifulSoup(card.description, "lxml").get_text() if self.include_checklist: # Get all the checklist items on the card for checklist in card.checklists...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/trello.html
59203466be51-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...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/url_selenium.html
59203466be51-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...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/url_selenium.html
59203466be51-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...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/url_selenium.html
59203466be51-3
) except NoSuchElementException: pass return metadata [docs] def load(self) -> List[Document]: """Load the specified URLs using Selenium and create Document instances. Returns: List[Document]: A list of Document instances with loaded content. """ ...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/url_selenium.html
b05ad14b7935-0
Source code for langchain.document_loaders.wikipedia from typing import List, Optional from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader from langchain.utilities.wikipedia import WikipediaAPIWrapper [docs]class WikipediaLoader(BaseLoader): """Load from `Wikipedi...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/wikipedia.html
b05ad14b7935-1
Loads the query result from Wikipedia into a list of Documents. Returns: List[Document]: A list of Document objects representing the loaded Wikipedia pages. """ client = WikipediaAPIWrapper( lang=self.lang, top_k_results=self.load_max_docs, ...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/wikipedia.html
c0d31dcc599d-0
Source code for langchain.document_loaders.tensorflow_datasets from typing import Callable, Dict, Iterator, List, Optional from langchain.document_loaders.base import BaseLoader from langchain.schema import Document from langchain.utilities.tensorflow_datasets import TensorflowDatasets [docs]class TensorflowDatasetLoad...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/tensorflow_datasets.html
c0d31dcc599d-1
): """Initialize the TensorflowDatasetLoader. Args: dataset_name: the name of the dataset to load split_name: the name of the split to load. load_max_docs: a limit to the number of loaded documents. Defaults to 100. sample_to_document_function: a function ...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/tensorflow_datasets.html
a92de892b668-0
Source code for langchain.document_loaders.tsv from typing import Any, List from langchain.document_loaders.unstructured import ( UnstructuredFileLoader, validate_unstructured_version, ) [docs]class UnstructuredTSVLoader(UnstructuredFileLoader): """Load `TSV` files using `Unstructured`. Like other U...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/tsv.html
35889f3494c0-0
Source code for langchain.document_loaders.brave_search from typing import Iterator, List, Optional from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader from langchain.utilities.brave_search import BraveSearchWrapper [docs]class BraveSearchLoader(BaseLoader): """Lo...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/brave_search.html
693af17b410d-0
Source code for langchain.document_loaders.rst """Loads RST files.""" from typing import Any, List from langchain.document_loaders.unstructured import ( UnstructuredFileLoader, validate_unstructured_version, ) [docs]class UnstructuredRSTLoader(UnstructuredFileLoader): """Load `RST` files using `Unstructured...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/rst.html
693af17b410d-1
""" validate_unstructured_version(min_unstructured_version="0.7.5") super().__init__(file_path=file_path, mode=mode, **unstructured_kwargs) def _get_elements(self) -> List: from unstructured.partition.rst import partition_rst return partition_rst(filename=self.file_path, **self.unstr...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/rst.html
75be2ccc1ec9-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__) ...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/rss.html
75be2ccc1ec9-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: ...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/rss.html
75be2ccc1ec9-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 ...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/rss.html
a5ccd67d865f-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...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/epub.html
eb539fa867d9-0
Source code for langchain.document_loaders.mastodon from __future__ import annotations import os from typing import TYPE_CHECKING, Any, Dict, Iterable, List, Optional, Sequence from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader if TYPE_CHECKING: import mastodon d...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/mastodon.html
eb539fa867d9-1
Defaults to "https://mastodon.social". """ mastodon = _dependable_mastodon_import() access_token = access_token or os.environ.get("MASTODON_ACCESS_TOKEN") self.api = mastodon.Mastodon( access_token=access_token, api_base_url=api_base_url ) self.mastodon_accoun...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/mastodon.html
73ed6aa0f53a-0
Source code for langchain.document_loaders.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 GCSFileLoader from langchain.utilities.vertexai import get_client_i...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/gcs_directory.html
73ed6aa0f53a-1
for blob in client.list_blobs(self.bucket, prefix=self.prefix): # we shall just skip directories since GCSFileLoader creates # intermediate directories on the fly if blob.name.endswith("/"): continue loader = GCSFileLoader( self.project_nam...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/gcs_directory.html
351e927d8727-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, Sequence, Union import aiohttp import requests from langchain.docstore.document import Document from langchain.document_loaders.base impo...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/web_base.html
351e927d8727-1
verify_ssl: bool = True, proxies: Optional[dict] = None, continue_on_failure: bool = False, autoset_encoding: bool = True, encoding: Optional[str] = None, web_paths: Sequence[str] = (), requests_per_second: int = 2, default_parser: str = "html.parser", req...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/web_base.html
351e927d8727-2
f" web_paths must be Sequence[str] got ({type(web_paths)})" ) self.requests_per_second = requests_per_second self.default_parser = default_parser self.requests_kwargs = requests_kwargs or {} self.raise_for_status = raise_for_status self.bs_get_text_kwargs = bs_get_tex...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/web_base.html
351e927d8727-3
async with session.get( url, headers=self.session.headers, ssl=None if self.session.verify else False, ) as response: return await response.text() except aiohttp.ClientConnectionError as e...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/web_base.html
351e927d8727-4
) except ImportError: warnings.warn("For better logging of progress, `pip install tqdm`") return await asyncio.gather(*tasks) @staticmethod def _check_parser(parser: str) -> None: """Check that parser is valid for bs4.""" valid_parsers = ["html.parser", "lxml", "x...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/web_base.html
351e927d8727-5
if self.raise_for_status: html_doc.raise_for_status() if self.encoding is not None: html_doc.encoding = self.encoding elif self.autoset_encoding: html_doc.encoding = html_doc.apparent_encoding return BeautifulSoup(html_doc.text, parser, **(bs_kwargs or {})) [d...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/web_base.html
c4117390fd0a-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...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/pubmed.html
97df6465ca7f-0
Source code for langchain.document_loaders.slack_directory import json import zipfile from pathlib import Path from typing import Dict, List, Optional from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader [docs]class SlackDirectoryLoader(BaseLoader): """Load from a ...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/slack_directory.html
97df6465ca7f-1
if not channel_name: continue if channel_path.endswith(".json"): messages = self._read_json(zip_file, channel_path) for message in messages: document = self._convert_message_to_document( messa...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/slack_directory.html
97df6465ca7f-2
"timestamp": timestamp, "user": user, } def _get_message_source(self, channel_name: str, user: str, timestamp: str) -> str: """ Get the message source as a string. Args: channel_name (str): The name of the channel the message belongs to. user (str)...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/slack_directory.html
c9b314f1ba38-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...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/arcgis_loader.html
c9b314f1ba38-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 = "*" ...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/arcgis_loader.html
c9b314f1ba38-2
) try: raw_desc = item.description except AttributeError: raw_desc = item.properties.description if self.BEAUTIFULSOUP: item_desc = self.BEAUTIFULSOUP(raw_desc).text else: item_desc = raw_desc ite...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/arcgis_loader.html
6c516d44cd70-0
Source code for langchain.document_loaders.chatgpt import datetime import json from typing import List from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader [docs]def concatenate_rows(message: dict, title: str) -> str: """ Combine message information in a readab...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/chatgpt.html
6c516d44cd70-1
title = d["title"] messages = d["mapping"] text = "".join( [ concatenate_rows(messages[key]["message"], title) for idx, key in enumerate(messages) if not ( idx == 0 and mes...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/chatgpt.html
528a4591f293-0
Source code for langchain.document_loaders.concurrent from __future__ import annotations import concurrent.futures from pathlib import Path from typing import Iterator, Literal, Optional, Sequence, Union from langchain.document_loaders.base import BaseBlobParser from langchain.document_loaders.blob_loaders import BlobL...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/concurrent.html
528a4591f293-1
num_workers: int = 4, ) -> ConcurrentLoader: """ Create a concurrent generic document loader using a filesystem blob loader. Args: path: The path to the directory to load documents from. glob: The glob pattern to use to find documents. suffixes: Th...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/concurrent.html
9d0288389eaf-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...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/markdown.html
9d0288389eaf-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)
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/markdown.html
116fccac3095-0
Source code for langchain.document_loaders.blackboard 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.directory import DirectoryLoader from langchain.docum...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/blackboard.html
116fccac3095-1
The BbRouter cookie is required for most blackboard courses. Args: blackboard_course_url: Blackboard course url. bbrouter: BbRouter cookie. load_all_recursively: If True, load all documents recursively. basic_auth: Basic auth credentials. cookies: Cook...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/blackboard.html
116fccac3095-2
except ImportError: raise ImportError( "BeautifulSoup4 is required for BlackboardLoader. " "Please install it with `pip install beautifulsoup4`." ) [docs] def load(self) -> List[Document]: """Load data into Document objects. Returns: ...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/blackboard.html
116fccac3095-3
.replace("/", "_") .replace(":", "_") .replace(",", "_") .replace("?", "_") .replace("'", "_") .replace("!", "_") .replace('"', "_") ) # Get the folder path folder_path = Path(".") / course_name_clean return str(fold...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/blackboard.html
116fccac3095-4
attachments.append(href) return attachments def _download_attachments(self, attachments: List[str]) -> None: """Download all attachments. Args: attachments: List of attachments. """ # Make sure the folder exists Path(self.folder_path).mkdir(parents=True, e...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/blackboard.html
116fccac3095-5
filename = self.parse_filename(response.url) # Write the file to disk with open(Path(self.folder_path) / filename, "wb") as f: f.write(response.content) [docs] def parse_filename(self, url: str) -> str: """Parse the filename from an url. Args: url: Url to parse...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/blackboard.html
116fccac3095-6
" HERE>_1&content_id=_<YOUR CONTENT ID HERE>_1&mode=reset", "<YOUR BBROUTER COOKIE HERE>", load_all_recursively=True, ) documents = loader.load() print(f"Loaded {len(documents)} pages of PDFs from {loader.web_path}")
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/blackboard.html
9b7b4294e690-0
Source code for langchain.document_loaders.news """Loader that uses unstructured to load HTML files.""" import logging from typing import Any, Iterator, List from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader logger = logging.getLogger(__name__) [docs]class NewsURLLo...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/news.html
9b7b4294e690-1
) -> None: """Initialize with file path.""" try: import newspaper # noqa:F401 self.__version = newspaper.__version__ except ImportError: raise ImportError( "newspaper package not found, please install it with " "`pip install ne...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/news.html
9b7b4294e690-2
continue else: raise e metadata = { "title": getattr(article, "title", ""), "link": getattr(article, "url", getattr(article, "canonical_link", "")), "authors": getattr(article, "authors", []), "language": get...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/news.html
e8ffc58f3b5c-0
Source code for langchain.document_loaders.gcs_file import os import tempfile from typing import Callable, List, Optional from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader from langchain.document_loaders.unstructured import UnstructuredFileLoader from langchain.util...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/gcs_file.html
e8ffc58f3b5c-1
[docs] def load(self) -> List[Document]: """Load documents.""" try: from google.cloud import storage except ImportError: raise ImportError( "Could not import google-cloud-storage python package. " "Please install it with `pip install goo...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/gcs_file.html
e3415009b790-0
Source code for langchain.document_loaders.imsdb from typing import List from langchain.docstore.document import Document from langchain.document_loaders.web_base import WebBaseLoader [docs]class IMSDbLoader(WebBaseLoader): """Load `IMSDb` webpages.""" [docs] def load(self) -> List[Document]: """Load web...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/imsdb.html
21edf055ea62-0
Source code for langchain.document_loaders.telegram from __future__ import annotations import asyncio import json from pathlib import Path from typing import TYPE_CHECKING, Dict, List, Optional, Union from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader from langchain....
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/telegram.html