docsense.cli.main
Command Line Interface for DocSense.
This module provides the command-line interface for DocSense, offering three main commands: - index: Create a vector index from documents in a directory - ask: Ask a question and get an answer based on indexed documents - daemon: Run DocSense in daemon mode for faster consecutive queries
The CLI is built using Typer and Rich libraries for better user experience.
Functions
|
Ask a question and get an answer based on indexed documents. |
|
Start DocSense in daemon mode for faster responses. |
|
Format time duration in a human-readable way. |
|
Create document index from the specified path. |
- index(path, model_name='Qwen/Qwen2-7B', device='cuda', index_path=PosixPath('/home/runner/.docsense/index'))[source]
Create document index from the specified path.
This command processes documents from the given directory and creates a vector index for semantic search capabilities.
- Parameters:
- Raises:
typer.Exit – If an error occurs during indexing
- ask(question, model_name='Qwen/Qwen2-7B', device='cuda', index_path=PosixPath('/home/runner/.docsense/index'))[source]
Ask a question and get an answer based on indexed documents.
This command processes a natural language question and returns an answer based on the content of indexed documents.
- Parameters:
- Raises:
typer.Exit – If index is not found or an error occurs during processing
- daemon(model_name='Qwen/Qwen2-7B', device='cuda', index_path=PosixPath('/home/runner/.docsense/index'))[source]
Start DocSense in daemon mode for faster responses.
This command starts an interactive session where the model stays loaded in memory, allowing for faster consecutive queries without reloading the model each time.