Merge pull request #274 from mai1015/feat/refactor-agent-loop
feat(providers): add native tool-calling for OpenRouter/Anthropic and align provider tests with simple_chat
This commit is contained in:
commit
f13ce909c4
22 changed files with 2596 additions and 474 deletions
|
|
@ -221,14 +221,9 @@ impl Tool for DelegateTool {
|
|||
|
||||
match result {
|
||||
Ok(response) => {
|
||||
let has_tool_calls = response.has_tool_calls();
|
||||
let mut rendered = response.text.unwrap_or_default();
|
||||
let mut rendered = response;
|
||||
if rendered.trim().is_empty() {
|
||||
if has_tool_calls {
|
||||
rendered = "[Tool-only response; no text content]".to_string();
|
||||
} else {
|
||||
rendered = "[Empty response]".to_string();
|
||||
}
|
||||
rendered = "[Empty response]".to_string();
|
||||
}
|
||||
|
||||
Ok(ToolResult {
|
||||
|
|
|
|||
|
|
@ -170,8 +170,12 @@ pub fn all_tools_with_runtime(
|
|||
|
||||
// Add delegation tool when agents are configured
|
||||
if !agents.is_empty() {
|
||||
let delegate_agents: HashMap<String, DelegateAgentConfig> = agents
|
||||
.iter()
|
||||
.map(|(name, cfg)| (name.clone(), cfg.clone()))
|
||||
.collect();
|
||||
tools.push(Box::new(DelegateTool::new(
|
||||
agents.clone(),
|
||||
delegate_agents,
|
||||
fallback_api_key.map(String::from),
|
||||
)));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue