ConfluenceLoaderWrapper
Python template · sinapsis_langchain_readers.templates.langchain_data_readers
Overview
Dynamic Template to load documents from Langchain document_loaders module The template loads the document either as a Document object in the generic_data field of DataContainer of each string as a TextPacket if add_document_as_text_packet is set as True
ConfluenceLoader — inherited documentation
Load `Confluence` pages.
Port of https://llamahub.ai/l/confluence This currently supports username/api_key, Oauth2 login, personal access token or cookies authentication.
Specify a list page_ids and/or space_key to load in the corresponding pages into Document objects, if both are specified the union of both sets will be returned.
You can also specify a boolean `include_attachments` to include attachments, this is set to False by default, if set to True all attachments will be downloaded and ConfluenceLoader will extract the text from the attachments and add it to the Document object. Currently supported attachment types are: PDF, PNG, JPEG/JPG, SVG, Word and Excel.
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 specify the content format, this is set to `ContentFormat.STORAGE` by default, the supported values are: `ContentFormat.EDITOR`, `ContentFormat.EXPORT_VIEW`, `ContentFormat.ANONYMOUS_EXPORT_VIEW`, `ContentFormat.STORAGE`, and `ContentFormat.VIEW`.
Hint: space_key and page_id can both be found in the URL of a page in Confluence - https://yoursite.atlassian.com/wiki/spaces/<space_key>/pages/<page_id>
Example: .. code-block:: python
from langchain_community.document_loaders import ConfluenceLoader
loader = ConfluenceLoader( url="https://yoursite.atlassian.com/wiki", username="me", api_key="12345", space_key="SPACE", limit=50, ) documents = loader.load()
# Server on perm loader = ConfluenceLoader( url="https://confluence.yoursite.com/", username="me", api_key="your_password", cloud=False, space_key="SPACE", limit=50, ) documents = loader.load()
:param url: _description_ :type url: str :param api_key: _description_, defaults to None :type api_key: str, optional :param username: _description_, defaults to None :type username: str, optional :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 number_of_retries: Optional[int], optional :param min_retry_seconds: defaults to 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 :param cookies: _description_, defaults to {} :type cookies: dict, optional :param space_key: Space key retrieved from a confluence URL, defaults to None :type space_key: Optional[str], optional :param page_ids: List of specific page IDs to load, defaults to None :type page_ids: Optional[List[str]], optional :param label: Get all pages with this label, defaults to None :type label: Optional[str], optional :param cql: CQL Expression, defaults to None :type cql: Optional[str], optional :param include_restricted_content: defaults to False :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_attachments: bool, optional :param attachment_filter_func: A function that takes the attachment information from Confluence and decides whether or not the attachment is processed. :param include_comments: defaults to False :type include_comments: bool, optional :param content_format: Specify content format, defaults to ContentFormat.STORAGE, the supported values are: `ContentFormat.EDITOR`, `ContentFormat.EXPORT_VIEW`, `ContentFormat.ANONYMOUS_EXPORT_VIEW`, `ContentFormat.STORAGE`, and `ContentFormat.VIEW`. :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 languages to use for the Tesseract agent. To use a language, you'll first need to install the appropriate Tesseract language pack. :type ocr_languages: str, optional :param keep_markdown_format: Whether to keep the markdown format, defaults to False :type keep_markdown_format: bool :param keep_newlines: Whether to keep the newlines format, defaults to False :type keep_newlines: bool :raises ValueError: Errors while validating input :raises ImportError: Required dependencies not installed.
Capabilities
Capabilities: not setInstallation
Install the published package using pip or uv.
pip install sinapsis_langchain_readers==1.0.0uv pip install sinapsis_langchain_readers==1.0.0uv add sinapsis_langchain_readers==1.0.0Configuration
Effective fields from the inspector schema, including nested Pydantic model fields.
Optional
Default: null
Required
Default: null
Optional
Default: null
Optional
Default: null
Optional
Default: true
Optional
Default: null
Optional
Default: 50
Optional
Default: null
Optional
Default: null
Optional
Default: null
Optional
Default: null
Optional
Default: null
Optional
Default: null
Optional
Default: null
Optional
Default: 1000
Optional
Default: null
Optional
Default: false
Optional
Default: null
Optional
Default: "body.storage"
Optional
Default: false
Optional
Default: false
Optional
Default: null
Optional
Default: 10
Optional
Default: 2
Optional
Default: 3
Optional
Default: false
Optional
Default: false
Optional
Default: null
Optional
Default: false
Optional
Default: false
Whether to add document as text packet or not. confluenceloader_init url <class 'str'>: default: None api_key typing.Optional[str]: default: None username typing.Optional[str]: default: None session… Read full field description
Whether to add document as text packet or not. confluenceloader_init url <class 'str'>: default: None api_key typing.Optional[str]: default: None username typing.Optional[str]: default: None session typing.Optional[requests.sessions.Session]: default: None oauth2 typing.Optional[dict]: default: None token typing.Optional[str]: default: None cloud typing.Optional[bool]: default: True number_of_retries typing.Optional[int]: default: 3 min_retry_seconds typing.Optional[int]: default: 2 max_retry_seconds typing.Optional[int]: default: 10 confluence_kwargs typing.Optional[dict]: default: None cookies typing.Optional[dict]: default: None space_key typing.Optional[str]: default: None page_ids typing.Optional[typing.List[str]]: default: None label typing.Optional[str]: default: None cql typing.Optional[str]: default: None include_restricted_content <class 'bool'>: default: False include_archived_content <class 'bool'>: default: False include_attachments <class 'bool'>: default: False include_comments <class 'bool'>: default: False include_labels <class 'bool'>: default: False content_format <enum 'ContentFormat'>: default: ContentFormat.STORAGE limit typing.Optional[int]: default: 50 max_pages typing.Optional[int]: default: 1000 ocr_languages typing.Optional[str]: default: None keep_markdown_format <class 'bool'>: default: False keep_newlines <class 'bool'>: default: False attachment_filter_func typing.Optional[typing.Callable[[dict], bool]]: default: None
Optional
Default: false
Configuration example
Generated from documented defaults. Replace any placeholders and complete required nested settings before running.
templates:
- template_name: "ConfluenceLoaderWrapper"
class_name: "ConfluenceLoaderWrapper"
attributes:
confluenceloader_init:
cql: null
url: null
cloud: true
label: null
limit: 50
token: null
oauth2: null
api_key: null
cookies: null
session: null
page_ids: null
username: null
max_pages: 1000
space_key: null
keep_newlines: false
ocr_languages: null
content_format: {}
include_labels: false
include_comments: false
confluence_kwargs: null
max_retry_seconds: 10
min_retry_seconds: 2
number_of_retries: 3
include_attachments: false
keep_markdown_format: false
attachment_filter_func: null
include_archived_content: false
include_restricted_content: false
add_document_as_text_packet: false
View original docstring example
The source example references WikipediaLoaderWrapper, not ConfluenceLoaderWrapper.
agent:
name: my_test_agent
templates:
- template_name: InputTemplate
class_name: InputTemplate
attributes: {}
- template_name: WikipediaLoaderWrapper
class_name: WikipediaLoaderWrapper ## note that because it is a dynamic template,
template_input: InputTemplate ## the class name depends on the actual class that is used.
attributes:
add_document_as_text_packet: false
wikipedialoader_init:
query: the query for wikipedia
lang: en
load_max_docs: 5000
load_all_available_meta: False
doc_content_chars_max: 4000Inheritance
sinapsis_langchain_readers.templates.langchain_data_readers.LangChainDataReaderBaseEnvironment variables
Environment definitions belong to their canonical Python modules.