iflow报文工具字段在`OpenAI 兼容 API`身份验证模式下推理平台校验不合法

最新(昨天)下载安装版本。

无论是发任何对话给本地部署的推理引擎(lmstudio)均反馈:

[API Error: 生成数据错误: HTTP 错误!状态:400,响应:{“error”:“[\n {\n “code”: “invalid_type”,\n “expected”: “object”,\n “received”: “undefined”,\n
“path”: [\n 14,\n “function”,\n “parameters”,\n “properties”\n ],\n “message”: “Required”\n }\n]”}
TraceID:00-fb8296bfff93df0070bac6e9ad3c8244-15d7c5fe89013f9c-01]

根据分析,是第14个工具todo_read缺少properites字段。

下面是iflow请求报文

=======================================================================

{
“model”: “nvidia-nemotron-3-nano-30b-a3b”,
“messages”: [
{
“role”: “system”,
“content”: “You are iFlow CLI, an interactive CLI agent with a… …ing until the user’s query is completely resolved.”
},
{
“role”: “user”,
“content”: [
{
“type”: “text”,
“text”: “This is the iFlow CLI. We are setting up the conte… …ing-plan.md\n├───IFLOW.md\n└───docs/\n └───text.md”
}
]
},
{
“role”: “assistant”,
“content”: “Got it. Thanks for the context!”
},
{
“role”: “user”,
“content”: [
{
“type”: “text”,
“text”: “\nAs you answer the user’s questio… …f the time, it is not relevant.\n”
},
{
“type”: “text”,
“text”: “This is a reminder that your todo… …ention this message to the user.”
},
{
“type”: “text”,
“text”: “\nThe user has submitted a query i… …nd to the user in Chinese (中文).\n”
},
{
“type”: “text”,
“text”: “我现在使用iflow平台,该平台内建read file by line工具和功能。请将@IFLOW.md 中涉及mcp_mcp_line_edit的地方修改一下。”
}
]
}
],
“temperature”: 0.6,
“max_new_tokens”: 8000,
“tools”: [
{
“type”: “function”,
“function”: {
“name”: “list_directory”,
“description”: “Lists the names of files and subdirectories direct… …ly ignore entries matching provided glob patterns.”,
“parameters”: {
“type”: “object”,
“properties”: {
“path”: {
“type”: “string”,
“description”: “The absolute path to the directory to list (must be absolute, not relative)”
},
“ignore”: {
“type”: “array”,
“description”: “List of glob patterns to ignore”,
“items”: {
“type”: “string”
}
},
“file_filtering_options”: {
“type”: “object”,
“description”: “Optional: Whether to respect ignore patterns from .gitignore or .iflowignore”,
“properties”: {
“respect_git_ignore”: {
“type”: “boolean”,
“description”: “Optional: Whether to respect .gitignore patterns w… …y available in git repositories. Defaults to true.”
},
“respect_gemini_ignore”: {
“type”: “boolean”,
“description”: “Optional: Whether to respect .iflowignore patterns when listing files. Defaults to true.”
}
},
“additionalProperties”: false
}
},
“required”: [
“path”
],
“additionalProperties”: false
}
}
},
{
“type”: “function”,
“function”: {
“name”: “read_file”,
“description”: “Reads and returns the content of a specified file … … For text files, it can read specific line ranges.”,
“parameters”: {
“type”: “object”,
“properties”: {
“absolute_path”: {
“type”: “string”,
“description”: “The absolute path to the file to read (e.g., '/hom… … not supported. You must provide an absolute path.”
},
“offset”: {
“type”: “number”,
“description”: “Optional: For text files, the 0-based line number … …to be set. Use for paginating through large files.”
},
“limit”: {
“type”: “number”,
“description”: “Optional: For text files, maximum number of lines … … entire file (if feasible, up to a default limit).”
}
},
“required”: [
“absolute_path”
],
“additionalProperties”: false
}
}
},
{
“type”: “function”,
“function”: {
“name”: “image_read”,
“description”: “Reads image files (file path or base64 data) and g… …information to create targeted image descriptions.”,
“parameters”: {
“type”: “object”,
“properties”: {
“image_input”: {
“type”: “string”,
“description”: “Image input: either absolute file path or base64 e… … include the data URI prefix or raw base64 string.”
},
“prompt”: {
“type”: “string”,
“description”: “A comprehensive Vision Language Model (VLM) instru… …t:** Define the exact output information required.”
},
“task_brief”: {
“type”: “string”,
“description”: “Brief task description displayed on the CLI, under 15 words (e.g., ‘Analyze UI design style’). For display only.”
},
“input_type”: {
“type”: “string”,
“description”: “Input type: ‘file_path’ for file path input, ‘base64’ for base64 encoded data input. Defaults to ‘file_path’.”,
“enum”: [
“file_path”,
“base64”
]
},
“mime_type”: {
“type”: “string”,
“description”: “Optional image MIME type when input_type is 'base6… … the tool will attempt to detect from base64 data.”
}
},
“required”: [
“image_input”
],
“additionalProperties”: false
}
}
},
{
“type”: “function”,
“function”: {
“name”: “search_file_content”,
“description”: “Searches for a regular expression pattern within t… …ory results limited to 20,000 matches like VSCode.”,
“parameters”: {
“type”: “object”,
“properties”: {
“pattern”: {
“type”: “string”,
“description”: “The regular expression (regex) pattern to search f… …+myFunction’, ‘import\\s+\\{.\\}\\s+from\\s+.’).”
},
“path”: {
“type”: “string”,
“description”: “Optional: The absolute path to the file or directo… …f omitted, searches the current working directory.”
},
“include”: {
“type”: “string”,
“description”: “Optional: A glob pattern to filter which files are… …s all files (respecting potential global ignores).”
}
},
“required”: [
“pattern”
],
“additionalProperties”: false
}
}
},
{
“type”: “function”,
“function”: {
“name”: “glob”,
“description”: “Efficiently finds files matching specific glob pat… … or path structure, especially in large codebases.”,
“parameters”: {
“type”: “object”,
“properties”: {
“pattern”: {
“type”: “string”,
“description”: “The glob pattern to match against (e.g., ‘**/.py’, 'docs/.md’).”
},
“path”: {
“type”: “string”,
“description”: “Optional: The absolute path to the directory to search within. If omitted, searches the root directory.”
},
“case_sensitive”: {
“type”: “boolean”,
“description”: “Optional: Whether the search should be case-sensitive. Defaults to false.”
},
“respect_git_ignore”: {
“type”: “boolean”,
“description”: “Optional: Whether to respect .gitignore patterns w… …y available in git repositories. Defaults to true.”
}
},
“required”: [
“pattern”
],
“additionalProperties”: false
}
}
},
{
“type”: “function”,
“function”: {
“name”: “replace”,
“description”: “Replaces text within a file. Replaces a single occ… …`old_string` in the file, the tool will also fail.”,
“parameters”: {
“type”: “object”,
“properties”: {
“file_path”: {
“type”: “string”,
“description”: “The absolute path to the file to modify. Must start with ‘/’.”
},
“instruction”: {
“type”: “string”,
“description”: “A clear, semantic instruction for the code change,… …ne." (Brittle, just repeats the other parameters)\n”
},
“old_string”: {
“type”: “string”,
“description”: “The exact literal text to replace, preferably unes… …it) or does not match exactly, the tool will fail.”
},
“new_string”: {
“type”: “string”,
“description”: “The exact literal text to replace `old_string` wit… …nsure the resulting code is correct and idiomatic.”
}
},
“required”: [
“file_path”,
“instruction”,
“old_string”,
“new_string”
],
“additionalProperties”: false
}
}
},
{
“type”: “function”,
“function”: {
“name”: “write_file”,
“description”: “Writes content to a specified file in the local fi… … If modified, this will be stated in the response.”,
“parameters”: {
“type”: “object”,
“properties”: {
“file_path”: {
“type”: “string”,
“description”: “The absolute path to the file to write to (e.g., ‘/home/user/project/file.txt’). Relative paths are not supported.”
},
“content”: {
“type”: “string”,
“description”: “The content to write to the file.”
}
},
“required”: [
“file_path”,
“content”
],
“additionalProperties”: false
}
}
},
{
“type”: “function”,
“function”: {
“name”: “xml_escape”,
“description”: “Automatically escapes special characters in XML/HT… …h characters need escaping based on their context.”,
“parameters”: {
“type”: “object”,
“properties”: {
“file_path”: {
“type”: “string”,
“description”: “The absolute path to the XML/HTML file to escape”
},
“escape_all”: {
“type”: “boolean”,
“description”: “If true, escapes all special characters. If false (default), only escapes characters in text content”
}
},
“required”: [
“file_path”
],
“additionalProperties”: false
}
}
},
{
“type”: “function”,
“function”: {
“name”: “web_fetch”,
“description”: “Processes content from URL(s), including local and… …specific data) directly in the ‘prompt’ parameter.”,
“parameters”: {
“type”: “object”,
“properties”: {
“prompt”: {
“type”: “string”,
“description”: “A comprehensive prompt that includes the URL(s) (u… …t least one URL starting with http:// or https://.”
}
},
“required”: [
“prompt”
],
“additionalProperties”: false
}
}
},
{
“type”: “function”,
“function”: {
“name”: “run_shell_command”,
“description”: “This tool executes a given shell command as `bash … …cess Group PGID: Process group started or `(none)`”,
“parameters”: {
“type”: “object”,
“properties”: {
“command”: {
“type”: “string”,
“description”: “Exact bash command to execute as `bash -c `”
},
“description”: {
“type”: “string”,
“description”: “Brief description of the command for the user. Be … … be up to 3 sentences for clarity. No line breaks.”
},
“run_in_bg”: {
“type”: “boolean”,
“description”: “Set to true to run this command in the background. Use BashOutput to read the output later.”
},
“dir_path”: {
“type”: “string”,
“description”: “(OPTIONAL) The path of the directory to run the co… …ctory within the workspace and must already exist.”
},
“timeout”: {
“type”: “number”,
“description”: “(OPTIONAL) Timeout in seconds for the command execution. If not provided, uses the default timeout of 120s.”
}
},
“required”: [
“command”
],
“additionalProperties”: false
}
}
},
{
“type”: “function”,
“function”: {
“name”: “ReadBashOutput”,
“description”: “Retrieves output from a running or completed task”,
“parameters”: {
“type”: “object”,
“properties”: {
“task_id”: {
“type”: “string”,
“description”: “The ID of a task to get output from”
},
“poll_interval”: {
“type”: “number”,
“description”: “Polling interval in seconds before next read (default: 10, max: 120)”
}
},
“required”: [
“task_id”
],
“additionalProperties”: false
}
}
},
{
“type”: “function”,
“function”: {
“name”: “save_memory”,
“description”: “\nSaves a specific piece of information or fact to … …", the fact would be “My favorite color is blue”.\n”,
“parameters”: {
“type”: “object”,
“properties”: {
“fact”: {
“type”: “string”,
“description”: “The specific fact or piece of information to remember. Should be a clear, self-contained statement.”
}
},
“required”: [
“fact”
],
“additionalProperties”: false
}
}
},
{
“type”: “function”,
“function”: {
“name”: “web_search”,
“description”: “Performs a web search using Web Search and returns… …ding information on the internet based on a query.”,
“parameters”: {
“type”: “object”,
“properties”: {
“query”: {
“type”: “string”,
“description”: “The search query to find information on the web.”
}
},
“required”: [
“query”
],
“additionalProperties”: false
}
}
},
{
“type”: “function”,
“function”: {
“name”: “todo_write”,
“description”: “Use this tool to create and manage a structured ta… …sures you complete all requirements successfully.\n”,
“parameters”: {
“type”: “object”,
“properties”: {
“todos”: {
“type”: “array”,
“description”: “The updated todo list”,
“items”: {
“type”: “object”,
“properties”: {
“id”: {
“type”: “string”,
“description”: “Unique identifier for the todo item”
},
“task”: {
“type”: “string”,
“description”: “The description of the todo”
},
“status”: {
“type”: “string”,
“description”: “Current status of the todo”,
“enum”: [
“pending”,
“in_progress”,
“completed”,
“failed”
]
},
“priority”: {
“type”: “string”,
“description”: “Priority level of the todo”,
“enum”: [
“high”,
“medium”,
“low”
]
}
},
“required”: [
“id”,
“task”,
“status”
],
“additionalProperties”: false
}
}
},
“required”: [
“todos”
],
“additionalProperties”: false
}
}
},
{
“type”: “function”,
“function”: {
“name”: “todo_read”,
“description”: “Use this tool to read the current to-do list for t… …no todos exist yet, an empty list will be returned”,
“parameters”: {
“type”: “object”,
“description”: “No input is required, leave this field blank. NOTE… … or a key like “input” or “empty”. LEAVE IT BLANK.”,
“additionalProperties”: false
}
}
},
{
“type”: “function”,
“function”: {
“name”: “task”,
“description”: “Launch a new agent to handle complex, multi-step t… …ith subagent_type: “greeting-responder”\n”,
“parameters”: {
“type”: “object”,
“properties”: {
“description”: {
“type”: “string”,
“description”: “A short (3-5 word) description of the task”
},
“prompt”: {
“type”: “string”,
“description”: “The task for the agent to perform”
},
“subagent_type”: {
“type”: “string”,
“description”: “The type of specialized agent to use for this task”
},
“useContext”: {
“type”: “boolean”,
“description”: “Whether to include the main agent’s context and prompt in the sub-agent request”
},
“outputFormat”: {
“type”: “string”,
“description”: “Optional output format template for the task result. If not provided, a default format will be used.”
},
“constraints”: {
“type”: “string”,
“description”: “Optional constraints or limitations for the task execution. Specify any restrictions or requirements.”
}
},
“required”: [
“description”,
“prompt”,
“subagent_type”
],
“additionalProperties”: false
}
}
},
{
“type”: “function”,
“function”: {
“name”: “exit_plan_mode”,
“description”: “\nUse this tool when you are in plan mode and have … …ed planning the implementation steps of the task.\n”,
“parameters”: {
“type”: “object”,
“properties”: {
“plan”: {
“type”: “string”,
“description”: “The plan you came up with, that you want to run by… …ports markdown. The plan should be pretty concise.”
}
},
“required”: [
“plan”
],
“additionalProperties”: false
}
}
},
{
“type”: “function”,
“function”: {
“name”: “ask_user_question”,
“description”: “Use this tool when you need to ask the user questi… …ow multiple answers to be selected for a question\n”,
“parameters”: {
“type”: “object”,
“properties”: {
“questions”: {
“type”: “array”,
“description”: “Questions to ask the user (1-4 questions)”,
“items”: {
“type”: “object”,
“properties”: {
“question”: {
“type”: “string”,
“description”: “The complete question to ask the user. Should be c… …ngly, e.g. “Which features do you want to enable?””
},
“header”: {
“type”: “string”,
“description”: “Very short label displayed as a chip/tag (max 12 chars). Examples: “Auth method”, “Library”, “Approach”.”
},
“options”: {
“type”: “array”,
“description”: “The available choices for this question. Must have… …ther’ option, that will be provided automatically.”,
“items”: {
“type”: “object”,
“properties”: {
“label”: {
“type”: “string”,
“description”: “The display text for this option that the user wil… …ncise (1-5 words) and clearly describe the choice.”
},
“description”: {
“type”: “string”,
“description”: “Explanation of what this option means or what will… …roviding context about trade-offs or implications.”
}
},
“required”: [
“label”,
“description”
],
“additionalProperties”: false
}
},
“multiSelect”: {
“type”: “boolean”,
“description”: “Set to true to allow the user to select multiple o… … one. Use when choices are not mutually exclusive.”
}
},
“required”: [
“question”,
“header”,
“options”,
“multiSelect”
],
“additionalProperties”: false
}
},
“answers”: {
“type”: “object”,
“description”: “User answers collected by the permission component”,
“additionalProperties”: false
}
},
“required”: [
“questions”
],
“additionalProperties”: false
}
}
}
]
}

您尝试一下能否解决:通过 settings.json 禁用故障工具

既然 todo_read 工具定义不规范,你可以利用文档中提到的 excludeTools 配置项将其排除掉。

  1. 找到你的配置文件(通常在 ~/.iflow/settings.json)。

  2. 在 JSON 中添加或修改 excludeTools 项:

json

{
"selectedAuthType": "openai-compatible",
"modelName": "你的模型名称",
"baseUrl": "http://localhost:1234/v1",
"apiKey": "lm-studio",
"excludeTools": ["todo_read"]
}

注:如果 todo_write 也报错(它属于同一组功能),可以写成 ["todo_read", "todo_write"]

1 个赞

是的,你提供的方法修改settings.json、禁用故障工具后,可以解决问题,使得iflow成功与地本地部署的模型对话。
然而,todo_read从功能上看是重要的按步执行任务调用工具,禁用了这个工具(包括其他系统工具,我猜想),iflow的agent功能就无法正常使用。iflow项目开发团队最好能修补这个bug。

2 个赞

好的,我们这就会排查一下问题