ciyidogan commited on
Commit
e59e68d
·
verified ·
1 Parent(s): 195abb7

Update config_models.py

Browse files
Files changed (1) hide show
  1. config_models.py +44 -0
config_models.py CHANGED
@@ -131,6 +131,50 @@ class IntentConfig(BaseModelWithDatetime):
131
  action: str
132
  fallback_timeout_prompt: Optional[str] = None
133
  fallback_error_prompt: Optional[str] = None
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
134
 
135
 
136
  # ===================== LLM Configuration =====================
 
131
  action: str
132
  fallback_timeout_prompt: Optional[str] = None
133
  fallback_error_prompt: Optional[str] = None
134
+
135
+ def get_examples_for_locale(self, locale: str) -> List[str]:
136
+ """Get examples for specific locale"""
137
+ examples = []
138
+ for ex in self.examples:
139
+ if ex.locale_code == locale:
140
+ examples.append(ex.example)
141
+
142
+ # Fallback to any available examples if locale not found
143
+ if not examples and self.examples:
144
+ # Try language part only (tr-TR -> tr)
145
+ if '-' in locale:
146
+ lang_code = locale.split('-')[0]
147
+ for ex in self.examples:
148
+ if ex.locale_code.startswith(lang_code):
149
+ examples.append(ex.example)
150
+
151
+ # If still no examples, return all examples
152
+ if not examples:
153
+ examples = [ex.example for ex in self.examples]
154
+
155
+ return examples
156
+
157
+ def get_examples_for_locale(self, locale: str) -> List[str]:
158
+ """Get examples for specific locale"""
159
+ examples = []
160
+ for ex in self.examples:
161
+ if ex.locale_code == locale:
162
+ examples.append(ex.example)
163
+
164
+ # Fallback to any available examples if locale not found
165
+ if not examples and self.examples:
166
+ # Try language part only (tr-TR -> tr)
167
+ if '-' in locale:
168
+ lang_code = locale.split('-')[0]
169
+ for ex in self.examples:
170
+ if ex.locale_code.startswith(lang_code):
171
+ examples.append(ex.example)
172
+
173
+ # If still no examples, return all examples
174
+ if not examples:
175
+ examples = [ex.example for ex in self.examples]
176
+
177
+ return examples
178
 
179
 
180
  # ===================== LLM Configuration =====================