-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.py
More file actions
43 lines (35 loc) · 1.32 KB
/
run.py
File metadata and controls
43 lines (35 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/env python3
"""
GenAI Testing Tutorial - RAG Chatbot Application
Entry point for running the Flask application
"""
import os
import sys
from dotenv import load_dotenv
# Add the app directory to the Python path
sys.path.insert(0, os.path.dirname(__file__))
# Load environment variables
load_dotenv()
# Import and run the Flask app
from app.main import app
if __name__ == '__main__':
# Validate required environment variables
required_vars = ['COHERE_API_KEY']
missing_vars = [var for var in required_vars if not os.getenv(var)]
if missing_vars:
print("❌ Missing required environment variables:")
for var in missing_vars:
print(f" - {var}")
print("\nPlease add your LLM API Key to the .env file.")
sys.exit(1)
print("🚀 Starting GenAI Testing Tutorial Application...")
print(f"📚 Documents directory: {os.path.join(os.path.dirname(__file__), 'data', 'documents')}")
print(f"🔧 Environment: {os.getenv('FLASK_ENV', 'development')}")
print(f"🌐 Server will start on: http://localhost:{os.getenv('FLASK_PORT', 5000)}")
print("\n" + "="*50)
# Start the Flask application
app.run(
host='0.0.0.0',
port=int(os.getenv('FLASK_PORT', 5000)),
debug=os.getenv('FLASK_DEBUG', 'True').lower() == 'true'
)