fix(agent): improve ReAct parser and tool schemas for better LLM compatibility

- Fix ACTION_INPUT regex to properly capture multiline JSON responses
  - Changed from stopping at first newline to capturing all remaining text
  - Resolves parsing errors when LLM generates formatted JSON with line breaks

- Enhance tool schemas with detailed descriptions and parameter specifications
  - Add comprehensive Message schema for generate_text tool
  - Clarify distinction between resources/get (file read) and resources/list (directory listing)
  - Include clear usage guidance in tool descriptions

- Set default model to llama3.2:latest instead of invalid "ollama"

- Add parse error debugging to help troubleshoot LLM response issues

The agent infrastructure now correctly handles multiline tool arguments and
provides better guidance to LLMs through improved tool schemas. Remaining
errors are due to LLM quality (model making poor tool choices or generating
malformed responses), not infrastructure bugs.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-10-09 19:43:07 +02:00
parent 05e90d3e2b
commit 33d11ae223
25 changed files with 1348 additions and 121 deletions

View File

@@ -3,6 +3,7 @@
//! This crate provides the foundational abstractions for building
//! LLM providers, routers, and MCP (Model Context Protocol) adapters.
pub mod agent;
pub mod config;
pub mod consent;
pub mod conversation;
@@ -24,6 +25,7 @@ pub mod ui;
pub mod validation;
pub mod wrap_cursor;
pub use agent::*;
pub use config::*;
pub use consent::*;
pub use conversation::*;