refactor: trimmed some prompts

style: version tool output now mentions the default model in use
This commit is contained in:
Fahad
2025-10-01 21:55:05 +04:00
parent d9449c7bb6
commit f69ff03c4d
5 changed files with 50 additions and 22 deletions

View File

@@ -93,7 +93,7 @@ class TestAutoMode:
# Model field should have detailed descriptions
model_schema = schema["properties"]["model"]
assert "enum" not in model_schema
assert "auto model selection" in model_schema["description"].lower()
assert "auto mode" in model_schema["description"].lower()
assert "listmodels" in model_schema["description"]
finally:
@@ -289,7 +289,7 @@ class TestAutoMode:
schema = tool.get_model_field_schema()
assert "enum" not in schema
assert schema["type"] == "string"
assert "auto model selection" in schema["description"]
assert "auto mode" in schema["description"].lower()
assert "listmodels" in schema["description"]
# Test normal mode

View File

@@ -87,7 +87,7 @@ class TestChatTool:
# Description should route callers to listmodels, regardless of mode
assert "listmodels" in schema["description"]
if self.tool.is_effective_auto_mode():
assert "auto model selection" in schema["description"]
assert "auto mode" in schema["description"].lower()
else:
import config

View File

@@ -25,10 +25,8 @@ CHAT_FIELD_DESCRIPTIONS = {
"Your question or idea for collaborative thinking. Provide detailed context, including your goal, what you've tried, and any specific challenges. "
"CRITICAL: To discuss code, use 'files' parameter instead of pasting code blocks here."
),
"files": "Always pass absolute full-paths (do NOT shorten) to existing files / folders containing code being discussed.",
"images": (
"Optional images for visual context (must be FULL absolute paths to real files / folders - DO NOT SHORTEN - OR these can be bas64 data)"
),
"files": "absolute file or folder paths for code context (do NOT shorten).",
"images": "Optional absolute image paths or base64 for visual context when helpful.",
}

View File

@@ -20,24 +20,16 @@ logger = logging.getLogger(__name__)
# Shared field descriptions to avoid duplication
COMMON_FIELD_DESCRIPTIONS = {
"model": (
"Model to use. See tool's input schema for available models if required. Use 'auto' select the best model for the task."
),
"temperature": ("Lower values: deterministic; higher: creative."),
"thinking_mode": (
"Thinking depth: minimal (0.5%), low (8%), medium (33%), high (67%), "
"max (100% of model max). Higher modes: deeper reasoning but slower."
),
"model": "Model to run. Supply a name if requested by the user or stay in auto mode. When in auto mode, use `listmodels` tool for model discovery.",
"temperature": "0 = deterministic · 1 = creative.",
"thinking_mode": "Reasoning depth: minimal, low, medium, high, or max.",
"continuation_id": (
"Unique thread continuation ID for multi-turn conversations. Works across different tools. "
"ALWAYS reuse last continuation_id you were provided as-is when re-communicating with Zen MCP, "
"unless user provides different ID. When supplied, your complete conversation history is available, so focus on new insights."
"ALWAYS reuse the last continuation_id you were given—this preserves full conversation context, "
"files, and findings so the agent can resume seamlessly."
),
"images": (
"Optional images for visual context. MUST be absolute paths or base64. "
"Use when user mentions images. Describe image contents. "
),
"files": ("Optional files for context (FULL absolute paths to real files/folders - DO NOT SHORTEN)"),
"images": "Optional absolute image paths or base64 blobs for visual context.",
"files": "Optional absolute file or folder paths (do not shorten).",
}
# Workflow-specific field descriptions

View File

@@ -193,6 +193,35 @@ class VersionTool(BaseTool):
output_lines.append(f"**Last Updated**: {__updated__}")
output_lines.append(f"**Author**: {__author__}")
model_selection_metadata = {"mode": "unknown", "default_model": None}
model_selection_display = "Model selection status unavailable"
# Model selection configuration
try:
from config import DEFAULT_MODEL
from tools.shared.base_tool import BaseTool
auto_mode = BaseTool.is_effective_auto_mode(self)
if auto_mode:
output_lines.append(
"**Model Selection**: Auto model selection mode (call `listmodels` to inspect options)"
)
model_selection_metadata = {"mode": "auto", "default_model": DEFAULT_MODEL}
model_selection_display = "Auto model selection (use `listmodels` for options)"
else:
output_lines.append(f"**Model Selection**: Default model set to `{DEFAULT_MODEL}`")
model_selection_metadata = {"mode": "default", "default_model": DEFAULT_MODEL}
model_selection_display = f"Default model: `{DEFAULT_MODEL}`"
except Exception as exc:
logger.debug(f"Could not determine model selection mode: {exc}")
output_lines.append("")
output_lines.append("## Quick Summary — relay everything below")
output_lines.append(f"- Version `{__version__}` (updated {__updated__})")
output_lines.append(f"- {model_selection_display}")
output_lines.append("- Run `listmodels` for the complete model catalog and capabilities")
output_lines.append("")
# Try to get client information
try:
# We need access to the server instance
@@ -211,6 +240,13 @@ class VersionTool(BaseTool):
current_path = Path.cwd()
output_lines.append(f"**Installation Path**: `{current_path}`")
output_lines.append("")
output_lines.append("## Agent Reporting Guidance")
output_lines.append(
"Agents MUST report: version, model-selection status, configured providers, and available-model count."
)
output_lines.append("Repeat the quick-summary bullets verbatim in your reply.")
output_lines.append("Reference `listmodels` when users ask about model availability or capabilities.")
output_lines.append("")
# Check for updates from GitHub
output_lines.append("## Update Status")
@@ -320,6 +356,8 @@ class VersionTool(BaseTool):
"last_updated": __updated__,
"python_version": f"{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}",
"platform": f"{platform.system()} {platform.release()}",
"model_selection_mode": model_selection_metadata["mode"],
"default_model": model_selection_metadata["default_model"],
},
)