Add chat_with_tools() to the Provider trait with a default fallback to chat_with_history(). Implement native tool calling in OpenRouterProvider, reusing existing NativeChatRequest/NativeChatResponse structs. Wire the agent loop to use native tool calls when the provider supports them, falling back to XML-based parsing otherwise. Changes are purely additive to traits.rs and openrouter.rs. The only deletions (36 lines) are within run_tool_call_loop() in loop_.rs where the LLM call section was replaced with a branching if/else for native vs XML tool calling. Includes 5 new tests covering: - chat_with_tools error path (missing API key) - NativeChatResponse deserialization (tool calls only, mixed) - parse_native_response conversion to ChatResponse - tools_to_openai_format schema validation |
||
|---|---|---|
| .. | ||
| agent.rs | ||
| dispatcher.rs | ||
| loop_.rs | ||
| memory_loader.rs | ||
| mod.rs | ||
| prompt.rs | ||