@@ -87,13 +87,45 @@ def generate_config_yaml(category_accuracies, similarity_threshold):
8787 "max_entries" : 1000 ,
8888 "ttl_seconds" : 3600 ,
8989 },
90- "classifier" : {
91- "model_id" : "models/category_classifier_modernbert-base_model" ,
92- "threshold" : 0.1 ,
90+ "tools" : {
91+ "enabled" : True ,
92+ "top_k" : 3 ,
93+ "similarity_threshold" : 0.2 ,
94+ "tools_db_path" : "config/tools_db.json" ,
95+ "fallback_to_empty" : True ,
96+ },
97+ "prompt_guard" : {
98+ "enabled" : True ,
99+ "use_modernbert" : True ,
100+ "model_id" : "models/jailbreak_classifier_modernbert-base_model" ,
101+ "threshold" : 0.7 ,
93102 "use_cpu" : True ,
94- "category_mapping_path" : "models/category_classifier_modernbert-base_model/category_mapping.json" ,
103+ "jailbreak_mapping_path" : "models/jailbreak_classifier_modernbert-base_model/jailbreak_type_mapping.json" ,
104+ },
105+ "gpu_config" : {
106+ "flops" : 312000000000000 , # 312e12 fp16
107+ "hbm" : 2000000000000 , # 2e12 (2 TB/s)
108+ "description" : "A100-80G" ,
109+ },
110+ "classifier" : {
111+ "category_model" : {
112+ "model_id" : "models/category_classifier_modernbert-base_model" ,
113+ "use_modernbert" : True ,
114+ "threshold" : 0.6 ,
115+ "use_cpu" : True ,
116+ "category_mapping_path" : "models/category_classifier_modernbert-base_model/category_mapping.json" ,
117+ },
118+ "pii_model" : {
119+ "model_id" : "models/pii_classifier_modernbert-base_presidio_token_model" ,
120+ "use_modernbert" : True ,
121+ "threshold" : 0.7 ,
122+ "use_cpu" : True ,
123+ "pii_mapping_path" : "models/pii_classifier_modernbert-base_presidio_token_model/pii_type_mapping.json" ,
124+ },
125+ "load_aware" : False ,
95126 },
96127 "categories" : [],
128+ "default_reasoning_effort" : "medium" , # Default reasoning effort level (low, medium, high)
97129 }
98130
99131 # Get the best model overall to use as default (excluding 'auto')
@@ -114,6 +146,80 @@ def generate_config_yaml(category_accuracies, similarity_threshold):
114146 default_model = max (model_avg_accuracies , key = model_avg_accuracies .get )
115147 config ["default_model" ] = default_model .split (":" )[0 ] # Remove the approach suffix
116148
149+ # Define category-specific reasoning settings
150+ category_reasoning = {
151+ "math" : {
152+ "use_reasoning" : True ,
153+ "reasoning_description" : "Mathematical problems require step-by-step reasoning" ,
154+ "reasoning_effort" : "high" ,
155+ },
156+ "physics" : {
157+ "use_reasoning" : True ,
158+ "reasoning_description" : "Physics concepts need logical analysis" ,
159+ "reasoning_effort" : "high" ,
160+ },
161+ "chemistry" : {
162+ "use_reasoning" : True ,
163+ "reasoning_description" : "Chemical reactions and formulas require systematic thinking" ,
164+ "reasoning_effort" : "high" ,
165+ },
166+ "computer science" : {
167+ "use_reasoning" : True ,
168+ "reasoning_description" : "Programming and algorithms need logical reasoning" ,
169+ "reasoning_effort" : "high" ,
170+ },
171+ "engineering" : {
172+ "use_reasoning" : True ,
173+ "reasoning_description" : "Engineering problems require systematic problem-solving" ,
174+ "reasoning_effort" : "high" ,
175+ },
176+ "biology" : {
177+ "use_reasoning" : True ,
178+ "reasoning_description" : "Biological processes benefit from structured analysis" ,
179+ "reasoning_effort" : "medium" ,
180+ },
181+ "business" : {
182+ "use_reasoning" : False ,
183+ "reasoning_description" : "Business content is typically conversational" ,
184+ "reasoning_effort" : "low" ,
185+ },
186+ "law" : {
187+ "use_reasoning" : False ,
188+ "reasoning_description" : "Legal content is typically explanatory" ,
189+ "reasoning_effort" : "medium" ,
190+ },
191+ "psychology" : {
192+ "use_reasoning" : False ,
193+ "reasoning_description" : "Psychology content is usually explanatory" ,
194+ "reasoning_effort" : "medium" ,
195+ },
196+ "history" : {
197+ "use_reasoning" : False ,
198+ "reasoning_description" : "Historical content is narrative-based" ,
199+ "reasoning_effort" : "low" ,
200+ },
201+ "economics" : {
202+ "use_reasoning" : False ,
203+ "reasoning_description" : "Economic discussions are usually explanatory" ,
204+ "reasoning_effort" : "medium" ,
205+ },
206+ "philosophy" : {
207+ "use_reasoning" : False ,
208+ "reasoning_description" : "Philosophical discussions are conversational" ,
209+ "reasoning_effort" : "medium" ,
210+ },
211+ "health" : {
212+ "use_reasoning" : False ,
213+ "reasoning_description" : "Health information is typically informational" ,
214+ "reasoning_effort" : "medium" ,
215+ },
216+ "other" : {
217+ "use_reasoning" : False ,
218+ "reasoning_description" : "General content doesn't require reasoning" ,
219+ "reasoning_effort" : "low" ,
220+ },
221+ }
222+
117223 # Create category entries with ranked model-score pairs (excluding 'auto')
118224 for category , models in category_accuracies .items ():
119225 # Sort models by accuracy (descending), exclude 'auto'
@@ -126,8 +232,25 @@ def generate_config_yaml(category_accuracies, similarity_threshold):
126232 model_scores = [
127233 {"model" : model , "score" : float (acc )} for model , acc in ranked_models
128234 ]
129- # Add category to config
130- config ["categories" ].append ({"name" : category , "model_scores" : model_scores })
235+ # Get reasoning settings for the category
236+ reasoning_settings = category_reasoning .get (
237+ category .lower (),
238+ {
239+ "use_reasoning" : False ,
240+ "reasoning_description" : "General content doesn't require reasoning" ,
241+ "reasoning_effort" : "low" ,
242+ },
243+ )
244+ # Add category to config with reasoning settings
245+ config ["categories" ].append (
246+ {
247+ "name" : category ,
248+ "use_reasoning" : reasoning_settings ["use_reasoning" ],
249+ "reasoning_description" : reasoning_settings ["reasoning_description" ],
250+ "reasoning_effort" : reasoning_settings ["reasoning_effort" ],
251+ "model_scores" : model_scores ,
252+ }
253+ )
131254
132255 return config
133256
0 commit comments