feat(tui): update system message for clarity and conciseness in tool usage instructions
This commit is contained in:
@@ -101,24 +101,14 @@ fn run_turn(
|
||||
let tools = all_tools();
|
||||
let defs = tool_defs(&tools);
|
||||
|
||||
// Build tool description list for the system prompt
|
||||
let tool_desc: Vec<String> = tools.iter().map(|t| {
|
||||
let params = t.parameters();
|
||||
let required = params.get("required").and_then(|r| r.as_array())
|
||||
.map(|a| a.iter().filter_map(|v| v.as_str()).collect::<Vec<_>>().join(", "))
|
||||
.unwrap_or_default();
|
||||
format!("- {}: {} (required params: {})", t.name(), t.description(), required)
|
||||
}).collect();
|
||||
let tool_desc_text = tool_desc.join("\n");
|
||||
|
||||
// Prepend system message with tool descriptions
|
||||
let sys_msg = ChatMessage::system(format!(
|
||||
"You are Zesdex, an AI coding agent with access to the following tools:\n\n{}\n\n\
|
||||
When using tools, always provide ALL required parameters in your tool call. \
|
||||
If a tool returns an error, fix the issue before retrying. \
|
||||
Respond conversationally and helpfully.",
|
||||
tool_desc_text
|
||||
));
|
||||
// Prepend system message
|
||||
let sys_msg = ChatMessage::system(
|
||||
"You are Zesdex, an AI coding assistant. You have access to various tools via native function calling to help the user. \
|
||||
For any non-trivial tasks, you MUST prioritize creating a structured plan (using `plan_enter`) and a list of TODOs (using `todowrite`) BEFORE executing any other tools or modifying files. \
|
||||
Use other tools when necessary. If a tool returns an error, fix the issue before retrying. \
|
||||
Respond conversationally, concisely, and helpfully."
|
||||
.to_string(),
|
||||
);
|
||||
messages.insert(0, sys_msg);
|
||||
|
||||
let tool_ctx = ToolCtx::builder()
|
||||
|
||||
Reference in New Issue
Block a user