File size: 1,419 Bytes
96e2507
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import os

def check_missing_components():
    missing_components = []

    # Check for API keys or required environment variables
    if not os.getenv("API_KEY"):
        missing_components.append("API_KEY is missing. Please provide authentication credentials.")

    # Check if database integration is functional
    try:
        import chromadb
        client = chromadb.PersistentClient(path="./chat_memory")
    except ImportError:
        missing_components.append("ChromaDB is missing. Install it with `pip install chromadb`.")

    # Check if AI model is loaded
    try:
        from transformers import AutoModelForCausalLM, AutoTokenizer
        tokenizer = AutoTokenizer.from_pretrained("mistralai/Mistral-7B-Instruct")
        model = AutoModelForCausalLM.from_pretrained("mistralai/Mistral-7B-Instruct")
    except Exception as e:
        missing_components.append(f"AI Model failed to load: {e}")

    # Check if required files exist
    required_files = ["app.py", "requirements.txt"]
    for file in required_files:
        if not os.path.exists(file):
            missing_components.append(f"Required file {file} is missing.")

    return missing_components

# Execute and report missing components
missing = check_missing_components()
if missing:
    print("⚠️ Missing Components Detected:")
    for issue in missing:
        print(f"- {issue}")
else:
    print("✅ All components are present.")