id
stringlengths
14
16
text
stringlengths
31
2.41k
source
stringlengths
53
121
a956ae3c2c32-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...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/trello.html
23c877fca843-0
Source code for langchain.document_loaders.blackboard """Loader that 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.docume...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/blackboard.html
23c877fca843-1
): """Initialize with blackboard course url. 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. ...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/blackboard.html
23c877fca843-2
"""Load data into document objects. Returns: List of documents. """ if self.load_all_recursively: soup_info = self.scrape() self.folder_path = self._get_folder_path(soup_info) relative_paths = self._get_paths(soup_info) documents = [] ...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/blackboard.html
23c877fca843-3
# Get the folder path folder_path = Path(".") / course_name_clean return str(folder_path) def _get_documents(self, soup: Any) -> List[Document]: """Fetch content from page and return Documents. Args: soup: BeautifulSoup4 soup object. Returns: List of d...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/blackboard.html
23c877fca843-4
Path(self.folder_path).mkdir(parents=True, exist_ok=True) # Download all attachments for attachment in attachments: self.download(attachment) def _load_documents(self) -> List[Document]: """Load all documents in the folder. Returns: List of documents. ...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/blackboard.html
23c877fca843-5
"""Parse the filename from a url. Args: url: Url to parse the filename from. Returns: The filename. """ if (url_path := Path(url)) and url_path.suffix == ".pdf": return url_path.name else: return self._parse_filename_from_url(url) ...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/blackboard.html
c4cf076174ff-0
Source code for langchain.document_loaders.tencent_cos_file """Loading logic for loading documents from Tencent Cloud COS file.""" import os import tempfile from typing import Any, Iterator, List from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader from langchain.docum...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/tencent_cos_file.html
c4cf076174ff-1
) loader = UnstructuredFileLoader(file_path) # UnstructuredFileLoader not implement lazy_load yet return iter(loader.load())
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/tencent_cos_file.html
1b3cba983cbf-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/stable/_modules/langchain/document_loaders/diffbot.html
1b3cba983cbf-1
text = data["objects"][0]["text"] if "objects" in data else "" metadata = {"source": url} docs.append(Document(page_content=text, metadata=metadata)) except Exception as e: if self.continue_on_failure: logger.error(f"Error fetching or proce...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/diffbot.html
ebb2969f6aeb-0
Source code for langchain.document_loaders.notiondb """Notion DB loader for langchain""" 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 = NOTIO...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/notiondb.html
ebb2969f6aeb-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[...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/notiondb.html
ebb2969f6aeb-2
if prop_data["multi_select"] else [] ) elif prop_type == "url": value = prop_data["url"] else: value = None metadata[prop_name.lower()] = value metadata["id"] = page_id return Document(page_content=se...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/notiondb.html
ebb2969f6aeb-3
method, url, headers=self.headers, json=query_dict, timeout=self.request_timeout_sec, ) res.raise_for_status() return res.json()
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/notiondb.html
3277bff3e595-0
Source code for langchain.document_loaders.onedrive """Loader that 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, Ba...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/onedrive.html
3277bff3e595-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/stable/_modules/langchain/document_loaders/onedrive.html
3277bff3e595-2
) account = Account( credentials=( self.settings.client_id, self.settings.client_secret.get_secret_value(), ), scopes=SCOPES, token_backend=token_backend, **{"raise_http_errors": False}, ...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/onedrive.html
3277bff3e595-3
folder (Type[Folder]): The folder object to load the documents from. Returns: List[Document]: A list of Document objects representing the loaded documents. """ docs = [] file_types = _SupportedFileTypes(file_types=["doc", "docx", "pdf"]) file_mime_types = ...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/onedrive.html
3277bff3e595-4
logging.warning( "There isn't a file with " f"object_id {object_id} in drive {drive}." ) continue if file.is_file: if file.mime_type in list(file_mime_types.values()): load...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/onedrive.html
eb3d3157a888-0
Source code for langchain.document_loaders.arxiv from typing import 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): """Loads a query result from arxiv.org...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/arxiv.html
d0a5f55e6fcd-0
Source code for langchain.document_loaders.apify_dataset """Logic for loading documents from Apify datasets.""" from typing import Any, Callable, Dict, List from pydantic import BaseModel, root_validator from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader [docs]class ...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/apify_dataset.html
d0a5f55e6fcd-1
) return values [docs] def load(self) -> List[Document]: """Load documents.""" dataset_items = ( self.apify_client.dataset(self.dataset_id).list_items(clean=True).items ) return list(map(self.dataset_mapping_function, dataset_items))
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/apify_dataset.html
09c78b37945c-0
Source code for langchain.document_loaders.airtable from typing import Iterator, List from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader [docs]class AirtableLoader(BaseLoader): """Loader for Airtable tables.""" def __init__(self, api_token: str, table_id: str...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/airtable.html
27758948a7ed-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 pydantic import BaseModel, root_validator, validator from langchain.docstore.document import Document from langchain.document_loaders...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/github.html
27758948a7ed-1
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 user.""" creator: Optional[str] = None """Filter on the user that created t...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/github.html
27758948a7ed-2
[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 - creator ...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/github.html
27758948a7ed-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[...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/github.html
27758948a7ed-4
return query_params @property def url(self) -> str: return f"https://api.github.com/repos/{self.repo}/issues?{self.query_params}"
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/github.html
225539bd6353-0
Source code for langchain.document_loaders.chatgpt """Load conversations from ChatGPT data export""" import datetime import json from typing import List from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader def concatenate_rows(message: dict, title: str) -> str: """...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/chatgpt.html
225539bd6353-1
if not ( idx == 0 and messages[key]["message"]["author"]["role"] == "system" ) ] ) metadata = {"source": str(self.log_file)} documents.append(Document(page_content=text, metadata=metadata)) re...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/chatgpt.html
6dcb746633a4-0
Source code for langchain.document_loaders.xml """Loader that 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 ...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/xml.html
32e831e9ac79-0
Source code for langchain.document_loaders.dataframe """Load from 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 DataFrames.""" def __init__...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/dataframe.html
9e73addae985-0
Source code for langchain.document_loaders.confluence """Load Data from a Confluence Space""" import logging from enum import Enum from io import BytesIO from typing import Any, Callable, Dict, List, Optional, Union from tenacity import ( before_sleep_log, retry, stop_after_attempt, wait_exponential, ) ...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/confluence.html
9e73addae985-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...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/confluence.html
9e73addae985-2
:type min_retry_seconds: Optional[int], optional :param max_retry_seconds: defaults to 10 :type max_retry_seconds: Optional[int], optional :param confluence_kwargs: additional kwargs to initialize confluence with :type confluence_kwargs: dict, optional :raises ValueError: Errors while validating in...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/confluence.html
9e73addae985-3
url=url, oauth2=oauth2, cloud=cloud, **confluence_kwargs ) elif token: self.confluence = Confluence( url=url, token=token, cloud=cloud, **confluence_kwargs ) else: self.confluence = Confluence( url=url, usern...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/confluence.html
9e73addae985-4
"keys to the oauth2 dictionary. key values should be " "`['access_token', 'access_token_secret', 'consumer_key', 'key_cert']`" ) if token and (api_key or username or oauth2): errors.append( "Cannot provide a value for `token` and a value for `api_key`, " ...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/confluence.html
9e73addae985-5
:type include_restricted_content: bool, optional :param include_archived_content: Whether to include archived content, defaults to False :type include_archived_content: bool, optional :param include_attachments: defaults to False :type include_att...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/confluence.html
9e73addae985-6
expand=content_format.value, ) docs += self.process_pages( pages, include_restricted_content, include_attachments, include_comments, content_format, ocr_languages, ) if label: ...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/confluence.html
9e73addae985-7
)(self.confluence.get_page_by_id) page = get_page(page_id=page_id, expand=content_format.value) if not include_restricted_content and not self.is_public_page(page): continue doc = self.process_page( page, include...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/confluence.html
9e73addae985-8
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/pagination-in-the-rest-api/ :param retrieval_method: Function us...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/confluence.html
9e73addae985-9
pages: List[dict], include_restricted_content: bool, include_attachments: bool, include_comments: bool, content_format: ContentFormat, ocr_languages: Optional[str] = None, ) -> List[Document]: """Process a list of pages into a list of documents.""" docs = [] ...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/confluence.html
9e73addae985-10
BeautifulSoup(comment["body"]["view"]["value"], "lxml").get_text( " ", strip=True ) for comment in comments ] text = text + "".join(comment_texts) return Document( page_content=text, metadata={ "t...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/confluence.html
9e73addae985-11
".wordprocessingml.document" ): text = title + self.process_doc(absolute_url) elif media_type == "application/vnd.ms-excel": text = title + self.process_xls(absolute_url) elif media_type == "image/svg+xml": text = title + self.process_s...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/confluence.html
9e73addae985-12
try: import pytesseract # noqa: F401 from PIL import Image # noqa: F401 except ImportError: raise ImportError( "`pytesseract` or `Pillow` package not found, " "please run `pip install pytesseract Pillow`" ) response = self...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/confluence.html
9e73addae985-13
text = "" if ( response.status_code != 200 or response.content == b"" or response.content is None ): return text workbook = xlrd.open_workbook(file_contents=response.content) for sheet in workbook.sheets(): text += f"{sheet.name...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/confluence.html
9e73addae985-14
img_data.seek(0) image = Image.open(img_data) return pytesseract.image_to_string(image, lang=ocr_languages)
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/confluence.html
ff8f7ef71aea-0
Source code for langchain.document_loaders.markdown """Loader that loads Markdown files.""" from typing import List from langchain.document_loaders.unstructured import UnstructuredFileLoader [docs]class UnstructuredMarkdownLoader(UnstructuredFileLoader): """Loader that uses unstructured to load markdown files.""" ...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/markdown.html
ec9535e74a8a-0
Source code for langchain.document_loaders.url """Loader that uses unstructured to load HTML files.""" import logging from typing import Any, List from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader logger = logging.getLogger(__name__) [docs]class UnstructuredURLLoade...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/url.html
ec9535e74a8a-1
self.unstructured_kwargs = unstructured_kwargs self.show_progress_bar = show_progress_bar def _validate_mode(self, mode: str) -> None: _valid_modes = {"single", "elements"} if mode not in _valid_modes: raise ValueError( f"Got {mode} for `mode`, but should be one o...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/url.html
ec9535e74a8a-2
"Please install with 'pip install tqdm' or set " "show_progress_bar=False." ) from e urls = tqdm(self.urls) else: urls = self.urls for url in urls: try: if self.__is_non_html_available(): if self....
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/url.html
8269b7e43f80-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): """Loader that loads bilibili trans...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/bilibili.html
8269b7e43f80-1
video_info = sync(v.get_info()) video_info.update({"url": url}) # Get subtitle url subtitle = video_info.pop("subtitle") sub_list = subtitle["list"] if sub_list: sub_url = sub_list[0]["subtitle_url"] result = requests.get(sub_url) raw_sub_title...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/bilibili.html
cc2c32a21932-0
Source code for langchain.document_loaders.hugging_face_dataset """Loader that loads HuggingFace datasets.""" 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...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/hugging_face_dataset.html
cc2c32a21932-1
self.page_content_column = page_content_column self.name = name self.data_dir = data_dir self.data_files = data_files self.cache_dir = cache_dir self.keep_in_memory = keep_in_memory self.save_infos = save_infos self.use_auth_token = use_auth_token self.num...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/hugging_face_dataset.html
540b9497356d-0
Source code for langchain.document_loaders.roam """Loader that loads Roam directory dump.""" from pathlib import Path from typing import List from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader [docs]class RoamLoader(BaseLoader): """Loader that loads Roam files fr...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/roam.html
d86681e165ba-0
Source code for langchain.document_loaders.spreedly """Loader that fetches data from Spreedly API.""" 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_ENDP...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/spreedly.html
d86681e165ba-1
text = stringify_dict(json_data) metadata = {"source": url} return [Document(page_content=text, metadata=metadata)] def _get_resource(self) -> List[Document]: endpoint = SPREEDLY_ENDPOINTS.get(self.resource) if endpoint is None: return [] return self._make...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/spreedly.html
ea67133ad100-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/stable/_modules/langchain/document_loaders/web_base.html
ea67133ad100-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""" def __init__( self, web_path: Union[str, Li...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/web_base.html
ea67133ad100-2
if proxies: self.session.proxies.update(proxies) @property def web_path(self) -> str: if len(self.web_paths) > 1: raise ValueError("Multiple webpaths found.") return self.web_paths[0] async def _fetch( self, url: str, retries: int = 3, cooldown: int = 2, backo...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/web_base.html
ea67133ad100-3
tasks = [] for url in urls: task = asyncio.ensure_future(self._fetch_with_rate_limit(url, semaphore)) tasks.append(task) try: from tqdm.asyncio import tqdm_asyncio return await tqdm_asyncio.gather( *tasks, desc="Fetching pages", ascii=True,...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/web_base.html
ea67133ad100-4
if parser is None: if url.endswith(".xml"): parser = "xml" else: parser = self.default_parser self._check_parser(parser) html_doc = self.session.get(url, verify=self.verify, **self.requests_kwargs) if self.raise_for_status: html...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/web_base.html
d58f3de37bd7-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.""" def __init__(self, file_path: str...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/conllu.html
f32028cd0d58-0
Source code for langchain.document_loaders.acreom """Loader that loads acreom vault from a directory.""" 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): ...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/acreom.html
f32028cd0d58-1
# do not contribute to the context of current document content = re.sub("\s*-\s\[\s\]\s.*|\s*\[\s\]\s.*", "", content) # rm tasks content = re.sub("#", "", content) # rm hashtags content = re.sub("\[\[.*?\]\]", "", content) # rm doclinks return content [docs] def lazy_load(self) ->...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/acreom.html
8f604b035db2-0
Source code for langchain.document_loaders.azlyrics """Loader that loads AZLyrics.""" from typing import List from langchain.docstore.document import Document from langchain.document_loaders.web_base import WebBaseLoader [docs]class AZLyricsLoader(WebBaseLoader): """Loader that loads AZLyrics webpages.""" [docs] ...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/azlyrics.html
273bef8e013b-0
Source code for langchain.document_loaders.airbyte_json """Loader that loads local airbyte json files.""" import json from typing import List from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader from langchain.utils import stringify_dict [docs]class AirbyteJSONLoader(B...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/airbyte_json.html
4864eb42e99f-0
Source code for langchain.document_loaders.image """Loader that loads image files.""" from typing import List from langchain.document_loaders.unstructured import UnstructuredFileLoader [docs]class UnstructuredImageLoader(UnstructuredFileLoader): """Loader that uses unstructured to load image files, such as PNGs and...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/image.html
ebe87a6aa180-0
Source code for langchain.document_loaders.readthedocs """Loader that 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 ReadT...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/readthedocs.html
ebe87a6aa180-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/stable/_modules/langchain/document_loaders/readthedocs.html
ebe87a6aa180-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/stable/_modules/langchain/document_loaders/readthedocs.html
2c7d9b0230a9-0
Source code for langchain.document_loaders.weather """Simple reader that reads weather data from OpenWeatherMap API""" from __future__ import annotations from datetime import datetime from typing import Iterator, List, Optional, Sequence from langchain.docstore.document import Document from langchain.document_loaders.b...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/weather.html
b2d5d70c8574-0
Source code for langchain.document_loaders.html """Loader that uses unstructured to load HTML files.""" from typing import List from langchain.document_loaders.unstructured import UnstructuredFileLoader [docs]class UnstructuredHTMLLoader(UnstructuredFileLoader): """Loader that uses unstructured to load HTML files."...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/html.html
066e0ca83e1f-0
Source code for langchain.document_loaders.srt """Loader for .srt (subtitle) files.""" from typing import List from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader [docs]class SRTLoader(BaseLoader): """Loader for .srt (subtitle) files.""" def __init__(self, fil...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/srt.html
189b839ab994-0
Source code for langchain.document_loaders.onedrive_file from __future__ import annotations import tempfile from typing import TYPE_CHECKING, List from pydantic import BaseModel, Field from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader from langchain.document_loaders...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/onedrive_file.html
83bd6e52afb4-0
Source code for langchain.document_loaders.s3_directory """Loading logic for loading documents from an s3 directory.""" from typing import List from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader from langchain.document_loaders.s3_file import S3FileLoader [docs]class ...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/s3_directory.html
a37b874c974b-0
Source code for langchain.document_loaders.mhtml """Loader to load MHTML files, enriching metadata with page title.""" import email import logging from typing import Dict, List, Union from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader logger = logging.getLogger(__nam...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/mhtml.html
a37b874c974b-1
for part in parts: if part.get_content_type() == "text/html": html = part.get_payload(decode=True).decode() soup = BeautifulSoup(html, **self.bs_kwargs) text = soup.get_text(self.get_text_separator) if soup.title: ...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/mhtml.html
b0f343f045af-0
Source code for langchain.document_loaders.gcs_file """Loading logic for loading documents from a GCS 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 Uns...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/gcs_file.html
ed7445465f5a-0
Source code for langchain.document_loaders.toml import json from pathlib import Path from typing import Iterator, List, Union from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader [docs]class TomlLoader(BaseLoader): """ A TOML document loader that inherits from ...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/toml.html
b5cfa438f159-0
Source code for langchain.document_loaders.psychic """Loader that loads documents from Psychic.dev.""" from typing import List, Optional from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader [docs]class PsychicLoader(BaseLoader): """Loader that loads documents from ...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/psychic.html
ce173df95baf-0
Source code for langchain.document_loaders.iugu """Loader that fetches data from 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 IU...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/iugu.html
ce173df95baf-1
[docs] def load(self) -> List[Document]: return self._get_resource()
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/iugu.html
d988c2fb00fd-0
Source code for langchain.document_loaders.blob_loaders.youtube_audio from typing import Iterable, List from langchain.document_loaders.blob_loaders import FileSystemBlobLoader from langchain.document_loaders.blob_loaders.schema import Blob, BlobLoader [docs]class YoutubeAudioLoader(BlobLoader): """Load YouTube url...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/blob_loaders/youtube_audio.html
85670de318d1-0
Source code for langchain.document_loaders.blob_loaders.file_system """Use to load blobs from the local file system.""" from pathlib import Path from typing import Callable, Iterable, Iterator, Optional, Sequence, TypeVar, Union from langchain.document_loaders.blob_loaders.schema import Blob, BlobLoader T = TypeVar("T"...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/blob_loaders/file_system.html
85670de318d1-1
*, glob: str = "**/[!.]*", suffixes: Optional[Sequence[str]] = None, show_progress: bool = False, ) -> None: """Initialize with path to directory and how to glob over it. Args: path: Path to directory to load from glob: Glob pattern relative to the spe...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/blob_loaders/file_system.html
85670de318d1-2
self, ) -> Iterable[Blob]: """Yield blobs that match the requested pattern.""" iterator = _make_iterator( length_func=self.count_matching_files, show_progress=self.show_progress ) for path in iterator(self._yield_paths()): yield Blob.from_path(path) def _y...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/blob_loaders/file_system.html
df139babe704-0
Source code for langchain.document_loaders.blob_loaders.schema """Schema for Blobs and Blob Loaders. The goal is to facilitate decoupling of content loading from content parsing code. In addition, content loading code should provide a lazy loading interface by default. """ from __future__ import annotations import cont...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/blob_loaders/schema.html
df139babe704-1
return str(self.path) if self.path else None @root_validator(pre=True) def check_blob_is_valid(cls, values: Mapping[str, Any]) -> Mapping[str, Any]: """Verify that either data or path is provided.""" if "data" not in values and "path" not in values: raise ValueError("Either data or p...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/blob_loaders/schema.html
df139babe704-2
yield f else: raise NotImplementedError(f"Unable to convert blob {self}") [docs] @classmethod def from_path( cls, path: PathLike, *, encoding: str = "utf-8", mime_type: Optional[str] = None, guess_type: bool = True, ) -> Blob: """Loa...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/blob_loaders/schema.html
df139babe704-3
mime_type: if provided, will be set as the mime-type of the data path: if provided, will be set as the source from which the data came Returns: Blob instance """ return cls(data=data, mimetype=mime_type, encoding=encoding, path=path) def __repr__(self) -> str: ...
https://api.python.langchain.com/en/stable/_modules/langchain/document_loaders/blob_loaders/schema.html
bb02300c7fac-0
Source code for langchain.embeddings.llamacpp """Wrapper around llama.cpp embedding models.""" from typing import Any, Dict, List, Optional from pydantic import BaseModel, Extra, Field, root_validator from langchain.embeddings.base import Embeddings [docs]class LlamaCppEmbeddings(BaseModel, Embeddings): """Wrapper ...
https://api.python.langchain.com/en/stable/_modules/langchain/embeddings/llamacpp.html
bb02300c7fac-1
use_mlock: bool = Field(False, alias="use_mlock") """Force system to keep model in RAM.""" n_threads: Optional[int] = Field(None, alias="n_threads") """Number of threads to use. If None, the number of threads is automatically determined.""" n_batch: Optional[int] = Field(8, alias="n_batch") """...
https://api.python.langchain.com/en/stable/_modules/langchain/embeddings/llamacpp.html
bb02300c7fac-2
raise ModuleNotFoundError( "Could not import llama-cpp-python library. " "Please install the llama-cpp-python library to " "use this embedding model: pip install llama-cpp-python" ) except Exception as e: raise ValueError( f...
https://api.python.langchain.com/en/stable/_modules/langchain/embeddings/llamacpp.html
725ad95173bc-0
Source code for langchain.embeddings.aleph_alpha from typing import Any, Dict, List, Optional from pydantic import BaseModel, root_validator from langchain.embeddings.base import Embeddings from langchain.utils import get_from_dict_or_env [docs]class AlephAlphaAsymmetricSemanticEmbedding(BaseModel, Embeddings): """...
https://api.python.langchain.com/en/stable/_modules/langchain/embeddings/aleph_alpha.html
725ad95173bc-1
"""Attention control parameters only apply to those tokens that have explicitly been set in the request.""" control_log_additive: Optional[bool] = True """Apply controls on prompt items by adding the log(control_factor) to attention scores.""" aleph_alpha_api_key: Optional[str] = None """API k...
https://api.python.langchain.com/en/stable/_modules/langchain/embeddings/aleph_alpha.html
725ad95173bc-2
document_params = { "prompt": Prompt.from_text(text), "representation": SemanticRepresentation.Document, "compress_to_size": self.compress_to_size, "normalize": self.normalize, "contextual_control_threshold": self.contextual_control_thresho...
https://api.python.langchain.com/en/stable/_modules/langchain/embeddings/aleph_alpha.html
725ad95173bc-3
request=symmetric_request, model=self.model ) return symmetric_response.embedding [docs]class AlephAlphaSymmetricSemanticEmbedding(AlephAlphaAsymmetricSemanticEmbedding): """The symmetric version of the Aleph Alpha's semantic embeddings. The main difference is that here, both the documents and ...
https://api.python.langchain.com/en/stable/_modules/langchain/embeddings/aleph_alpha.html