ConfluenceLoader.Document (confluence_loader v0.1.1)
View SourceDocument struct that represents a Confluence page in a format similar to llama-index documents.
Summary
Functions
Returns a formatted string representation of the document suitable for LLM consumption.
Creates a Document from a map.
Creates a new Document.
Converts the document to a map format suitable for JSON serialization.
Types
Functions
Returns a formatted string representation of the document suitable for LLM consumption.
Examples
iex> doc = ConfluenceLoader.Document.new("123", "Content here", %{title: "My Page", space_id: "SPACE1"})
iex> ConfluenceLoader.Document.format_for_llm(doc)
Creates a Document from a map.
Examples
iex> ConfluenceLoader.Document.from_map(%{id: "123", text: "Content", metadata: %{title: "Page"}})
{:ok, %ConfluenceLoader.Document{id: "123", text: "Content", metadata: %{title: "Page"}}}
Creates a new Document.
Parameters
- id: The unique identifier of the document
- text: The text content of the document
- metadata: Optional metadata map
Examples
iex> doc = ConfluenceLoader.Document.new("123", "This is the content", %{title: "My Page"})
%ConfluenceLoader.Document{id: "123", text: "This is the content", metadata: %{title: "My Page"}}
Converts the document to a map format suitable for JSON serialization.
Examples
iex> doc = ConfluenceLoader.Document.new("123", "Content", %{title: "Page"})
iex> ConfluenceLoader.Document.to_map(doc)
%{id: "123", text: "Content", metadata: %{title: "Page"}}