Skip to content

Documents and chunks

Core

report_analyst/ ยท Reciprocal Public License. This is the open core: the Streamlit analyst, chunking, question sets, and benchmarking. It ships in the core Docker image.

A document source uploads a file and returns its chunks. The core implementation reads a local PDF. Search-backend sources are an enterprise integration and are not part of this page.

report_analyst.core.document_sources.DocumentChunk

Represents a chunk of a document

report_analyst.core.document_sources.DocumentSource

Bases: ABC

Abstract interface for document processing and chunk retrieval

upload_document(file_path) abstractmethod async

Upload a document and return a document ID.

Parameters:

Name Type Description Default
file_path Union[str, Path]

Path to the document file

required

Returns:

Type Description
str

Document ID for subsequent operations

get_chunks(document_id, configuration=None) abstractmethod async

Get chunks for a document.

Parameters:

Name Type Description Default
document_id str

ID of the document

required
configuration Optional[Dict[str, Any]]

Optional configuration for chunking (chunk_size, overlap, etc.)

None

Returns:

Type Description
List[DocumentChunk]

List of document chunks

get_document_status(document_id) abstractmethod async

Get processing status of a document.

Parameters:

Name Type Description Default
document_id str

ID of the document

required

Returns:

Type Description
Dict[str, Any]

Status information including processing state, error messages, etc.

delete_document(document_id) async

Delete a document and its associated chunks.

Parameters:

Name Type Description Default
document_id str

ID of the document

required

Returns:

Type Description
bool

True if successful, False otherwise

report_analyst.core.document_sources.LocalDocumentSource

Bases: DocumentSource

Local document processing implementation using existing analyzer logic

upload_document(file_path) async

Upload document using local processor

get_chunks(document_id, configuration=None) async

Get chunks using existing analyzer logic

get_document_status(document_id) async

Get document status from cache

delete_document(document_id) async

Delete document and cleanup files