Skip to content

Commit a6095e6

Browse files
Joshua LeviJoshua Levi
authored andcommitted
add main fuc
1 parent 34b86af commit a6095e6

12 files changed

+183
-547
lines changed

.vscode/launch.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"version": "0.2.0",
33
"configurations": [
4+
45
{
56
"name": "Excel Desktop (Edge Chromium)",
67
"type": "msedge",

.vscode/settings.json

Lines changed: 0 additions & 8 deletions
This file was deleted.
2.47 KB
Binary file not shown.
12.8 KB
Binary file not shown.
2.38 KB
Binary file not shown.

llm_alpha_models/main.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
import formulas_extraction
3+
import metadata_generator
4+
5+
6+
def main():
7+
"""
8+
Runs all the scripts in the llm_alpha_models directory.
9+
"""
10+
print("Running formulas_extraction.py...")
11+
formulas_extraction.main()
12+
print("\n" + "="*20 + "\n")
13+
14+
print("Running metadata_generator.py...")
15+
metadata_generator.main()
16+
print("\n" + "="*20 + "\n")
17+
18+
19+
20+
21+
if __name__ == "__main__":
22+
main()

llm_alpha_models/meta_data.json

Lines changed: 120 additions & 120 deletions
Large diffs are not rendered by default.

llm_alpha_models/metadata_generator.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import json
22
import os
3+
import time
34
from collections import defaultdict
45
from dotenv import load_dotenv
56
from xai_sdk import Client
@@ -10,12 +11,10 @@
1011
from formulas_extraction import get_absolute_references
1112

1213
# Path to your existing JSON
13-
input_path_MAC = "/Users/joshualevi/git_projects/playground_reg/jsonformatter.JSON"
14-
input_path_WIN = "D:\\Entrepreneurship\\ProJets Venture\\Upwork - Alessandro Baccini\\excel-addin-react\\llm_alpha_models\\jsonformatter.JSON"
14+
# Construct the path to jsonformatter.JSON relative to the current script
15+
script_dir = os.path.dirname(__file__)
16+
input_path = os.path.join(script_dir, "jsonformatter.JSON")
1517

16-
# Determine which path to use based on OS
17-
import platform
18-
input_path = input_path_MAC if platform.system() == 'Darwin' else input_path_WIN
1918

2019
# Load JSON
2120
with open(input_path, "r", encoding='utf-8') as f:
@@ -302,4 +301,7 @@ def main():
302301
print(f"✅ Metadata with dependencies saved to {output_path}")
303302

304303
if __name__ == "__main__":
305-
main()
304+
start_time = time.time()
305+
main()
306+
end_time = time.time()
307+
print(f"✅ Script finished in {end_time - start_time:.2f} seconds")

llm_alpha_models/x_ai.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ def main():
88
Main function to initialize the client, send a prompt to the AI,
99
and print the response.
1010
"""
11-
# Build the path to the .env file relative to this script's location
12-
script_dir = os.path.dirname(__file__)
13-
dotenv_path = os.path.join(script_dir, '.env')
11+
# Build the path to the .env file in the project root
12+
parent_dir = os.path.dirname(os.path.dirname(__file__))
13+
dotenv_path = os.path.join(parent_dir, '.env')
1414

1515
if not os.path.exists(dotenv_path):
1616
raise FileNotFoundError(f".env file not found at {dotenv_path}")

0 commit comments

Comments
 (0)