Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -41,12 +41,14 @@ def get_relevant_context(query: str, data: Dict[str, Any]) -> str:
|
|
41 |
context_parts = []
|
42 |
|
43 |
# Company info for general queries
|
44 |
-
if any(word in query for word in ['company', 'about', 'who', 'where', 'location', 'south africa', 'african']):
|
45 |
info = data.get('company_info', {})
|
|
|
46 |
context_parts.append(f"""
|
47 |
Company Information:
|
48 |
- Name: {info.get('name', '')}
|
49 |
- {info.get('tagline', '')}
|
|
|
50 |
- Mission: {info.get('mission', '')}
|
51 |
- Vision: {info.get('vision', '')}
|
52 |
- Location: {info.get('location', '')}
|
@@ -82,6 +84,21 @@ Company Information:
|
|
82 |
Key Features: {', '.join(solution.get('key_features', []))}
|
83 |
Technologies: {', '.join(solution.get('technologies', []))}""")
|
84 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
# If no specific context matched, provide general information
|
86 |
if not context_parts:
|
87 |
info = data.get('company_info', {})
|
@@ -127,11 +144,12 @@ IMPORTANT CONTEXT - USE THIS INFORMATION ONLY:
|
|
127 |
STRICT INSTRUCTIONS:
|
128 |
1. ONLY use information from the context provided above
|
129 |
2. If information isn't in the context, say "I don't have that specific information"
|
130 |
-
3. NEVER make assumptions about location - we are a South African company
|
131 |
4. NEVER invent services or capabilities not listed
|
132 |
5. Be accurate about our AI and educational technology focus
|
133 |
6. Acknowledge our cryptocurrency acceptance when relevant
|
134 |
-
7. Use exact statistics when they're provided in the context
|
|
|
135 |
|
136 |
try:
|
137 |
# Format conversation history
|
|
|
41 |
context_parts = []
|
42 |
|
43 |
# Company info for general queries
|
44 |
+
if any(word in query for word in ['company', 'about', 'who', 'where', 'location', 'south africa', 'african', 'ceo', 'founder', 'wayne', 'sletcher']):
|
45 |
info = data.get('company_info', {})
|
46 |
+
leadership = info.get('leadership', {}).get('ceo', {})
|
47 |
context_parts.append(f"""
|
48 |
Company Information:
|
49 |
- Name: {info.get('name', '')}
|
50 |
- {info.get('tagline', '')}
|
51 |
+
- CEO and Founder: {leadership.get('name', 'Wayne Sletcher')}
|
52 |
- Mission: {info.get('mission', '')}
|
53 |
- Vision: {info.get('vision', '')}
|
54 |
- Location: {info.get('location', '')}
|
|
|
84 |
Key Features: {', '.join(solution.get('key_features', []))}
|
85 |
Technologies: {', '.join(solution.get('technologies', []))}""")
|
86 |
|
87 |
+
# Handle specialization queries
|
88 |
+
if any(word in query for word in ['specialize', 'specialization', 'education', 'learning', 'game', 'games', 'development', 'rag', 'speech', 'tts', 'stt']):
|
89 |
+
specs = data.get('specializations', {})
|
90 |
+
context_parts.append("\nOur Specializations:")
|
91 |
+
for spec_key, spec_data in specs.items():
|
92 |
+
context_parts.append(f"""
|
93 |
+
- {spec_data.get('name', '')}
|
94 |
+
Features: {', '.join(spec_data.get('core_features', []))}
|
95 |
+
Technologies: {', '.join(spec_data.get('key_technologies', []))}""")
|
96 |
+
|
97 |
+
# Add payment information for relevant queries
|
98 |
+
if any(word in query for word in ['payment', 'pay', 'cost', 'pricing', 'bank', 'bitcoin', 'eth', 'btc']):
|
99 |
+
info = data.get('company_info', {})
|
100 |
+
context_parts.append(f"\nPayment Information: {info.get('payment', '')}")
|
101 |
+
|
102 |
# If no specific context matched, provide general information
|
103 |
if not context_parts:
|
104 |
info = data.get('company_info', {})
|
|
|
144 |
STRICT INSTRUCTIONS:
|
145 |
1. ONLY use information from the context provided above
|
146 |
2. If information isn't in the context, say "I don't have that specific information"
|
147 |
+
3. NEVER make assumptions about location - we are a proudly South African company
|
148 |
4. NEVER invent services or capabilities not listed
|
149 |
5. Be accurate about our AI and educational technology focus
|
150 |
6. Acknowledge our cryptocurrency acceptance when relevant
|
151 |
+
7. Use exact statistics when they're provided in the context
|
152 |
+
8. Always acknowledge Wayne Sletcher as CEO and Founder when relevant"""
|
153 |
|
154 |
try:
|
155 |
# Format conversation history
|