Spaces:
Sleeping
Sleeping
Update bs/balance_sheet_generator.py
#15
by
sahil-1-garg
- opened
bs/balance_sheet_generator.py
CHANGED
|
@@ -29,10 +29,13 @@ logging.basicConfig(
|
|
| 29 |
logger = logging.getLogger(__name__)
|
| 30 |
|
| 31 |
class Settings(BaseSettings):
|
| 32 |
-
"""Application settings loaded from environment variables
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
settings = Settings()
|
| 38 |
|
|
@@ -691,7 +694,7 @@ Return ONLY this JSON format:
|
|
| 691 |
def main() -> None:
|
| 692 |
"""
|
| 693 |
Main function for running the balance sheet generator.
|
| 694 |
-
Accepts input file
|
| 695 |
Handles errors gracefully and logs all major events.
|
| 696 |
"""
|
| 697 |
logger.info(" ENHANCED BALANCE SHEET GENERATOR v3.0 (Template-Based) started.")
|
|
@@ -704,7 +707,7 @@ def main() -> None:
|
|
| 704 |
if len(sys.argv) > 2:
|
| 705 |
output_dir = sys.argv[2]
|
| 706 |
if not api_key:
|
| 707 |
-
logger.error(" Missing OpenRouter API key. Please provide
|
| 708 |
sys.exit(1)
|
| 709 |
if not os.path.exists(input_file):
|
| 710 |
logger.error(f" Input file not found: {input_file}. Please ensure your JSON data file exists.")
|
|
|
|
| 29 |
logger = logging.getLogger(__name__)
|
| 30 |
|
| 31 |
class Settings(BaseSettings):
|
| 32 |
+
"""Application settings loaded from environment variables."""
|
| 33 |
+
input_file: str = Field(default="data/clean_financial_data_bs.json")
|
| 34 |
+
output_dir: str = Field(default="data/output")
|
| 35 |
+
|
| 36 |
+
model_config = {
|
| 37 |
+
"extra": "ignore"
|
| 38 |
+
}
|
| 39 |
|
| 40 |
settings = Settings()
|
| 41 |
|
|
|
|
| 694 |
def main() -> None:
|
| 695 |
"""
|
| 696 |
Main function for running the balance sheet generator.
|
| 697 |
+
Accepts input file, output directory, and API key from command-line arguments.
|
| 698 |
Handles errors gracefully and logs all major events.
|
| 699 |
"""
|
| 700 |
logger.info(" ENHANCED BALANCE SHEET GENERATOR v3.0 (Template-Based) started.")
|
|
|
|
| 707 |
if len(sys.argv) > 2:
|
| 708 |
output_dir = sys.argv[2]
|
| 709 |
if not api_key:
|
| 710 |
+
logger.error(" Missing OpenRouter API key. Please provide your API key via the 'user_api_key' parameter in your request.")
|
| 711 |
sys.exit(1)
|
| 712 |
if not os.path.exists(input_file):
|
| 713 |
logger.error(f" Input file not found: {input_file}. Please ensure your JSON data file exists.")
|