Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# app.py
|
| 2 |
+
|
| 3 |
+
import os
|
| 4 |
+
from dotenv import load_dotenv
|
| 5 |
+
from agents.openai_agent import query_openai
|
| 6 |
+
from datasets.load_datasets import load_all_datasets
|
| 7 |
+
from tools.math_tools import run_math_analysis
|
| 8 |
+
from tools.serpapi_tools import search_serpapi
|
| 9 |
+
|
| 10 |
+
load_dotenv()
|
| 11 |
+
|
| 12 |
+
def main():
|
| 13 |
+
print("🚀 AI Business Agent Initialized")
|
| 14 |
+
print("Choose a task:")
|
| 15 |
+
print("1. OpenAI Business Reasoning")
|
| 16 |
+
print("2. Load & Explore Domain Datasets")
|
| 17 |
+
print("3. Run a Math/Stats/Forecasting Tool")
|
| 18 |
+
print("4. Search Real-World Data (SerpAPI)")
|
| 19 |
+
choice = input("Enter task number: ")
|
| 20 |
+
|
| 21 |
+
if choice == "1":
|
| 22 |
+
prompt = input("Enter your business or math question:\n> ")
|
| 23 |
+
response = query_openai(prompt)
|
| 24 |
+
print("\n🧠 OpenAI Agent Response:")
|
| 25 |
+
print(response)
|
| 26 |
+
|
| 27 |
+
elif choice == "2":
|
| 28 |
+
datasets = load_all_datasets()
|
| 29 |
+
print("\n📊 Datasets Loaded:")
|
| 30 |
+
for name in datasets:
|
| 31 |
+
print(f"✓ {name}")
|
| 32 |
+
|
| 33 |
+
elif choice == "3":
|
| 34 |
+
print("\nTools: linear_algebra, probability, optimization, game_theory, time_series, markov")
|
| 35 |
+
tool = input("Which topic? > ")
|
| 36 |
+
run_math_analysis(tool)
|
| 37 |
+
|
| 38 |
+
elif choice == "4":
|
| 39 |
+
query = input("Search query (e.g., M&A trends in AI): ")
|
| 40 |
+
results = search_serpapi(query)
|
| 41 |
+
print("\n🔎 Top SERP Results:")
|
| 42 |
+
for r in results:
|
| 43 |
+
print(f"- {r['title']}: {r['link']}")
|
| 44 |
+
|
| 45 |
+
else:
|
| 46 |
+
print("Invalid option. Try again.")
|
| 47 |
+
|
| 48 |
+
if __name__ == "__main__":
|
| 49 |
+
main()
|