cargo fmt: format all Rust source files
All checks were successful
CI — P1 Route (Rust) / test (push) Successful in 6m35s
All checks were successful
CI — P1 Route (Rust) / test (push) Successful in 6m35s
This commit is contained in:
@@ -41,13 +41,21 @@ impl RouterBrain {
|
||||
.get("messages")
|
||||
.and_then(|m| m.as_array())
|
||||
.and_then(|msgs| {
|
||||
msgs.iter().find(|m| m.get("role").and_then(|r| r.as_str()) == Some("system"))
|
||||
msgs.iter()
|
||||
.find(|m| m.get("role").and_then(|r| r.as_str()) == Some("system"))
|
||||
})
|
||||
.and_then(|m| m.get("content"))
|
||||
.and_then(|c| c.as_str())
|
||||
.unwrap_or("");
|
||||
|
||||
let high_complexity_keywords = ["analyze", "reason", "compare", "evaluate", "synthesize", "debate"];
|
||||
let high_complexity_keywords = [
|
||||
"analyze",
|
||||
"reason",
|
||||
"compare",
|
||||
"evaluate",
|
||||
"synthesize",
|
||||
"debate",
|
||||
];
|
||||
let has_complex_task = high_complexity_keywords
|
||||
.iter()
|
||||
.any(|kw| system_prompt.to_lowercase().contains(kw));
|
||||
@@ -142,7 +150,9 @@ mod tests {
|
||||
];
|
||||
for i in 0..12 {
|
||||
messages.push(serde_json::json!({"role": "user", "content": format!("Turn {}", i)}));
|
||||
messages.push(serde_json::json!({"role": "assistant", "content": format!("Response {}", i)}));
|
||||
messages.push(
|
||||
serde_json::json!({"role": "assistant", "content": format!("Response {}", i)}),
|
||||
);
|
||||
}
|
||||
let request = serde_json::json!({ "model": "gpt-4o", "messages": messages });
|
||||
let complexity = brain.classify_complexity(&request);
|
||||
|
||||
Reference in New Issue
Block a user