AumCoreAI commited on
Commit
09c18f6
·
verified ·
1 Parent(s): b519d5f

Update core/language_detector.py

Browse files
Files changed (1) hide show
  1. core/language_detector.py +20 -14
core/language_detector.py CHANGED
@@ -1,6 +1,6 @@
1
  """
2
  Advanced Language Detection Module for AumCore AI
3
- Version: 2.0.0
4
  Author: AumCore AI
5
  """
6
 
@@ -143,42 +143,47 @@ class LanguageDetector:
143
  # Global instance for easy import
144
  detector = LanguageDetector()
145
 
146
- # Simplified function for backward compatibility
 
 
 
147
  def detect_input_language(text: str) -> str:
148
  """Simple wrapper for backward compatibility"""
149
  return detector.detect_input_language(text)
150
 
151
- # Add this function to your language_detector.py file
152
- def get_system_prompt(language: str = "en") -> str:
153
  """
154
- Get system prompt based on language
155
 
156
  Args:
157
  language: Language code (en, hi, etc.)
 
158
 
159
  Returns:
160
  System prompt string
161
  """
 
162
  prompts = {
163
- "en": """You are AumCore AI, an advanced AI assistant specializing in programming,
164
  system design, and technical solutions. Provide detailed, accurate, and
165
  professional responses.""",
166
 
167
- "hi": """आप AumCore AI हैं, एक उन्नत AI सहायक जो प्रोग्रामिंग, सिस्टम डिज़ाइन और
168
  तकनीकी समाधानों में विशेषज्ञ है। विस्तृत, सटीक और पेशेवर प्रतिक्रियाएँ दें।""",
169
 
170
- "es": """Eres AumCore AI, un asistente de IA avanzado especializado en programación,
171
  diseño de sistemas y soluciones técnicas. Proporciona respuestas detalladas,
172
  precisas y profesionales.""",
173
 
174
- "fr": """Vous êtes AumCore AI, un assistant IA avancé especializado en programación,
175
  conception de systèmes et solutions técnicas. Fournissez des réponses détaillées,
176
  précises et professionnelles."""
177
  }
178
 
179
  return prompts.get(language, prompts["en"])
180
 
181
- # Optional: Additional utility function
182
  def detect_with_confidence(text: str) -> Tuple[str, float]:
183
  """Detect language with confidence score"""
184
  detector_obj = LanguageDetector()
@@ -186,7 +191,7 @@ def detect_with_confidence(text: str) -> Tuple[str, float]:
186
  confidence = detector_obj.get_detection_confidence(text, language)
187
  return language, confidence
188
 
189
- # Keep the old function if it's being used elsewhere
190
  def generate_basic_code(task):
191
  """Generate basic code templates - TEMPORARY SIMPLE VERSION"""
192
  task_lower = task.lower()
@@ -198,13 +203,14 @@ def generate_basic_code(task):
198
  else:
199
  return "```python\nprint('Hello from AumCore AI')\n```"
200
 
 
201
  # Module metadata
202
- __version__ = "2.0.0"
203
  __author__ = "AumCore AI"
204
  __all__ = [
205
  'detect_input_language',
 
206
  'detect_with_confidence',
207
  'LanguageDetector',
208
- 'generate_basic_code',
209
- 'get_system_prompt' # Added this
210
  ]
 
1
  """
2
  Advanced Language Detection Module for AumCore AI
3
+ Version: 2.0.1
4
  Author: AumCore AI
5
  """
6
 
 
143
  # Global instance for easy import
144
  detector = LanguageDetector()
145
 
146
+ # ==========================================
147
+ # MAIN FUNCTIONS FOR IMPORT
148
+ # ==========================================
149
+
150
  def detect_input_language(text: str) -> str:
151
  """Simple wrapper for backward compatibility"""
152
  return detector.detect_input_language(text)
153
 
154
+
155
+ def get_system_prompt(language: str = "en", username: str = None) -> str:
156
  """
157
+ Get system prompt based on language and username
158
 
159
  Args:
160
  language: Language code (en, hi, etc.)
161
+ username: Optional username for personalization
162
 
163
  Returns:
164
  System prompt string
165
  """
166
+ # Default prompts
167
  prompts = {
168
+ "en": f"""You are AumCore AI{' (' + username + ')' if username else ''}, an advanced AI assistant specializing in programming,
169
  system design, and technical solutions. Provide detailed, accurate, and
170
  professional responses.""",
171
 
172
+ "hi": f"""आप AumCore AI{' (' + username + ')' if username else ''} हैं, एक उन्नत AI सहायक जो प्रोग्रामिंग, सिस्टम डिज़ाइन और
173
  तकनीकी समाधानों में विशेषज्ञ है। विस्तृत, सटीक और पेशेवर प्रतिक्रियाएँ दें।""",
174
 
175
+ "es": f"""Eres AumCore AI{' (' + username + ')' if username else ''}, un asistente de IA avanzado especializado en programación,
176
  diseño de sistemas y soluciones técnicas. Proporciona respuestas detalladas,
177
  precisas y profesionales.""",
178
 
179
+ "fr": f"""Vous êtes AumCore AI{' (' + username + ')' if username else ''}, un assistant IA avancé especializado en programación,
180
  conception de systèmes et solutions técnicas. Fournissez des réponses détaillées,
181
  précises et professionnelles."""
182
  }
183
 
184
  return prompts.get(language, prompts["en"])
185
 
186
+
187
  def detect_with_confidence(text: str) -> Tuple[str, float]:
188
  """Detect language with confidence score"""
189
  detector_obj = LanguageDetector()
 
191
  confidence = detector_obj.get_detection_confidence(text, language)
192
  return language, confidence
193
 
194
+
195
  def generate_basic_code(task):
196
  """Generate basic code templates - TEMPORARY SIMPLE VERSION"""
197
  task_lower = task.lower()
 
203
  else:
204
  return "```python\nprint('Hello from AumCore AI')\n```"
205
 
206
+
207
  # Module metadata
208
+ __version__ = "2.0.1"
209
  __author__ = "AumCore AI"
210
  __all__ = [
211
  'detect_input_language',
212
+ 'get_system_prompt',
213
  'detect_with_confidence',
214
  'LanguageDetector',
215
+ 'generate_basic_code'
 
216
  ]