id
stringlengths
14
16
text
stringlengths
13
2.7k
source
stringlengths
57
178
455b0ef44b45-2
type_mapping = { "document": "application/vnd.google-apps.document", "sheet": "application/vnd.google-apps.spreadsheet", "pdf": "application/pdf", } allowed_types = list(type_mapping.keys()) + list(type_mapping.values()) short_names = "...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/googledrive.html
455b0ef44b45-3
from google_auth_oauthlib.flow import InstalledAppFlow except ImportError: raise ImportError( "You must run " "`pip install --upgrade " "google-api-python-client google-auth-httplib2 " "google-auth-oauthlib` " "to use th...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/googledrive.html
455b0ef44b45-4
sheets = spreadsheet.get("sheets", []) documents = [] for sheet in sheets: sheet_name = sheet["properties"]["title"] result = ( sheets_service.spreadsheets() .values() .get(spreadsheetId=id, range=sheet_name) .execut...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/googledrive.html
455b0ef44b45-5
.execute() ) request = service.files().export_media(fileId=id, mimeType="text/plain") fh = BytesIO() downloader = MediaIoBaseDownload(fh, request) done = False try: while done is False: status, done = downloader.next_chunk() except Http...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/googledrive.html
455b0ef44b45-6
continue elif file["mimeType"] == "application/vnd.google-apps.document": returns.append(self._load_document_from_id(file["id"])) # type: ignore elif file["mimeType"] == "application/vnd.google-apps.spreadsheet": returns.extend(self._load_sheet_from_id(file["id"]...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/googledrive.html
455b0ef44b45-7
if not self.document_ids: raise ValueError("document_ids must be set") return [self._load_document_from_id(doc_id) for doc_id in self.document_ids] def _load_file_from_id(self, id: str) -> List[Document]: """Load a file from an ID.""" from io import BytesIO from googleapi...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/googledrive.html
455b0ef44b45-8
] def _load_file_from_ids(self) -> List[Document]: """Load files from a list of IDs.""" if not self.file_ids: raise ValueError("file_ids must be set") docs = [] for file_id in self.file_ids: docs.extend(self._load_file_from_id(file_id)) return docs [do...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/googledrive.html
0086821ef45d-0
Source code for langchain.document_loaders.github from abc import ABC from datetime import datetime from typing import Dict, Iterator, List, Literal, Optional, Union import requests from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader from langchain.pydantic_v1 import ...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/github.html
0086821ef45d-1
If the string 'none' is passed, issues without milestones are returned. """ state: Optional[Literal["open", "closed", "all"]] = None """Filter on issue state. Can be one of: 'open', 'closed', 'all'.""" assignee: Optional[str] = None """Filter on assigned user. Pass 'none' for no user and '*' for any...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/github.html
0086821ef45d-2
) return v [docs] def lazy_load(self) -> Iterator[Document]: """ Get issues of a GitHub repository. Returns: A list of Documents with attributes: - page_content - metadata - url - title ...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/github.html
0086821ef45d-3
"""Create Document objects from a list of GitHub issues.""" metadata = { "url": issue["html_url"], "title": issue["title"], "creator": issue["user"]["login"], "created_at": issue["created_at"], "comments": issue["comments"], "state": issue[...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/github.html
0086821ef45d-4
return query_params @property def url(self) -> str: """Create URL for GitHub API.""" return f"{self.github_api_url}/repos/{self.repo}/issues?{self.query_params}"
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/github.html
ff9ca25d2613-0
Source code for langchain.document_loaders.assemblyai from __future__ import annotations from enum import Enum from typing import TYPE_CHECKING, List, Optional from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader if TYPE_CHECKING: import assemblyai [docs]class Tran...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/assemblyai.html
ff9ca25d2613-1
config: Optional[assemblyai.TranscriptionConfig] = None, api_key: Optional[str] = None, ): """ Initializes the AssemblyAI AudioTranscriptLoader. Args: file_path: An URL or a local file path. transcript_format: Transcript format to use. See clas...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/assemblyai.html
ff9ca25d2613-2
sentences = transcript.get_sentences() return [ Document(page_content=s.text, metadata=s.dict(exclude={"text"})) for s in sentences ] elif self.transcript_format == TranscriptFormat.PARAGRAPHS: paragraphs = transcript.get_paragraphs() ...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/assemblyai.html
6b27bf551f8b-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...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/base.html
6b27bf551f8b-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): ...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/base.html
cdccc543a28e-0
Source code for langchain.document_loaders.hugging_face_dataset from typing import Iterator, List, Mapping, Optional, Sequence, Union from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader [docs]class HuggingFaceDatasetLoader(BaseLoader): """Load from `Hugging Face H...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/hugging_face_dataset.html
cdccc543a28e-1
save_infos: Save the dataset information (checksums/size/splits/...). Default is False. use_auth_token: Bearer token for remote files on the Dataset Hub. num_proc: Number of processes. """ self.path = path self.page_content_column = page_content_column ...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/hugging_face_dataset.html
85eaef417236-0
Source code for langchain.document_loaders.image from typing import List from langchain.document_loaders.unstructured import UnstructuredFileLoader [docs]class UnstructuredImageLoader(UnstructuredFileLoader): """Load `PNG` and `JPG` files using `Unstructured`. You can run the loader in one of two modes: "single...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/image.html
89de310c4832-0
Source code for langchain.document_loaders.unstructured """Loader that uses unstructured to load files.""" import collections from abc import ABC, abstractmethod from typing import IO, Any, Callable, Dict, List, Optional, Sequence, Union from langchain.docstore.document import Document from langchain.document_loaders.b...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/unstructured.html
89de310c4832-1
**unstructured_kwargs: Any, ): """Initialize with file path.""" try: import unstructured # noqa:F401 except ImportError: raise ValueError( "unstructured package not found, please install it with " "`pip install unstructured`" ...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/unstructured.html
89de310c4832-2
for element in elements: metadata = self._get_metadata() # NOTE(MthwRobinson) - the attribute check is for backward compatibility # with unstructured<0.4.9. The metadata attributed was added in 0.4.9. if hasattr(element, "metadata"): me...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/unstructured.html
89de310c4832-3
docs = [Document(page_content=text, metadata=metadata)] else: raise ValueError(f"mode of {self.mode} not supported.") return docs [docs]class UnstructuredFileLoader(UnstructuredBaseLoader): """Load files using `Unstructured`. The file loader uses the unstructured partition functi...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/unstructured.html
89de310c4832-4
return {"source": self.file_path} [docs]def get_elements_from_api( file_path: Union[str, List[str], None] = None, file: Union[IO, Sequence[IO], None] = None, api_url: str = "https://api.unstructured.io/general/v0/general", api_key: str = "", **unstructured_kwargs: Any, ) -> List: """Retrieve a l...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/unstructured.html
89de310c4832-5
https://www.unstructured.io/api-key/ if you need to generate a key. You can run the loader in one of two modes: "single" and "elements". If you use "single" mode, the document will be returned as a single langchain Document object. If you use "elements" mode, the unstructured library will split the docu...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/unstructured.html
89de310c4832-6
def _get_elements(self) -> List: return get_elements_from_api( file_path=self.file_path, api_key=self.api_key, api_url=self.url, **self.unstructured_kwargs, ) [docs]class UnstructuredFileIOLoader(UnstructuredBaseLoader): """Load files using `Unstructur...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/unstructured.html
89de310c4832-7
return partition(file=self.file, **self.unstructured_kwargs) def _get_metadata(self) -> dict: return {} [docs]class UnstructuredAPIFileIOLoader(UnstructuredFileIOLoader): """Load files using `Unstructured` API. By default, the loader makes a call to the hosted Unstructured API. If you are runnin...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/unstructured.html
89de310c4832-8
mode: str = "single", url: str = "https://api.unstructured.io/general/v0/general", api_key: str = "", **unstructured_kwargs: Any, ): """Initialize with file path.""" if isinstance(file, collections.abc.Sequence): validate_unstructured_version(min_unstructured_vers...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/unstructured.html
ef452e6266a6-0
Source code for langchain.document_loaders.bigquery from __future__ import annotations from typing import TYPE_CHECKING, List, Optional from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader from langchain.utilities.vertexai import get_client_info if TYPE_CHECKING: f...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/bigquery.html
ef452e6266a6-1
""" self.query = query self.project = project self.page_content_columns = page_content_columns self.metadata_columns = metadata_columns self.credentials = credentials [docs] def load(self) -> List[Document]: try: from google.cloud import bigquery ex...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/bigquery.html
487285237498-0
Source code for langchain.document_loaders.csv_loader import csv from io import TextIOWrapper from typing import Any, Dict, List, Optional, Sequence from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader from langchain.document_loaders.helpers import detect_file_encoding...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/csv_loader.html
487285237498-1
source_column: The name of the column in the CSV file to use as the source. Optional. Defaults to None. metadata_columns: A sequence of column names to use as metadata. Optional. csv_args: A dictionary of arguments to pass to the csv.DictReader. Optional. Defaults to ...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/csv_loader.html
487285237498-2
docs = [] csv_reader = csv.DictReader(csvfile, **self.csv_args) # type: ignore for i, row in enumerate(csv_reader): try: source = ( row[self.source_column] if self.source_column is not None else self.file_path ...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/csv_loader.html
487285237498-3
loader = UnstructuredCSVLoader("stanley-cups.csv", mode="elements") docs = loader.load() """ [docs] def __init__( self, file_path: str, mode: str = "single", **unstructured_kwargs: Any ): """ Args: file_path: The path to the CSV file. mode: The mode to use ...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/csv_loader.html
3742c416aa05-0
Source code for langchain.document_loaders.azure_blob_storage_file import os import tempfile from typing import List from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader from langchain.document_loaders.unstructured import UnstructuredFileLoader [docs]class AzureBlobSto...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/azure_blob_storage_file.html
d29522d9d129-0
Source code for langchain.document_loaders.facebook_chat import datetime import json 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(row: dict) -> str: """Combine message information i...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/facebook_chat.html
cab7f6bb711f-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...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/url_playwright.html
cab7f6bb711f-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...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/url_playwright.html
cab7f6bb711f-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...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/url_playwright.html
cab7f6bb711f-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: ...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/url_playwright.html
cab7f6bb711f-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: ...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/url_playwright.html
a3ca78310b64-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...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/datadog_logs.html
a3ca78310b64-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...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/datadog_logs.html
a3ca78310b64-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...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/datadog_logs.html
91465de86299-0
Source code for langchain.document_loaders.iugu import json import urllib.request 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_dict IUGU_ENDPOINTS = { "invoices": "https:/...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/iugu.html
91465de86299-1
endpoint = IUGU_ENDPOINTS.get(self.resource) if endpoint is None: return [] return self._make_request(endpoint) [docs] def load(self) -> List[Document]: return self._get_resource()
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/iugu.html
fae139dea570-0
Source code for langchain.document_loaders.mongodb import asyncio import logging from typing import Dict, List, Optional from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader logger = logging.getLogger(__name__) [docs]class MongodbLoader(BaseLoader): """Load MongoDB...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/mongodb.html
fae139dea570-1
""" return asyncio.run(self.aload()) [docs] async def aload(self) -> List[Document]: """Load data into Document objects.""" result = [] total_docs = await self.collection.count_documents(self.filter_criteria) async for doc in self.collection.find(self.filter_criteria): ...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/mongodb.html
bc3330ab035e-0
Source code for langchain.document_loaders.obsidian import logging import re from pathlib import Path from typing import List import yaml from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader logger = logging.getLogger(__name__) [docs]class ObsidianLoader(BaseLoader): ...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/obsidian.html
bc3330ab035e-1
match = self.FRONT_MATTER_REGEX.search(content) if not match: return {} try: front_matter = yaml.safe_load(match.group(1)) # If tags are a string, split them into a list if "tags" in front_matter and isinstance(front_matter["tags"], str): f...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/obsidian.html
bc3330ab035e-2
for match in self.DATAVIEW_INLINE_PAREN_REGEX.findall(content) }, **{ match[0]: match[1] for match in self.DATAVIEW_INLINE_BRACKET_REGEX.findall(content) }, } def _remove_front_matter(self, content: str) -> str: """Remove front matt...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/obsidian.html
7f601a5fb302-0
Source code for langchain.document_loaders.confluence import logging from enum import Enum from io import BytesIO from typing import Any, Callable, Dict, List, Optional, Union import requests from tenacity import ( before_sleep_log, retry, stop_after_attempt, wait_exponential, ) from langchain.docstore....
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/confluence.html
7f601a5fb302-1
Confluence API supports difference format of page content. The storage format is the raw XML representation for storage. The view format is the HTML representation for viewing with macros are rendered as though it is viewed by users. You can pass a enum `content_format` argument to `load()` to specify the c...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/confluence.html
7f601a5fb302-2
:param oauth2: _description_, defaults to {} :type oauth2: dict, optional :param token: _description_, defaults to None :type token: str, optional :param cloud: _description_, defaults to True :type cloud: bool, optional :param number_of_retries: How many times to retry, defaults to 3 :type ...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/confluence.html
7f601a5fb302-3
oauth2=oauth2, token=token, ) if errors: raise ValueError(f"Error(s) while validating input: {errors}") try: from atlassian import Confluence # noqa: F401 except ImportError: raise ImportError( "`atlassian` package not foun...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/confluence.html
7f601a5fb302-4
if url is None: errors.append("Must provide `base_url`") if (api_key and not username) or (username and not api_key): errors.append( "If one of `api_key` or `username` is provided, " "the other must be as well." ) non_null_creds = list(...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/confluence.html
7f601a5fb302-5
include_archived_content: bool = False, include_attachments: bool = False, include_comments: bool = False, content_format: ContentFormat = ContentFormat.STORAGE, limit: Optional[int] = 50, max_pages: Optional[int] = 1000, ocr_languages: Optional[str] = None, keep_...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/confluence.html
7f601a5fb302-6
:type content_format: ContentFormat :param limit: Maximum number of pages to retrieve per request, defaults to 50 :type limit: int, optional :param max_pages: Maximum number of pages to retrieve in total, defaults 1000 :type max_pages: int, optional :param ocr_languages: The lang...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/confluence.html
7f601a5fb302-7
include_comments, content_format, ocr_languages=ocr_languages, keep_markdown_format=keep_markdown_format, keep_newlines=keep_newlines, ) if label: pages = self.paginate_request( self.confluence.get_all_pages_...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/confluence.html
7f601a5fb302-8
)(self.confluence.get_page_by_id) page = get_page( page_id=page_id, expand=f"{content_format.value},version" ) if not include_restricted_content and not self.is_public_page(page): continue doc = self.process_page( ...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/confluence.html
7f601a5fb302-9
of pages with each request. We have to manually check if there are more docs based on the length of the returned list of pages, rather than just checking for the presence of a `next` key in the response like this page would have you do: https://developer.atlassian.com/server/confluence/p...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/confluence.html
7f601a5fb302-10
) [docs] def process_pages( self, pages: List[dict], include_restricted_content: bool, include_attachments: bool, include_comments: bool, content_format: ContentFormat, ocr_languages: Optional[str] = None, keep_markdown_format: Optional[bool] = False, ...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/confluence.html
7f601a5fb302-11
except ImportError: raise ImportError( "`beautifulsoup4` package not found, please run " "`pip install beautifulsoup4`" ) if include_attachments: attachment_texts = self.process_attachment(page["id"], ocr_languages) else...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/confluence.html
7f601a5fb302-12
return Document( page_content=text, metadata=metadata, ) [docs] def process_attachment( self, page_id: str, ocr_languages: Optional[str] = None, ) -> List[str]: try: from PIL import Image # noqa: F401 except ImportError: ...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/confluence.html
7f601a5fb302-13
continue texts.append(text) except requests.HTTPError as e: if e.response.status_code == 404: print(f"Attachment not found at {absolute_url}") continue else: raise return texts [docs] def p...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/confluence.html
7f601a5fb302-14
"`pytesseract` or `Pillow` package not found, " "please run `pip install pytesseract Pillow`" ) response = self.confluence.request(path=link, absolute=True) text = "" if ( response.status_code != 200 or response.content == b"" or re...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/confluence.html
7f601a5fb302-15
response = self.confluence.request(path=link, absolute=True) text = "" if ( response.status_code != 200 or response.content == b"" or response.content is None ): return text filename = os.path.basename(link) # Getting the whole cont...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/confluence.html
7f601a5fb302-16
except ImportError: raise ImportError( "`pytesseract`, `Pillow`, `reportlab` or `svglib` package not found, " "please run `pip install pytesseract Pillow reportlab svglib`" ) response = self.confluence.request(path=link, absolute=True) text = "" ...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/confluence.html
0704a9841c91-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...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/async_html.html
0704a9841c91-1
autoset_encoding: bool = True, encoding: Optional[str] = None, default_parser: str = "html.parser", requests_per_second: int = 2, requests_kwargs: Optional[Dict[str, Any]] = None, raise_for_status: bool = False, ignore_load_errors: bool = False, ): """Initiali...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/async_html.html
0704a9841c91-2
if self.ignore_load_errors: try: return self.session.get(url, **self.requests_kwargs) except Exception as e: warnings.warn(str(e)) return None return self.session.get(url, **self.requests_kwargs) @staticmethod def _check_parser(pars...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/async_html.html
0704a9841c91-3
) -> str: async with aiohttp.ClientSession() as session: for i in range(retries): try: async with session.get( url, headers=self.session.headers, ssl=None if self.session.verify else False, ...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/async_html.html
0704a9841c91-4
*tasks, desc="Fetching pages", ascii=True, mininterval=1 ) except ImportError: warnings.warn("For better logging of progress, `pip install tqdm`") return await asyncio.gather(*tasks) [docs] def lazy_load(self) -> Iterator[Document]: """Lazy load text from the url(s...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/async_html.html
ec4074ce0242-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. ...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/etherscan.html
ec4074ce0242-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": ...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/etherscan.html
ec4074ce0242-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)) ...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/etherscan.html
ec4074ce0242-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...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/etherscan.html
ec4074ce0242-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: ...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/etherscan.html
878498865c8e-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): """Load `BiliBili` video transcript...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/bilibili.html
878498865c8e-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...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/bilibili.html
7b31da648a9f-0
Source code for langchain.document_loaders.docusaurus """Load Documents from Docusarus Documentation""" from typing import Any, List, Optional from langchain.document_loaders.sitemap import SitemapLoader [docs]class DocusaurusLoader(SitemapLoader): """ Loader that leverages the SitemapLoader to loop through the...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/docusaurus.html
7b31da648a9f-1
"""Parses specific elements from a Docusarus page.""" relevant_elements = content.select(",".join(self.custom_html_tags)) for element in relevant_elements: if element not in relevant_elements: element.decompose() return str(content.get_text())
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/docusaurus.html
a665065467c9-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 ...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/json_loader.html
a665065467c9-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`" ) ...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/json_loader.html
a665065467c9-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...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/json_loader.html
a665065467c9-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( ...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/json_loader.html
5f53cd468d6f-0
Source code for langchain.document_loaders.readthedocs from __future__ import annotations from pathlib import Path from typing import TYPE_CHECKING, Any, Iterator, List, Optional, Sequence, Tuple, Union from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader if TYPE_CHECK...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/readthedocs.html
5f53cd468d6f-1
encoding: The encoding with which to open the documents. errors: Specify how encoding and decoding errors are to be handled—this cannot be used in binary mode. custom_html_tag: Optional custom html tag to retrieve the content from files. patterns: The ...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/readthedocs.html
5f53cd468d6f-2
text = self._clean_data(f.read()) yield Document(page_content=text, metadata={"source": str(p)}) [docs] def load(self) -> List[Document]: """Load documents.""" return list(self.lazy_load()) def _clean_data(self, data: str) -> str: from bs4 import BeautifulSoup soup...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/readthedocs.html
5f53cd468d6f-3
"iframe", "frame", "frameset", "noframes", "applet", "form", "button", "select", "base", "style", "img", ] newline_elements = [ "p", "div", "ul", "ol", "li", "h1", "h2", ...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/readthedocs.html
5f53cd468d6f-4
if isinstance(element, Comment) or tag_name in elements_to_skip: return "" elif isinstance(element, NavigableString): return element elif tag_name == "br": return "\n" elif tag_name in newline_elements: return ( "".join( _process_element(child, ele...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/readthedocs.html
01439f0049f3-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...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/chromium.html
01439f0049f3-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...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/chromium.html
1ca51484d448-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...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/notebook.html
1ca51484d448-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...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/notebook.html
1ca51484d448-2
Defaults to False. """ self.file_path = path self.include_outputs = include_outputs self.max_output_length = max_output_length self.remove_newline = remove_newline self.traceback = traceback [docs] def load( self, ) -> List[Document]: """Load docume...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/notebook.html
404818753069-0
Source code for langchain.document_loaders.acreom import re from pathlib import Path from typing import Iterator, List from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader [docs]class AcreomLoader(BaseLoader): """Load `acreom` vault from a directory.""" FRONT_M...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/acreom.html
404818753069-1
if not self.collect_metadata: return content return self.FRONT_MATTER_REGEX.sub("", content) def _process_acreom_content(self, content: str) -> str: # remove acreom specific elements from content that # do not contribute to the context of current document content = re.sub...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/acreom.html
97f84442c522-0
Source code for langchain.document_loaders.git import os from typing import Callable, List, Optional from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader [docs]class GitLoader(BaseLoader): """Load `Git` repository files. The Repository can be local on disk avai...
lang/api.python.langchain.com/en/latest/_modules/langchain/document_loaders/git.html