validation¶
academic_doc_generator.core.validation
¶
Validation logic for configuration and environment.
validate_api_keys()
¶
Check which LLM APIs are configured.
Returns:
| Type | Description |
|---|---|
list[str]
|
List of available API names. |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If no APIs are configured. |
Source code in src/academic_doc_generator/core/validation.py
validate_pdf_path(folder_path, filename)
¶
Get validated PDF file path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
folder_path
|
str
|
Base folder path. |
required |
filename
|
str
|
Name of the PDF file. |
required |
Returns:
| Type | Description |
|---|---|
Path
|
Absolute path to PDF file. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If path attempts directory traversal or contains invalid characters. |
FileNotFoundError
|
If PDF does not exist. |
Security
- Prevents directory traversal (../)
- Prevents absolute paths
- Validates file extension