Skip to content

API Reference parrot_tools.document

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot_tools.document

View source

AbstractDocumentTool - Base class for document generation tools.

This extends AbstractTool with common functionality for document generators like:

  • PowerPoint, Word, Excel, PDF tools
  • Standard document output management
  • File path validation and generation
  • Async file operations
  • Template management

Class AbstractDocumentTool

Abstract base class for document generation tools.

This class provides common functionality for tools that generate documents like PowerPoint presentations, Word documents, Excel spreadsheets, PDFs, etc.

Features:

  • Standardized document output management
  • File path validation and generation
  • Async file operations with aiofiles
  • Template management support
  • Duplicate file handling
  • Comprehensive metadata generation
Parameter Type Default Description
templates_dir Optional[Path] None Directory containing document templates
output_dir Optional[Union[str, Path]] None
default_template_name Optional[str] None Default template file name
max_file_size_mb float 100.0 Maximum allowed file size in MB
overwrite_existing bool False
artifact_store Any None Server-managed artifact store; when set the document is published there (tenant partition, download URL) instead of written to output_dir
**kwargs {} Additional arguments for AbstractTool

Attributes:

Attribute Type Description
document_type str
default_extension str
supported_extensions List[str]

Method AbstractDocumentTool.get_supported_extensions

Get list of supported file extensions for this document type.

get_supported_extensions() -> List[str]

Returns: List[str]

Method AbstractDocumentTool.get_available_templates

Get list of available template files.

get_available_templates() -> List[str]

Returns: List[str]

Method AbstractDocumentTool.template_exists

Check if a template file exists.

template_exists(template_name: str) -> bool

Parameter Type Default Description
template_name str

Returns: bool

Method AbstractDocumentTool.get_document_info

Get information about this document tool.

get_document_info() -> Dict[str, Any]

Returns: Dict[str, Any]

Alias AbstractTool

Re-exported from parrot_tools.abstract.AbstractTool.

Class DocumentGenerationArgs

Base arguments schema for document generation tools.

In the host's store-only mode (PA-11) the LLM controls the CONTENT only: where the file goes, what it is called, whether it overwrites and which template file is read are server-side decisions, so output_filename, output_dir and overwrite_existing are hidden from the schema and dropped from a call.

Fields:

Field Type Default Description
content str Content to be converted to document (text, markdown, HTML, etc.)
output_filename Optional[str] Custom filename for the output document (without extension). If None, auto-generates with timestamp
file_prefix str Prefix for auto-generated filenames
output_dir Optional[str] Custom output directory. If None, uses tool's default directory
overwrite_existing bool Whether to overwrite existing files with the same name

Method DocumentGenerationArgs.validate_filename

validate_filename(v)

Parameter Type Default Description
v

Method DocumentGenerationArgs.validate_file_prefix

validate_file_prefix(v)

Parameter Type Default Description
v

Class DocumentMetadata

Metadata for generated documents.

Fields:

Field Type Default Description
filename str Name of the generated document file
file_path str Full path to the generated document file
file_url str Public URL to access the generated document file
relative_url str Relative URL to access the generated document file
file_size int Size of the generated document file in bytes
file_size_mb float Size of the generated document file in megabytes
file_extension str File extension of the generated document
created_at str Timestamp when the document was created
content_length int Length of the document content in characters

Alias ExportsToStoreMixin

Re-exported from parrot_tools._exports.ExportsToStoreMixin.

Alias safe_template_name

Re-exported from parrot_tools._exports.safe_template_name.

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally