[GH-ISSUE #22240] issue: openai api native tool calling doesn't follow json schema #74276

Closed
opened 2026-05-13 06:59:11 -05:00 by GiteaMirror · 10 comments
Owner

Originally created by @pfn on GitHub (Mar 4, 2026).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/22240

Check Existing Issues

  • I have searched for any existing and/or related issues.
  • I have searched for any existing and/or related discussions.
  • I have also searched in the CLOSED issues AND CLOSED discussions and found no related items (your issue might already be addressed on the development branch!).
  • I am using the latest version of Open WebUI.

Installation Method

Git Clone

Open WebUI Version

v0.8.8

Ollama Version (if applicable)

No response

Operating System

linux

Browser (if applicable)

chrome

Confirmation

  • I have read and followed all instructions in README.md.
  • I am using the latest version of both Open WebUI and Ollama.
  • I have included the browser console logs.
  • I have included the Docker container logs.
  • I have provided every relevant configuration, setting, and environment variable used in my setup.
  • I have clearly listed every relevant configuration, custom setting, environment variable, and command-line option that influences my setup (such as Docker Compose overrides, .env values, browser settings, authentication configurations, etc).
  • I have documented step-by-step reproduction instructions that are precise, sequential, and leave nothing to interpretation. My steps:
  • Start with the initial platform/version/OS and dependencies used,
  • Specify exact install/launch/configure commands,
  • List URLs visited, user input (incl. example values/emails/passwords if needed),
  • Describe all options and toggles enabled or changed,
  • Include any files or environmental changes,
  • Identify the expected and actual result at each stage,
  • Ensure any reasonably skilled user can follow and hit the same issue.

Expected Behavior

Native tool calling should follow JSON schema specified at https://developers.openai.com/api/reference/python/resources/chat/subresources/completions/methods/create/

tool-role content should not be merged into assistant-role content, it must stay as separate tool role content. there are too many instances that the model does know recognize that it executed a tool due to the content merge.

related

Actual Behavior

Initial response to assistant tool_call is correct, openwebui sends back a tool-role message with the result. subsequent turns merge the tool-role content into the assistant-role content.

Steps to Reproduce

Edit backend/open_webui/routers/openai.py to log the final payload. Enable native tool calling, send a prompt requesting a tool call to run, observe the json payloads that occur. send a prompt acknowledging the tool result, observe the resulting json payloads

Logs & Screenshots

Prompt: generate a random image for me

Payload:

{
  "stream": true,
  "model": "Qwen3.5 Reasoning",
  "messages": [
    {
      "role": "system",
      "content": "# Core Guidelines:\n1. Stop confidently when uncertain - state clearly if you don't know\n2. Use available context properly - check context before answering\n3. Ask for clarification when needed - seek clarification rather than assuming\n4. Be transparent about limitations - explain when information isn't in context\n5. Use inline citations correctly - only when <source> has id attribute\n6. Be honest about uncertainties - don't pretend to know uncertain information\n7. Immediately acknowledge and accept user-provided corrections with reliable sources\n8. Never insist on incorrect information after being corrected by verified evidence\n9. Prioritize user-provided factual corrections over potentially conflicting search results\n10. When multiple sources conflict, default to the most recently provided verified information\n11. If a user provides specific source citations contradicting my response, recant and correct immediately\n12. Do not defend incorrect statements - replace them with corrected information\n13. When in doubt about factual accuracy after correction, ask for clarification rather than guessing\n14. When discussing or searching for contemporaneous information, be mindful that it is 2026-03-04\n15. When asked to draw a mermaid chart, output the mermaid code in markdown. Be mindful of colors and contrast ratios for visibility."
    },
    {
      "role": "user",
      "content": "generate a random image for me"
    }
  ],
  "tools": [
    {
      "type": "function",
      "function": {
        "name": "get_current_timestamp",
        "description": "Get the current Unix timestamp in seconds.",
        "parameters": {
          "properties": {},
          "type": "object"
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "calculate_timestamp",
        "description": "Get the current Unix timestamp, optionally adjusted by days, weeks, months, or years.\nUse this to calculate timestamps for date filtering in search functions.\nExamples: \"last week\" = weeks_ago=1, \"3 days ago\" = days_ago=3, \"a year ago\" = years_ago=1",
        "parameters": {
          "properties": {
            "days_ago": {
              "default": 0,
              "description": "Number of days to subtract from current time (default: 0)",
              "type": "integer"
            },
            "weeks_ago": {
              "default": 0,
              "description": "Number of weeks to subtract from current time (default: 0)",
              "type": "integer"
            },
            "months_ago": {
              "default": 0,
              "description": "Number of months to subtract from current time (default: 0)",
              "type": "integer"
            },
            "years_ago": {
              "default": 0,
              "description": "Number of years to subtract from current time (default: 0)",
              "type": "integer"
            }
          },
          "type": "object"
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "list_knowledge_bases",
        "description": "List the user's accessible knowledge bases.",
        "parameters": {
          "properties": {
            "count": {
              "default": 10,
              "description": "Maximum number of KBs to return (default: 10)",
              "type": "integer"
            },
            "skip": {
              "default": 0,
              "description": "Number of results to skip for pagination (default: 0)",
              "type": "integer"
            }
          },
          "type": "object"
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "search_knowledge_bases",
        "description": "Search the user's accessible knowledge bases by name and description.",
        "parameters": {
          "properties": {
            "query": {
              "description": "The search query to find matching knowledge bases",
              "type": "string"
            },
            "count": {
              "default": 5,
              "description": "Maximum number of results to return (default: 5)",
              "type": "integer"
            },
            "skip": {
              "default": 0,
              "description": "Number of results to skip for pagination (default: 0)",
              "type": "integer"
            }
          },
          "required": [
            "query"
          ],
          "type": "object"
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "query_knowledge_bases",
        "description": "Search knowledge bases by semantic similarity to query.\nFinds KBs whose name/description match the meaning of your query.\nUse this to discover relevant knowledge bases before querying their files.",
        "parameters": {
          "properties": {
            "query": {
              "description": "Natural language query describing what you're looking for",
              "type": "string"
            },
            "count": {
              "default": 5,
              "description": "Maximum results (default: 5)",
              "type": "integer"
            }
          },
          "required": [
            "query"
          ],
          "type": "object"
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "search_knowledge_files",
        "description": "Search files across knowledge bases the user has access to.",
        "parameters": {
          "properties": {
            "query": {
              "description": "The search query to find matching files by filename",
              "type": "string"
            },
            "knowledge_id": {
              "description": "Optional KB id to limit search to a specific knowledge base",
              "type": "string"
            },
            "count": {
              "default": 5,
              "description": "Maximum number of results to return (default: 5)",
              "type": "integer"
            },
            "skip": {
              "default": 0,
              "description": "Number of results to skip for pagination (default: 0)",
              "type": "integer"
            }
          },
          "required": [
            "query"
          ],
          "type": "object"
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "query_knowledge_files",
        "description": "Search knowledge base files using semantic/vector search. Searches across collections (KBs),\nindividual files, and notes that the user has access to.",
        "parameters": {
          "properties": {
            "query": {
              "description": "The search query to find semantically relevant content",
              "type": "string"
            },
            "knowledge_ids": {
              "description": "Optional list of KB ids to limit search to specific knowledge bases",
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            "count": {
              "default": 5,
              "description": "Maximum number of results to return (default: 5)",
              "type": "integer"
            }
          },
          "required": [
            "query"
          ],
          "type": "object"
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "view_knowledge_file",
        "description": "Get the full content of a file from a knowledge base.",
        "parameters": {
          "properties": {
            "file_id": {
              "description": "The ID of the file to retrieve",
              "type": "string"
            }
          },
          "required": [
            "file_id"
          ],
          "type": "object"
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "search_chats",
        "description": "Search the user's previous chat conversations by title and message content.",
        "parameters": {
          "properties": {
            "query": {
              "description": "The search query to find matching chats",
              "type": "string"
            },
            "count": {
              "default": 5,
              "description": "Maximum number of results to return (default: 5)",
              "type": "integer"
            },
            "start_timestamp": {
              "description": "Only include chats updated after this Unix timestamp (seconds)",
              "type": "integer"
            },
            "end_timestamp": {
              "description": "Only include chats updated before this Unix timestamp (seconds)",
              "type": "integer"
            }
          },
          "required": [
            "query"
          ],
          "type": "object"
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "view_chat",
        "description": "Get the full conversation history of a chat by its ID.",
        "parameters": {
          "properties": {
            "chat_id": {
              "description": "The ID of the chat to retrieve",
              "type": "string"
            }
          },
          "required": [
            "chat_id"
          ],
          "type": "object"
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "search_memories",
        "description": "Search the user's stored memories for relevant information.",
        "parameters": {
          "properties": {
            "query": {
              "description": "The search query to find relevant memories",
              "type": "string"
            },
            "count": {
              "default": 5,
              "description": "Number of memories to return (default 5)",
              "type": "integer"
            }
          },
          "required": [
            "query"
          ],
          "type": "object"
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "add_memory",
        "description": "Store a new memory for the user.",
        "parameters": {
          "properties": {
            "content": {
              "description": "The memory content to store",
              "type": "string"
            }
          },
          "required": [
            "content"
          ],
          "type": "object"
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "replace_memory_content",
        "description": "Update the content of an existing memory by its ID.",
        "parameters": {
          "properties": {
            "memory_id": {
              "description": "The ID of the memory to update",
              "type": "string"
            },
            "content": {
              "description": "The new content for the memory",
              "type": "string"
            }
          },
          "required": [
            "memory_id",
            "content"
          ],
          "type": "object"
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "delete_memory",
        "description": "Delete a memory by its ID.",
        "parameters": {
          "properties": {
            "memory_id": {
              "description": "The ID of the memory to delete",
              "type": "string"
            }
          },
          "required": [
            "memory_id"
          ],
          "type": "object"
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "list_memories",
        "description": "List all stored memories for the user.",
        "parameters": {
          "properties": {},
          "type": "object"
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "search_web",
        "description": "Search the public web for information. Best for current events, external references,\nor topics not covered in internal documents. If knowledge base tools are available,\nconsider checking those first for internal information.",
        "parameters": {
          "properties": {
            "query": {
              "description": "The search query to look up",
              "type": "string"
            },
            "count": {
              "default": 5,
              "description": "Number of results to return (default: 5)",
              "type": "integer"
            }
          },
          "required": [
            "query"
          ],
          "type": "object"
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "fetch_url",
        "description": "Fetch and extract the main text content from a web page URL.",
        "parameters": {
          "properties": {
            "url": {
              "description": "The URL to fetch content from",
              "type": "string"
            }
          },
          "required": [
            "url"
          ],
          "type": "object"
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "generate_image",
        "description": "Generate an image based on a text prompt.",
        "parameters": {
          "properties": {
            "prompt": {
              "description": "A detailed description of the image to generate",
              "type": "string"
            }
          },
          "required": [
            "prompt"
          ],
          "type": "object"
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "edit_image",
        "description": "Edit existing images based on a text prompt.",
        "parameters": {
          "properties": {
            "prompt": {
              "description": "A description of the changes to make to the images",
              "type": "string"
            },
            "image_urls": {
              "description": "A list of URLs of the images to edit",
              "items": {
                "type": "string"
              },
              "type": "array"
            }
          },
          "required": [
            "prompt",
            "image_urls"
          ],
          "type": "object"
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "search_notes",
        "description": "Search the user's notes by title and content.",
        "parameters": {
          "properties": {
            "query": {
              "description": "The search query to find matching notes",
              "type": "string"
            },
            "count": {
              "default": 5,
              "description": "Maximum number of results to return (default: 5)",
              "type": "integer"
            },
            "start_timestamp": {
              "description": "Only include notes updated after this Unix timestamp (seconds)",
              "type": "integer"
            },
            "end_timestamp": {
              "description": "Only include notes updated before this Unix timestamp (seconds)",
              "type": "integer"
            }
          },
          "required": [
            "query"
          ],
          "type": "object"
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "view_note",
        "description": "Get the full content of a note by its ID.",
        "parameters": {
          "properties": {
            "note_id": {
              "description": "The ID of the note to retrieve",
              "type": "string"
            }
          },
          "required": [
            "note_id"
          ],
          "type": "object"
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "write_note",
        "description": "Create a new note with the given title and content.",
        "parameters": {
          "properties": {
            "title": {
              "description": "The title of the new note",
              "type": "string"
            },
            "content": {
              "description": "The markdown content for the note",
              "type": "string"
            }
          },
          "required": [
            "title",
            "content"
          ],
          "type": "object"
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "replace_note_content",
        "description": "Update the content of a note. Use this to modify task lists, add notes, or update content.",
        "parameters": {
          "properties": {
            "note_id": {
              "description": "The ID of the note to update",
              "type": "string"
            },
            "content": {
              "description": "The new markdown content for the note",
              "type": "string"
            },
            "title": {
              "description": "Optional new title for the note",
              "type": "string"
            }
          },
          "required": [
            "note_id",
            "content"
          ],
          "type": "object"
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "search_channels",
        "description": "Search for channels by name and description that the user has access to.",
        "parameters": {
          "properties": {
            "query": {
              "description": "The search query to find matching channels",
              "type": "string"
            },
            "count": {
              "default": 5,
              "description": "Maximum number of results to return (default: 5)",
              "type": "integer"
            }
          },
          "required": [
            "query"
          ],
          "type": "object"
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "search_channel_messages",
        "description": "Search for messages in channels the user is a member of, including thread replies.",
        "parameters": {
          "properties": {
            "query": {
              "description": "The search query to find matching messages",
              "type": "string"
            },
            "count": {
              "default": 10,
              "description": "Maximum number of results to return (default: 10)",
              "type": "integer"
            },
            "start_timestamp": {
              "description": "Only include messages created after this Unix timestamp (seconds)",
              "type": "integer"
            },
            "end_timestamp": {
              "description": "Only include messages created before this Unix timestamp (seconds)",
              "type": "integer"
            }
          },
          "required": [
            "query"
          ],
          "type": "object"
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "view_channel_thread",
        "description": "Get all messages in a channel thread, including the parent message and all replies.",
        "parameters": {
          "properties": {
            "parent_message_id": {
              "description": "The ID of the parent message that started the thread",
              "type": "string"
            }
          },
          "required": [
            "parent_message_id"
          ],
          "type": "object"
        }
      }
    },
    {
      "type": "function",
      "function": {
        "name": "view_channel_message",
        "description": "Get the full content of a channel message by its ID, including thread replies.",
        "parameters": {
          "properties": {
            "message_id": {
              "description": "The ID of the message to retrieve",
              "type": "string"
            }
          },
          "required": [
            "message_id"
          ],
          "type": "object"
        }
      }
    }
  ]
}

Sent to endpoint for toolcall result (correct):

{
  "stream": true,
  "model": "Qwen3.5 Reasoning",
  "messages": [
    {
      "role": "system",
      "content": "# Core Guidelines:\n1. Stop confidently when uncertain - state clearly if you don't know\n2. Use available context properly - check context before answering\n3. Ask for clarification when needed - seek clarification rather than assuming\n4. Be transparent about limitations - explain when information isn't in context\n5. Use inline citations correctly - only when <source> has id attribute\n6. Be honest about uncertainties - don't pretend to know uncertain information\n7. Immediately acknowledge and accept user-provided corrections with reliable sources\n8. Never insist on incorrect information after being corrected by verified evidence\n9. Prioritize user-provided factual corrections over potentially conflicting search results\n10. When multiple sources conflict, default to the most recently provided verified information\n11. If a user provides specific source citations contradicting my response, recant and correct immediately\n12. Do not defend incorrect statements - replace them with corrected information\n13. When in doubt about factual accuracy after correction, ask for clarification rather than guessing\n14. When discussing or searching for contemporaneous information, be mindful that it is 2026-03-04\n15. When asked to draw a mermaid chart, output the mermaid code in markdown. Be mindful of colors and contrast ratios for visibility."
    },
    {
      "role": "user",
      "content": "generate a random image for me"
    },
    {
      "role": "assistant",
      "content": "<think>The user wants me to generate a random image. I have access to a generate_image function that requires a prompt parameter. Since they want something \"random\", I should create an interesting, varied prompt that will produce an appealing image without them specifying exactly what they want.\n\nI'll create a diverse, visually interesting prompt that could work well for image generation.</think>",
      "tool_calls": [
        {
          "id": "6RSzJjobNgURxVkxCZbyJO1VoucWDGB3",
          "type": "function",
          "function": {
            "name": "generate_image",
            "arguments": "{\"prompt\": \"A vibrant sunset over a mountain lake with colorful reflections in the water, fluffy clouds in the orange and purple sky, pine trees silhouetted against the horizon, peaceful and serene landscape photography style\"}"
          }
        }
      ]
    },
    {
      "role": "tool",
      "tool_call_id": "6RSzJjobNgURxVkxCZbyJO1VoucWDGB3",
      "content": "{\"status\": \"success\", \"images\": [{\"url\": \"/api/v1/files/b6738ed8-6fe1-47b9-a4be-57a78aaa5f25/content\"}]}"
    }
  ],
  "tools": [
  ... snip ...
  ]
}

My prompt: do a random web search, only tell me the number of results found, summarizing is unnecessary

{
  "stream": true,
  "model": "Qwen3.5 Reasoning",
  "messages": [
    {
      "role": "system",
      "content": "# Core Guidelines:\n1. Stop confidently when uncertain - state clearly if you don't know\n2. Use available context properly - check context before answering\n3. Ask for clarification when needed - seek clarification rather than assuming\n4. Be transparent about limitations - explain when information isn't in context\n5. Use inline citations correctly - only when <source> has id attribute\n6. Be honest about uncertainties - don't pretend to know uncertain information\n7. Immediately acknowledge and accept user-provided corrections with reliable sources\n8. Never insist on incorrect information after being corrected by verified evidence\n9. Prioritize user-provided factual corrections over potentially conflicting search results\n10. When multiple sources conflict, default to the most recently provided verified information\n11. If a user provides specific source citations contradicting my response, recant and correct immediately\n12. Do not defend incorrect statements - replace them with corrected information\n13. When in doubt about factual accuracy after correction, ask for clarification rather than guessing\n14. When discussing or searching for contemporaneous information, be mindful that it is 2026-03-04\n15. When asked to draw a mermaid chart, output the mermaid code in markdown. Be mindful of colors and contrast ratios for visibility."
    },
    {
      "role": "user",
      "content": "generate a random image for me"
    },
    {
      "role": "assistant",
      "content": "\n\"{\\\"status\\\": \\\"success\\\", \\\"images\\\": [{\\\"url\\\": \\\"/api/v1/files/b6738ed8-6fe1-47b9-a4be-57a78aaa5f25/content\\\"}]}\"\n\nI've generated a random image for you! It's a beautiful landscape featuring:\n\n- A vibrant sunset over a mountain lake\n- Colorful reflections in the water\n- Orange and purple clouds in the sky\n- Silhouetted pine trees against the horizon\n- Peaceful, serene photography style\n\nYou can view the image here: `/api/v1/files/b6738ed8-6fe1-47b9-a4be-57a78aaa5f25/content`\n\nIf you'd like me to generate something different, just let me know what type of scene or subject you prefer!"
    },
    {
      "role": "user",
      "content": "do a random web search, only tell me the number of results found, summarizing is unnecessary"
    }
  ],
  "tools": [
  ... snip ...
  ]
}

Sent to endpoint for acknowledging toolcall result:

{
  "stream": true,
  "model": "Qwen3.5 Reasoning",
  "messages": [
    {
      "role": "system",
      "content": "# Core Guidelines:\n1. Stop confidently when uncertain - state clearly if you don't know\n2. Use available context properly - check context before answering\n3. Ask for clarification when needed - seek clarification rather than assuming\n4. Be transparent about limitations - explain when information isn't in context\n5. Use inline citations correctly - only when <source> has id attribute\n6. Be honest about uncertainties - don't pretend to know uncertain information\n7. Immediately acknowledge and accept user-provided corrections with reliable sources\n8. Never insist on incorrect information after being corrected by verified evidence\n9. Prioritize user-provided factual corrections over potentially conflicting search results\n10. When multiple sources conflict, default to the most recently provided verified information\n11. If a user provides specific source citations contradicting my response, recant and correct immediately\n12. Do not defend incorrect statements - replace them with corrected information\n13. When in doubt about factual accuracy after correction, ask for clarification rather than guessing\n14. When discussing or searching for contemporaneous information, be mindful that it is 2026-03-04\n15. When asked to draw a mermaid chart, output the mermaid code in markdown. Be mindful of colors and contrast ratios for visibility."
    },
    {
      "role": "user",
      "content": "generate a random image for me"
    },
    {
      "role": "assistant",
      "content": "\n\"{\\\"status\\\": \\\"success\\\", \\\"images\\\": [{\\\"url\\\": \\\"/api/v1/files/b6738ed8-6fe1-47b9-a4be-57a78aaa5f25/content\\\"}]}\"\n\nI've generated a random image for you! It's a beautiful landscape featuring:\n\n- A vibrant sunset over a mountain lake\n- Colorful reflections in the water\n- Orange and purple clouds in the sky\n- Silhouetted pine trees against the horizon\n- Peaceful, serene photography style\n\nYou can view the image here: `/api/v1/files/b6738ed8-6fe1-47b9-a4be-57a78aaa5f25/content`\n\nIf you'd like me to generate something different, just let me know what type of scene or subject you prefer!"
    },
    {
      "role": "user",
      "content": "### Task:\nRespond to the user query using the provided context, incorporating inline citations in the format [id] **only when the <source> tag includes an explicit id attribute** (e.g., <source id=\"1\">).\n\n### Guidelines:\n- If you don't know the answer, clearly state that.\n- If uncertain, ask the user for clarification.\n- Respond in the same language as the user's query.\n- If the context is unreadable or of poor quality, inform the user and provide the best possible answer.\n- If the answer isn't present in the context but you possess the knowledge, explain this to the user and provide the answer using your own understanding.\n- **Only include inline citations using [id] (e.g., [1], [2]) when the <source> tag includes an id attribute.**\n- Do not cite if the <source> tag does not contain an id attribute.\n- Do not use XML tags in your response.\n- Ensure citations are concise and directly related to the information provided.\n\n### Example of Citation:\nIf the user asks about a specific topic and the information is found in a source with a provided id attribute, the response should include the citation like in the following example:\n* \"According to the study, the proposed method increases efficiency by 20% [1].\"\n\n### Output:\nProvide a clear and direct response to the user's query, including inline citations in the format [id] only when the <source> tag with id attribute is present in the context.\n\n<context>\n<source id=\"1\" name=\"search_web\"></source>\n<source id=\"2\" name=\"search_web\"></source>\n<source id=\"3\" name=\"search_web\"></source>\n<source id=\"4\" name=\"search_web\"></source>\n<source id=\"5\" name=\"search_web\"></source>\n<source id=\"6\" name=\"search_web\"></source>\n<source id=\"7\" name=\"search_web\"></source>\n<source id=\"8\" name=\"search_web\"></source>\n<source id=\"9\" name=\"search_web\"></source>\n<source id=\"10\" name=\"search_web\"></source>\n</context>\n\ndo a random web search, only tell me the number of results found, summarizing is unnecessary"
    },
    {
      "role": "assistant",
      "content": "<think>The user wants me to do a random web search and only tell them the number of results found. They explicitly said not to summarize anything. I need to:\n\n1. Do a web search with a random query\n2. Only report back the number of results, nothing else\n\nLet me do a simple random web search - I'll search for something general like \"technology\" or just pick a random topic.</think>",
      "tool_calls": [
        {
          "id": "jepeqoBU3hiOenATvmxREAaUsSXHZKVD",
          "type": "function",
          "function": {
            "name": "search_web",
            "arguments": "{\"query\": \"technology\", \"count\": 5}"
          }
        }
      ]
    },
    {
      "role": "tool",
      "tool_call_id": "jepeqoBU3hiOenATvmxREAaUsSXHZKVD",
      "content": "[{\"title\": \"Technology - Wikipedia\", \"link\": \"https://en.wikipedia.org/wiki/Technology\", \"snippet\": \"Technology is <strong>the application of conceptual knowledge to achieve practical goals, especially in a reproducible way</strong>. The word technology can also mean the products resulting from such efforts, including both tangible tools such as utensils or machines, and intangible ones such as software.\"}, {\"title\": \"Technology | Definition, Examples, Types, & Facts | Britannica\", \"link\": \"https://www.britannica.com/technology/technology\", \"snippet\": \"Technology is <strong>the application of scientific knowledge to the practical aims of human life</strong> or, as it is sometimes phrased, to the change manipulation of the human environment. From hand tools to computers and engineering, technology encompasses ...\"}, {\"title\": \"What is Technology? | IIASA\", \"link\": \"https://iiasa.ac.at/what-is-technology\", \"snippet\": \"Few countries changed their standard from left- to right-hand-side driving because of the costs involved. (Austria and Italy even maintained both standards for a transitional period in the 1920s and 1930s). Technology systems frequently &quot;lock-in&quot; early-on in particular configurations that subsequently may turn out to be suboptimal.\"}, {\"title\": \"Technology\", \"link\": \"https://www.directives.doe.gov/terms_definitions/technology\", \"snippet\": \"Technology is derived from basic or applied research, development, engineering, technological demonstration, economic and social research, or scientific inquiry into phenomena or <strong>technology</strong> applications.\"}, {\"title\": \"Reuters Tech News | Today's Latest Technology News | Reuters\", \"link\": \"https://www.reuters.com/technology/\", \"snippet\": \"TechnologycategoryCrowdStrike forecasts fiscal 2027 revenue above estimates on cybersecurity tools demand\"}, {\"title\": \"BBC Technology | Technology, Health, Environment, AI\", \"link\": \"https://www.bbc.com/technology\", \"snippet\": \"BBC Technology brings you the latest in Technology news and coverage from around the world, including health, environment, AI, and more\"}, {\"title\": \"TECHNOLOGY Definition & Meaning - Merriam-Webster\", \"link\": \"https://www.merriam-webster.com/dictionary/technology\", \"snippet\": \"The meaning of TECHNOLOGY is <strong>the practical application of scientific knowledge especially in a particular area</strong> : engineering. How to use technology in a sentence.\"}, {\"title\": \"MIT Technology Review\", \"link\": \"https://www.technologyreview.com/\", \"snippet\": \"Emerging <strong>technology</strong> news &amp; insights | AI, Climate Change, BioTech, and more\"}, {\"title\": \"Technology: The Good, The Bad, The Ugly\", \"link\": \"https://www.uagrantham.edu/blog/technology-the-good-the-bad-the-ugly/\", \"snippet\": \"That also means we don\u2019t have to relinquish many of our routines, no matter what else is going on in the world. Technology allows us to keep working, communicating, going to school, shopping, going to doctor or therapy appointments, playing games, and staying aware of current events.\"}, {\"title\": \"Technology - The New York Times\", \"link\": \"https://www.nytimes.com/section/technology\", \"snippet\": \"Technology industry news, commentary and analysis, with reporting on big tech, startups, and internet culture.\"}]"
    }
  ],
  "tools": [
  ... snip ...
  ]
}

Prompt: ok (last message to illustrate that tool content is getting collapsed into assistant)

{
  "stream": true,
  "model": "Qwen3.5 Reasoning",
  "messages": [
    {
      "role": "system",
      "content": "# Core Guidelines:\n1. Stop confidently when uncertain - state clearly if you don't know\n2. Use available context properly - check context before answering\n3. Ask for clarification when needed - seek clarification rather than assuming\n4. Be transparent about limitations - explain when information isn't in context\n5. Use inline citations correctly - only when <source> has id attribute\n6. Be honest about uncertainties - don't pretend to know uncertain information\n7. Immediately acknowledge and accept user-provided corrections with reliable sources\n8. Never insist on incorrect information after being corrected by verified evidence\n9. Prioritize user-provided factual corrections over potentially conflicting search results\n10. When multiple sources conflict, default to the most recently provided verified information\n11. If a user provides specific source citations contradicting my response, recant and correct immediately\n12. Do not defend incorrect statements - replace them with corrected information\n13. When in doubt about factual accuracy after correction, ask for clarification rather than guessing\n14. When discussing or searching for contemporaneous information, be mindful that it is 2026-03-04\n15. When asked to draw a mermaid chart, output the mermaid code in markdown. Be mindful of colors and contrast ratios for visibility."
    },
    {
      "role": "user",
      "content": "generate a random image for me"
    },
    {
      "role": "assistant",
      "content": "\n\"{\\\"status\\\": \\\"success\\\", \\\"images\\\": [{\\\"url\\\": \\\"/api/v1/files/b6738ed8-6fe1-47b9-a4be-57a78aaa5f25/content\\\"}]}\"\n\nI've generated a random image for you! It's a beautiful landscape featuring:\n\n- A vibrant sunset over a mountain lake\n- Colorful reflections in the water\n- Orange and purple clouds in the sky\n- Silhouetted pine trees against the horizon\n- Peaceful, serene photography style\n\nYou can view the image here: `/api/v1/files/b6738ed8-6fe1-47b9-a4be-57a78aaa5f25/content`\n\nIf you'd like me to generate something different, just let me know what type of scene or subject you prefer!"
    },
    {
      "role": "user",
      "content": "do a random web search, only tell me the number of results found, summarizing is unnecessary"
    },
    {
      "role": "assistant",
      "content": "\n\"[{\\\"title\\\": \\\"Technology - Wikipedia\\\", \\\"link\\\": \\\"https://en.wikipedia.org/wiki/Technology\\\", \\\"snippet\\\": \\\"Technology is <strong>the application of conceptual knowledge to achieve practical goals, especially in a reproducible way</strong>. The word technology can also mean the products resulting from such efforts, including both tangible tools such as utensils or machines, and intangible ones such as software.\\\"}, {\\\"title\\\": \\\"Technology | Definition, Examples, Types, & Facts | Britannica\\\", \\\"link\\\": \\\"https://www.britannica.com/technology/technology\\\", \\\"snippet\\\": \\\"Technology is <strong>the application of scientific knowledge to the practical aims of human life</strong> or, as it is sometimes phrased, to the change manipulation of the human environment. From hand tools to computers and engineering, technology encompasses ...\\\"}, {\\\"title\\\": \\\"What is Technology? | IIASA\\\", \\\"link\\\": \\\"https://iiasa.ac.at/what-is-technology\\\", \\\"snippet\\\": \\\"Few countries changed their standard from left- to right-hand-side driving because of the costs involved. (Austria and Italy even maintained both standards for a transitional period in the 1920s and 1930s). Technology systems frequently &quot;lock-in&quot; early-on in particular configurations that subsequently may turn out to be suboptimal.\\\"}, {\\\"title\\\": \\\"Technology\\\", \\\"link\\\": \\\"https://www.directives.doe.gov/terms_definitions/technology\\\", \\\"snippet\\\": \\\"Technology is derived from basic or applied research, development, engineering, technological demonstration, economic and social research, or scientific inquiry into phenomena or <strong>technology</strong> applications.\\\"}, {\\\"title\\\": \\\"Reuters Tech News | Today's Latest Technology News | Reuters\\\", \\\"link\\\": \\\"https://www.reuters.com/technology/\\\", \\\"snippet\\\": \\\"TechnologycategoryCrowdStrike forecasts fiscal 2027 revenue above estimates on cybersecurity tools demand\\\"}, {\\\"title\\\": \\\"BBC Technology | Technology, Health, Environment, AI\\\", \\\"link\\\": \\\"https://www.bbc.com/technology\\\", \\\"snippet\\\": \\\"BBC Technology brings you the latest in Technology news and coverage from around the world, including health, environment, AI, and more\\\"}, {\\\"title\\\": \\\"TECHNOLOGY Definition & Meaning - Merriam-Webster\\\", \\\"link\\\": \\\"https://www.merriam-webster.com/dictionary/technology\\\", \\\"snippet\\\": \\\"The meaning of TECHNOLOGY is <strong>the practical application of scientific knowledge especially in a particular area</strong> : engineering. How to use technology in a sentence.\\\"}, {\\\"title\\\": \\\"MIT Technology Review\\\", \\\"link\\\": \\\"https://www.technologyreview.com/\\\", \\\"snippet\\\": \\\"Emerging <strong>technology</strong> news &amp; insights | AI, Climate Change, BioTech, and more\\\"}, {\\\"title\\\": \\\"Technology: The Good, The Bad, The Ugly\\\", \\\"link\\\": \\\"https://www.uagrantham.edu/blog/technology-the-good-the-bad-the-ugly/\\\", \\\"snippet\\\": \\\"That also means we don\u2019t have to relinquish many of our routines, no matter what else is going on in the world. Technology allows us to keep working, communicating, going to school, shopping, going to doctor or therapy appointments, playing games, and staying aware of current events.\\\"}, {\\\"title\\\": \\\"Technology - The New York Times\\\", \\\"link\\\": \\\"https://www.nytimes.com/section/technology\\\", \\\"snippet\\\": \\\"Technology industry news, commentary and analysis, with reporting on big tech, startups, and internet culture.\\\"}]\"\n\n10 results found."
    },
    {
      "role": "user",
      "content": "ok"
    }
  ],
  "tools": [
  ... snip ...
  ]
}

Additional Information

To be clear, the issue here is that merging the tool content down into the assistant content is that it is essentially pre-filling the assistant response: breaking context cache, and making the model think that it output that information rather than a tool.

Originally created by @pfn on GitHub (Mar 4, 2026). Original GitHub issue: https://github.com/open-webui/open-webui/issues/22240 ### Check Existing Issues - [x] I have searched for any existing and/or related issues. - [x] I have searched for any existing and/or related discussions. - [x] I have also searched in the CLOSED issues AND CLOSED discussions and found no related items (your issue might already be addressed on the development branch!). - [x] I am using the latest version of Open WebUI. ### Installation Method Git Clone ### Open WebUI Version v0.8.8 ### Ollama Version (if applicable) _No response_ ### Operating System linux ### Browser (if applicable) chrome ### Confirmation - [x] I have read and followed all instructions in `README.md`. - [x] I am using the latest version of **both** Open WebUI and Ollama. - [x] I have included the browser console logs. - [x] I have included the Docker container logs. - [x] I have **provided every relevant configuration, setting, and environment variable used in my setup.** - [x] I have clearly **listed every relevant configuration, custom setting, environment variable, and command-line option that influences my setup** (such as Docker Compose overrides, .env values, browser settings, authentication configurations, etc). - [x] I have documented **step-by-step reproduction instructions that are precise, sequential, and leave nothing to interpretation**. My steps: - Start with the initial platform/version/OS and dependencies used, - Specify exact install/launch/configure commands, - List URLs visited, user input (incl. example values/emails/passwords if needed), - Describe all options and toggles enabled or changed, - Include any files or environmental changes, - Identify the expected and actual result at each stage, - Ensure any reasonably skilled user can follow and hit the same issue. ### Expected Behavior Native tool calling should follow JSON schema specified at https://developers.openai.com/api/reference/python/resources/chat/subresources/completions/methods/create/ tool-role content should not be merged into assistant-role content, it must stay as separate tool role content. there are too many instances that the model does know recognize that it executed a tool due to the content merge. related * categorized as a feature, and has no traction https://github.com/open-webui/open-webui/issues/16829 * older related discussion https://github.com/open-webui/open-webui/discussions/18442 ### Actual Behavior Initial response to assistant tool_call is correct, openwebui sends back a tool-role message with the result. subsequent turns merge the tool-role content into the assistant-role content. ### Steps to Reproduce Edit backend/open_webui/routers/openai.py to log the final payload. Enable native tool calling, send a prompt requesting a tool call to run, observe the json payloads that occur. send a prompt acknowledging the tool result, observe the resulting json payloads ### Logs & Screenshots Prompt: generate a random image for me Payload: ``` { "stream": true, "model": "Qwen3.5 Reasoning", "messages": [ { "role": "system", "content": "# Core Guidelines:\n1. Stop confidently when uncertain - state clearly if you don't know\n2. Use available context properly - check context before answering\n3. Ask for clarification when needed - seek clarification rather than assuming\n4. Be transparent about limitations - explain when information isn't in context\n5. Use inline citations correctly - only when <source> has id attribute\n6. Be honest about uncertainties - don't pretend to know uncertain information\n7. Immediately acknowledge and accept user-provided corrections with reliable sources\n8. Never insist on incorrect information after being corrected by verified evidence\n9. Prioritize user-provided factual corrections over potentially conflicting search results\n10. When multiple sources conflict, default to the most recently provided verified information\n11. If a user provides specific source citations contradicting my response, recant and correct immediately\n12. Do not defend incorrect statements - replace them with corrected information\n13. When in doubt about factual accuracy after correction, ask for clarification rather than guessing\n14. When discussing or searching for contemporaneous information, be mindful that it is 2026-03-04\n15. When asked to draw a mermaid chart, output the mermaid code in markdown. Be mindful of colors and contrast ratios for visibility." }, { "role": "user", "content": "generate a random image for me" } ], "tools": [ { "type": "function", "function": { "name": "get_current_timestamp", "description": "Get the current Unix timestamp in seconds.", "parameters": { "properties": {}, "type": "object" } } }, { "type": "function", "function": { "name": "calculate_timestamp", "description": "Get the current Unix timestamp, optionally adjusted by days, weeks, months, or years.\nUse this to calculate timestamps for date filtering in search functions.\nExamples: \"last week\" = weeks_ago=1, \"3 days ago\" = days_ago=3, \"a year ago\" = years_ago=1", "parameters": { "properties": { "days_ago": { "default": 0, "description": "Number of days to subtract from current time (default: 0)", "type": "integer" }, "weeks_ago": { "default": 0, "description": "Number of weeks to subtract from current time (default: 0)", "type": "integer" }, "months_ago": { "default": 0, "description": "Number of months to subtract from current time (default: 0)", "type": "integer" }, "years_ago": { "default": 0, "description": "Number of years to subtract from current time (default: 0)", "type": "integer" } }, "type": "object" } } }, { "type": "function", "function": { "name": "list_knowledge_bases", "description": "List the user's accessible knowledge bases.", "parameters": { "properties": { "count": { "default": 10, "description": "Maximum number of KBs to return (default: 10)", "type": "integer" }, "skip": { "default": 0, "description": "Number of results to skip for pagination (default: 0)", "type": "integer" } }, "type": "object" } } }, { "type": "function", "function": { "name": "search_knowledge_bases", "description": "Search the user's accessible knowledge bases by name and description.", "parameters": { "properties": { "query": { "description": "The search query to find matching knowledge bases", "type": "string" }, "count": { "default": 5, "description": "Maximum number of results to return (default: 5)", "type": "integer" }, "skip": { "default": 0, "description": "Number of results to skip for pagination (default: 0)", "type": "integer" } }, "required": [ "query" ], "type": "object" } } }, { "type": "function", "function": { "name": "query_knowledge_bases", "description": "Search knowledge bases by semantic similarity to query.\nFinds KBs whose name/description match the meaning of your query.\nUse this to discover relevant knowledge bases before querying their files.", "parameters": { "properties": { "query": { "description": "Natural language query describing what you're looking for", "type": "string" }, "count": { "default": 5, "description": "Maximum results (default: 5)", "type": "integer" } }, "required": [ "query" ], "type": "object" } } }, { "type": "function", "function": { "name": "search_knowledge_files", "description": "Search files across knowledge bases the user has access to.", "parameters": { "properties": { "query": { "description": "The search query to find matching files by filename", "type": "string" }, "knowledge_id": { "description": "Optional KB id to limit search to a specific knowledge base", "type": "string" }, "count": { "default": 5, "description": "Maximum number of results to return (default: 5)", "type": "integer" }, "skip": { "default": 0, "description": "Number of results to skip for pagination (default: 0)", "type": "integer" } }, "required": [ "query" ], "type": "object" } } }, { "type": "function", "function": { "name": "query_knowledge_files", "description": "Search knowledge base files using semantic/vector search. Searches across collections (KBs),\nindividual files, and notes that the user has access to.", "parameters": { "properties": { "query": { "description": "The search query to find semantically relevant content", "type": "string" }, "knowledge_ids": { "description": "Optional list of KB ids to limit search to specific knowledge bases", "items": { "type": "string" }, "type": "array" }, "count": { "default": 5, "description": "Maximum number of results to return (default: 5)", "type": "integer" } }, "required": [ "query" ], "type": "object" } } }, { "type": "function", "function": { "name": "view_knowledge_file", "description": "Get the full content of a file from a knowledge base.", "parameters": { "properties": { "file_id": { "description": "The ID of the file to retrieve", "type": "string" } }, "required": [ "file_id" ], "type": "object" } } }, { "type": "function", "function": { "name": "search_chats", "description": "Search the user's previous chat conversations by title and message content.", "parameters": { "properties": { "query": { "description": "The search query to find matching chats", "type": "string" }, "count": { "default": 5, "description": "Maximum number of results to return (default: 5)", "type": "integer" }, "start_timestamp": { "description": "Only include chats updated after this Unix timestamp (seconds)", "type": "integer" }, "end_timestamp": { "description": "Only include chats updated before this Unix timestamp (seconds)", "type": "integer" } }, "required": [ "query" ], "type": "object" } } }, { "type": "function", "function": { "name": "view_chat", "description": "Get the full conversation history of a chat by its ID.", "parameters": { "properties": { "chat_id": { "description": "The ID of the chat to retrieve", "type": "string" } }, "required": [ "chat_id" ], "type": "object" } } }, { "type": "function", "function": { "name": "search_memories", "description": "Search the user's stored memories for relevant information.", "parameters": { "properties": { "query": { "description": "The search query to find relevant memories", "type": "string" }, "count": { "default": 5, "description": "Number of memories to return (default 5)", "type": "integer" } }, "required": [ "query" ], "type": "object" } } }, { "type": "function", "function": { "name": "add_memory", "description": "Store a new memory for the user.", "parameters": { "properties": { "content": { "description": "The memory content to store", "type": "string" } }, "required": [ "content" ], "type": "object" } } }, { "type": "function", "function": { "name": "replace_memory_content", "description": "Update the content of an existing memory by its ID.", "parameters": { "properties": { "memory_id": { "description": "The ID of the memory to update", "type": "string" }, "content": { "description": "The new content for the memory", "type": "string" } }, "required": [ "memory_id", "content" ], "type": "object" } } }, { "type": "function", "function": { "name": "delete_memory", "description": "Delete a memory by its ID.", "parameters": { "properties": { "memory_id": { "description": "The ID of the memory to delete", "type": "string" } }, "required": [ "memory_id" ], "type": "object" } } }, { "type": "function", "function": { "name": "list_memories", "description": "List all stored memories for the user.", "parameters": { "properties": {}, "type": "object" } } }, { "type": "function", "function": { "name": "search_web", "description": "Search the public web for information. Best for current events, external references,\nor topics not covered in internal documents. If knowledge base tools are available,\nconsider checking those first for internal information.", "parameters": { "properties": { "query": { "description": "The search query to look up", "type": "string" }, "count": { "default": 5, "description": "Number of results to return (default: 5)", "type": "integer" } }, "required": [ "query" ], "type": "object" } } }, { "type": "function", "function": { "name": "fetch_url", "description": "Fetch and extract the main text content from a web page URL.", "parameters": { "properties": { "url": { "description": "The URL to fetch content from", "type": "string" } }, "required": [ "url" ], "type": "object" } } }, { "type": "function", "function": { "name": "generate_image", "description": "Generate an image based on a text prompt.", "parameters": { "properties": { "prompt": { "description": "A detailed description of the image to generate", "type": "string" } }, "required": [ "prompt" ], "type": "object" } } }, { "type": "function", "function": { "name": "edit_image", "description": "Edit existing images based on a text prompt.", "parameters": { "properties": { "prompt": { "description": "A description of the changes to make to the images", "type": "string" }, "image_urls": { "description": "A list of URLs of the images to edit", "items": { "type": "string" }, "type": "array" } }, "required": [ "prompt", "image_urls" ], "type": "object" } } }, { "type": "function", "function": { "name": "search_notes", "description": "Search the user's notes by title and content.", "parameters": { "properties": { "query": { "description": "The search query to find matching notes", "type": "string" }, "count": { "default": 5, "description": "Maximum number of results to return (default: 5)", "type": "integer" }, "start_timestamp": { "description": "Only include notes updated after this Unix timestamp (seconds)", "type": "integer" }, "end_timestamp": { "description": "Only include notes updated before this Unix timestamp (seconds)", "type": "integer" } }, "required": [ "query" ], "type": "object" } } }, { "type": "function", "function": { "name": "view_note", "description": "Get the full content of a note by its ID.", "parameters": { "properties": { "note_id": { "description": "The ID of the note to retrieve", "type": "string" } }, "required": [ "note_id" ], "type": "object" } } }, { "type": "function", "function": { "name": "write_note", "description": "Create a new note with the given title and content.", "parameters": { "properties": { "title": { "description": "The title of the new note", "type": "string" }, "content": { "description": "The markdown content for the note", "type": "string" } }, "required": [ "title", "content" ], "type": "object" } } }, { "type": "function", "function": { "name": "replace_note_content", "description": "Update the content of a note. Use this to modify task lists, add notes, or update content.", "parameters": { "properties": { "note_id": { "description": "The ID of the note to update", "type": "string" }, "content": { "description": "The new markdown content for the note", "type": "string" }, "title": { "description": "Optional new title for the note", "type": "string" } }, "required": [ "note_id", "content" ], "type": "object" } } }, { "type": "function", "function": { "name": "search_channels", "description": "Search for channels by name and description that the user has access to.", "parameters": { "properties": { "query": { "description": "The search query to find matching channels", "type": "string" }, "count": { "default": 5, "description": "Maximum number of results to return (default: 5)", "type": "integer" } }, "required": [ "query" ], "type": "object" } } }, { "type": "function", "function": { "name": "search_channel_messages", "description": "Search for messages in channels the user is a member of, including thread replies.", "parameters": { "properties": { "query": { "description": "The search query to find matching messages", "type": "string" }, "count": { "default": 10, "description": "Maximum number of results to return (default: 10)", "type": "integer" }, "start_timestamp": { "description": "Only include messages created after this Unix timestamp (seconds)", "type": "integer" }, "end_timestamp": { "description": "Only include messages created before this Unix timestamp (seconds)", "type": "integer" } }, "required": [ "query" ], "type": "object" } } }, { "type": "function", "function": { "name": "view_channel_thread", "description": "Get all messages in a channel thread, including the parent message and all replies.", "parameters": { "properties": { "parent_message_id": { "description": "The ID of the parent message that started the thread", "type": "string" } }, "required": [ "parent_message_id" ], "type": "object" } } }, { "type": "function", "function": { "name": "view_channel_message", "description": "Get the full content of a channel message by its ID, including thread replies.", "parameters": { "properties": { "message_id": { "description": "The ID of the message to retrieve", "type": "string" } }, "required": [ "message_id" ], "type": "object" } } } ] } ``` Sent to endpoint for toolcall result (correct): ``` { "stream": true, "model": "Qwen3.5 Reasoning", "messages": [ { "role": "system", "content": "# Core Guidelines:\n1. Stop confidently when uncertain - state clearly if you don't know\n2. Use available context properly - check context before answering\n3. Ask for clarification when needed - seek clarification rather than assuming\n4. Be transparent about limitations - explain when information isn't in context\n5. Use inline citations correctly - only when <source> has id attribute\n6. Be honest about uncertainties - don't pretend to know uncertain information\n7. Immediately acknowledge and accept user-provided corrections with reliable sources\n8. Never insist on incorrect information after being corrected by verified evidence\n9. Prioritize user-provided factual corrections over potentially conflicting search results\n10. When multiple sources conflict, default to the most recently provided verified information\n11. If a user provides specific source citations contradicting my response, recant and correct immediately\n12. Do not defend incorrect statements - replace them with corrected information\n13. When in doubt about factual accuracy after correction, ask for clarification rather than guessing\n14. When discussing or searching for contemporaneous information, be mindful that it is 2026-03-04\n15. When asked to draw a mermaid chart, output the mermaid code in markdown. Be mindful of colors and contrast ratios for visibility." }, { "role": "user", "content": "generate a random image for me" }, { "role": "assistant", "content": "<think>The user wants me to generate a random image. I have access to a generate_image function that requires a prompt parameter. Since they want something \"random\", I should create an interesting, varied prompt that will produce an appealing image without them specifying exactly what they want.\n\nI'll create a diverse, visually interesting prompt that could work well for image generation.</think>", "tool_calls": [ { "id": "6RSzJjobNgURxVkxCZbyJO1VoucWDGB3", "type": "function", "function": { "name": "generate_image", "arguments": "{\"prompt\": \"A vibrant sunset over a mountain lake with colorful reflections in the water, fluffy clouds in the orange and purple sky, pine trees silhouetted against the horizon, peaceful and serene landscape photography style\"}" } } ] }, { "role": "tool", "tool_call_id": "6RSzJjobNgURxVkxCZbyJO1VoucWDGB3", "content": "{\"status\": \"success\", \"images\": [{\"url\": \"/api/v1/files/b6738ed8-6fe1-47b9-a4be-57a78aaa5f25/content\"}]}" } ], "tools": [ ... snip ... ] } ``` My prompt: do a random web search, only tell me the number of results found, summarizing is unnecessary ``` { "stream": true, "model": "Qwen3.5 Reasoning", "messages": [ { "role": "system", "content": "# Core Guidelines:\n1. Stop confidently when uncertain - state clearly if you don't know\n2. Use available context properly - check context before answering\n3. Ask for clarification when needed - seek clarification rather than assuming\n4. Be transparent about limitations - explain when information isn't in context\n5. Use inline citations correctly - only when <source> has id attribute\n6. Be honest about uncertainties - don't pretend to know uncertain information\n7. Immediately acknowledge and accept user-provided corrections with reliable sources\n8. Never insist on incorrect information after being corrected by verified evidence\n9. Prioritize user-provided factual corrections over potentially conflicting search results\n10. When multiple sources conflict, default to the most recently provided verified information\n11. If a user provides specific source citations contradicting my response, recant and correct immediately\n12. Do not defend incorrect statements - replace them with corrected information\n13. When in doubt about factual accuracy after correction, ask for clarification rather than guessing\n14. When discussing or searching for contemporaneous information, be mindful that it is 2026-03-04\n15. When asked to draw a mermaid chart, output the mermaid code in markdown. Be mindful of colors and contrast ratios for visibility." }, { "role": "user", "content": "generate a random image for me" }, { "role": "assistant", "content": "\n\"{\\\"status\\\": \\\"success\\\", \\\"images\\\": [{\\\"url\\\": \\\"/api/v1/files/b6738ed8-6fe1-47b9-a4be-57a78aaa5f25/content\\\"}]}\"\n\nI've generated a random image for you! It's a beautiful landscape featuring:\n\n- A vibrant sunset over a mountain lake\n- Colorful reflections in the water\n- Orange and purple clouds in the sky\n- Silhouetted pine trees against the horizon\n- Peaceful, serene photography style\n\nYou can view the image here: `/api/v1/files/b6738ed8-6fe1-47b9-a4be-57a78aaa5f25/content`\n\nIf you'd like me to generate something different, just let me know what type of scene or subject you prefer!" }, { "role": "user", "content": "do a random web search, only tell me the number of results found, summarizing is unnecessary" } ], "tools": [ ... snip ... ] } ``` Sent to endpoint for acknowledging toolcall result: ``` { "stream": true, "model": "Qwen3.5 Reasoning", "messages": [ { "role": "system", "content": "# Core Guidelines:\n1. Stop confidently when uncertain - state clearly if you don't know\n2. Use available context properly - check context before answering\n3. Ask for clarification when needed - seek clarification rather than assuming\n4. Be transparent about limitations - explain when information isn't in context\n5. Use inline citations correctly - only when <source> has id attribute\n6. Be honest about uncertainties - don't pretend to know uncertain information\n7. Immediately acknowledge and accept user-provided corrections with reliable sources\n8. Never insist on incorrect information after being corrected by verified evidence\n9. Prioritize user-provided factual corrections over potentially conflicting search results\n10. When multiple sources conflict, default to the most recently provided verified information\n11. If a user provides specific source citations contradicting my response, recant and correct immediately\n12. Do not defend incorrect statements - replace them with corrected information\n13. When in doubt about factual accuracy after correction, ask for clarification rather than guessing\n14. When discussing or searching for contemporaneous information, be mindful that it is 2026-03-04\n15. When asked to draw a mermaid chart, output the mermaid code in markdown. Be mindful of colors and contrast ratios for visibility." }, { "role": "user", "content": "generate a random image for me" }, { "role": "assistant", "content": "\n\"{\\\"status\\\": \\\"success\\\", \\\"images\\\": [{\\\"url\\\": \\\"/api/v1/files/b6738ed8-6fe1-47b9-a4be-57a78aaa5f25/content\\\"}]}\"\n\nI've generated a random image for you! It's a beautiful landscape featuring:\n\n- A vibrant sunset over a mountain lake\n- Colorful reflections in the water\n- Orange and purple clouds in the sky\n- Silhouetted pine trees against the horizon\n- Peaceful, serene photography style\n\nYou can view the image here: `/api/v1/files/b6738ed8-6fe1-47b9-a4be-57a78aaa5f25/content`\n\nIf you'd like me to generate something different, just let me know what type of scene or subject you prefer!" }, { "role": "user", "content": "### Task:\nRespond to the user query using the provided context, incorporating inline citations in the format [id] **only when the <source> tag includes an explicit id attribute** (e.g., <source id=\"1\">).\n\n### Guidelines:\n- If you don't know the answer, clearly state that.\n- If uncertain, ask the user for clarification.\n- Respond in the same language as the user's query.\n- If the context is unreadable or of poor quality, inform the user and provide the best possible answer.\n- If the answer isn't present in the context but you possess the knowledge, explain this to the user and provide the answer using your own understanding.\n- **Only include inline citations using [id] (e.g., [1], [2]) when the <source> tag includes an id attribute.**\n- Do not cite if the <source> tag does not contain an id attribute.\n- Do not use XML tags in your response.\n- Ensure citations are concise and directly related to the information provided.\n\n### Example of Citation:\nIf the user asks about a specific topic and the information is found in a source with a provided id attribute, the response should include the citation like in the following example:\n* \"According to the study, the proposed method increases efficiency by 20% [1].\"\n\n### Output:\nProvide a clear and direct response to the user's query, including inline citations in the format [id] only when the <source> tag with id attribute is present in the context.\n\n<context>\n<source id=\"1\" name=\"search_web\"></source>\n<source id=\"2\" name=\"search_web\"></source>\n<source id=\"3\" name=\"search_web\"></source>\n<source id=\"4\" name=\"search_web\"></source>\n<source id=\"5\" name=\"search_web\"></source>\n<source id=\"6\" name=\"search_web\"></source>\n<source id=\"7\" name=\"search_web\"></source>\n<source id=\"8\" name=\"search_web\"></source>\n<source id=\"9\" name=\"search_web\"></source>\n<source id=\"10\" name=\"search_web\"></source>\n</context>\n\ndo a random web search, only tell me the number of results found, summarizing is unnecessary" }, { "role": "assistant", "content": "<think>The user wants me to do a random web search and only tell them the number of results found. They explicitly said not to summarize anything. I need to:\n\n1. Do a web search with a random query\n2. Only report back the number of results, nothing else\n\nLet me do a simple random web search - I'll search for something general like \"technology\" or just pick a random topic.</think>", "tool_calls": [ { "id": "jepeqoBU3hiOenATvmxREAaUsSXHZKVD", "type": "function", "function": { "name": "search_web", "arguments": "{\"query\": \"technology\", \"count\": 5}" } } ] }, { "role": "tool", "tool_call_id": "jepeqoBU3hiOenATvmxREAaUsSXHZKVD", "content": "[{\"title\": \"Technology - Wikipedia\", \"link\": \"https://en.wikipedia.org/wiki/Technology\", \"snippet\": \"Technology is <strong>the application of conceptual knowledge to achieve practical goals, especially in a reproducible way</strong>. The word technology can also mean the products resulting from such efforts, including both tangible tools such as utensils or machines, and intangible ones such as software.\"}, {\"title\": \"Technology | Definition, Examples, Types, & Facts | Britannica\", \"link\": \"https://www.britannica.com/technology/technology\", \"snippet\": \"Technology is <strong>the application of scientific knowledge to the practical aims of human life</strong> or, as it is sometimes phrased, to the change manipulation of the human environment. From hand tools to computers and engineering, technology encompasses ...\"}, {\"title\": \"What is Technology? | IIASA\", \"link\": \"https://iiasa.ac.at/what-is-technology\", \"snippet\": \"Few countries changed their standard from left- to right-hand-side driving because of the costs involved. (Austria and Italy even maintained both standards for a transitional period in the 1920s and 1930s). Technology systems frequently &quot;lock-in&quot; early-on in particular configurations that subsequently may turn out to be suboptimal.\"}, {\"title\": \"Technology\", \"link\": \"https://www.directives.doe.gov/terms_definitions/technology\", \"snippet\": \"Technology is derived from basic or applied research, development, engineering, technological demonstration, economic and social research, or scientific inquiry into phenomena or <strong>technology</strong> applications.\"}, {\"title\": \"Reuters Tech News | Today's Latest Technology News | Reuters\", \"link\": \"https://www.reuters.com/technology/\", \"snippet\": \"TechnologycategoryCrowdStrike forecasts fiscal 2027 revenue above estimates on cybersecurity tools demand\"}, {\"title\": \"BBC Technology | Technology, Health, Environment, AI\", \"link\": \"https://www.bbc.com/technology\", \"snippet\": \"BBC Technology brings you the latest in Technology news and coverage from around the world, including health, environment, AI, and more\"}, {\"title\": \"TECHNOLOGY Definition & Meaning - Merriam-Webster\", \"link\": \"https://www.merriam-webster.com/dictionary/technology\", \"snippet\": \"The meaning of TECHNOLOGY is <strong>the practical application of scientific knowledge especially in a particular area</strong> : engineering. How to use technology in a sentence.\"}, {\"title\": \"MIT Technology Review\", \"link\": \"https://www.technologyreview.com/\", \"snippet\": \"Emerging <strong>technology</strong> news &amp; insights | AI, Climate Change, BioTech, and more\"}, {\"title\": \"Technology: The Good, The Bad, The Ugly\", \"link\": \"https://www.uagrantham.edu/blog/technology-the-good-the-bad-the-ugly/\", \"snippet\": \"That also means we don\u2019t have to relinquish many of our routines, no matter what else is going on in the world. Technology allows us to keep working, communicating, going to school, shopping, going to doctor or therapy appointments, playing games, and staying aware of current events.\"}, {\"title\": \"Technology - The New York Times\", \"link\": \"https://www.nytimes.com/section/technology\", \"snippet\": \"Technology industry news, commentary and analysis, with reporting on big tech, startups, and internet culture.\"}]" } ], "tools": [ ... snip ... ] } ``` Prompt: ok (last message to illustrate that tool content is getting collapsed into assistant) ``` { "stream": true, "model": "Qwen3.5 Reasoning", "messages": [ { "role": "system", "content": "# Core Guidelines:\n1. Stop confidently when uncertain - state clearly if you don't know\n2. Use available context properly - check context before answering\n3. Ask for clarification when needed - seek clarification rather than assuming\n4. Be transparent about limitations - explain when information isn't in context\n5. Use inline citations correctly - only when <source> has id attribute\n6. Be honest about uncertainties - don't pretend to know uncertain information\n7. Immediately acknowledge and accept user-provided corrections with reliable sources\n8. Never insist on incorrect information after being corrected by verified evidence\n9. Prioritize user-provided factual corrections over potentially conflicting search results\n10. When multiple sources conflict, default to the most recently provided verified information\n11. If a user provides specific source citations contradicting my response, recant and correct immediately\n12. Do not defend incorrect statements - replace them with corrected information\n13. When in doubt about factual accuracy after correction, ask for clarification rather than guessing\n14. When discussing or searching for contemporaneous information, be mindful that it is 2026-03-04\n15. When asked to draw a mermaid chart, output the mermaid code in markdown. Be mindful of colors and contrast ratios for visibility." }, { "role": "user", "content": "generate a random image for me" }, { "role": "assistant", "content": "\n\"{\\\"status\\\": \\\"success\\\", \\\"images\\\": [{\\\"url\\\": \\\"/api/v1/files/b6738ed8-6fe1-47b9-a4be-57a78aaa5f25/content\\\"}]}\"\n\nI've generated a random image for you! It's a beautiful landscape featuring:\n\n- A vibrant sunset over a mountain lake\n- Colorful reflections in the water\n- Orange and purple clouds in the sky\n- Silhouetted pine trees against the horizon\n- Peaceful, serene photography style\n\nYou can view the image here: `/api/v1/files/b6738ed8-6fe1-47b9-a4be-57a78aaa5f25/content`\n\nIf you'd like me to generate something different, just let me know what type of scene or subject you prefer!" }, { "role": "user", "content": "do a random web search, only tell me the number of results found, summarizing is unnecessary" }, { "role": "assistant", "content": "\n\"[{\\\"title\\\": \\\"Technology - Wikipedia\\\", \\\"link\\\": \\\"https://en.wikipedia.org/wiki/Technology\\\", \\\"snippet\\\": \\\"Technology is <strong>the application of conceptual knowledge to achieve practical goals, especially in a reproducible way</strong>. The word technology can also mean the products resulting from such efforts, including both tangible tools such as utensils or machines, and intangible ones such as software.\\\"}, {\\\"title\\\": \\\"Technology | Definition, Examples, Types, & Facts | Britannica\\\", \\\"link\\\": \\\"https://www.britannica.com/technology/technology\\\", \\\"snippet\\\": \\\"Technology is <strong>the application of scientific knowledge to the practical aims of human life</strong> or, as it is sometimes phrased, to the change manipulation of the human environment. From hand tools to computers and engineering, technology encompasses ...\\\"}, {\\\"title\\\": \\\"What is Technology? | IIASA\\\", \\\"link\\\": \\\"https://iiasa.ac.at/what-is-technology\\\", \\\"snippet\\\": \\\"Few countries changed their standard from left- to right-hand-side driving because of the costs involved. (Austria and Italy even maintained both standards for a transitional period in the 1920s and 1930s). Technology systems frequently &quot;lock-in&quot; early-on in particular configurations that subsequently may turn out to be suboptimal.\\\"}, {\\\"title\\\": \\\"Technology\\\", \\\"link\\\": \\\"https://www.directives.doe.gov/terms_definitions/technology\\\", \\\"snippet\\\": \\\"Technology is derived from basic or applied research, development, engineering, technological demonstration, economic and social research, or scientific inquiry into phenomena or <strong>technology</strong> applications.\\\"}, {\\\"title\\\": \\\"Reuters Tech News | Today's Latest Technology News | Reuters\\\", \\\"link\\\": \\\"https://www.reuters.com/technology/\\\", \\\"snippet\\\": \\\"TechnologycategoryCrowdStrike forecasts fiscal 2027 revenue above estimates on cybersecurity tools demand\\\"}, {\\\"title\\\": \\\"BBC Technology | Technology, Health, Environment, AI\\\", \\\"link\\\": \\\"https://www.bbc.com/technology\\\", \\\"snippet\\\": \\\"BBC Technology brings you the latest in Technology news and coverage from around the world, including health, environment, AI, and more\\\"}, {\\\"title\\\": \\\"TECHNOLOGY Definition & Meaning - Merriam-Webster\\\", \\\"link\\\": \\\"https://www.merriam-webster.com/dictionary/technology\\\", \\\"snippet\\\": \\\"The meaning of TECHNOLOGY is <strong>the practical application of scientific knowledge especially in a particular area</strong> : engineering. How to use technology in a sentence.\\\"}, {\\\"title\\\": \\\"MIT Technology Review\\\", \\\"link\\\": \\\"https://www.technologyreview.com/\\\", \\\"snippet\\\": \\\"Emerging <strong>technology</strong> news &amp; insights | AI, Climate Change, BioTech, and more\\\"}, {\\\"title\\\": \\\"Technology: The Good, The Bad, The Ugly\\\", \\\"link\\\": \\\"https://www.uagrantham.edu/blog/technology-the-good-the-bad-the-ugly/\\\", \\\"snippet\\\": \\\"That also means we don\u2019t have to relinquish many of our routines, no matter what else is going on in the world. Technology allows us to keep working, communicating, going to school, shopping, going to doctor or therapy appointments, playing games, and staying aware of current events.\\\"}, {\\\"title\\\": \\\"Technology - The New York Times\\\", \\\"link\\\": \\\"https://www.nytimes.com/section/technology\\\", \\\"snippet\\\": \\\"Technology industry news, commentary and analysis, with reporting on big tech, startups, and internet culture.\\\"}]\"\n\n10 results found." }, { "role": "user", "content": "ok" } ], "tools": [ ... snip ... ] } ``` ### Additional Information To be clear, the issue here is that merging the tool content down into the assistant content is that it is essentially pre-filling the assistant response: breaking context cache, and making the model think that it output that information rather than a tool.
GiteaMirror added the bug label 2026-05-13 06:59:11 -05:00
Author
Owner

@Classic298 commented on GitHub (Mar 6, 2026):

@pfn can you please confirm this is still the case on latest dev?

<!-- gh-comment-id:4013651682 --> @Classic298 commented on GitHub (Mar 6, 2026): @pfn can you please confirm this is still the case on latest dev?
Author
Owner

@Classic298 commented on GitHub (Mar 6, 2026):

@pfn do you have any filters or functions?

<!-- gh-comment-id:4013728548 --> @Classic298 commented on GitHub (Mar 6, 2026): @pfn do you have any filters or functions?
Author
Owner

@pfn commented on GitHub (Mar 6, 2026):

@Classic298 I have the Smart Infographic, Smart Mind Map and Generate Image actions installed, these do not work on the chat body (for the purpose of modification). No filters are active.

Does running dev clobber a main version database? I was always under the impression that it can be irreversibly broken due to missing/bad migrations, etc. I have avoided running dev for this reason.

Here is an example of the problem. I just encountered this during a tool session generating images. This final result is the model hallucinating that it can generate images simply by embedding the JSON into its output, at this point, the model refused to make any more tool calls to generate_image and would only "generate" images by embedding JSON it "thinks" would result in an image, because it was trained to do this by previous context.

Image
<!-- gh-comment-id:4014454478 --> @pfn commented on GitHub (Mar 6, 2026): @Classic298 I have the Smart Infographic, Smart Mind Map and Generate Image actions installed, these do not work on the chat body (for the purpose of modification). No filters are active. Does running dev clobber a main version database? I was always under the impression that it can be irreversibly broken due to missing/bad migrations, etc. I have avoided running dev for this reason. Here is an example of the problem. I just encountered this during a tool session generating images. This final result is the model hallucinating that it can generate images simply by embedding the JSON into its output, at this point, the model refused to make any more tool calls to generate_image and would only "generate" images by embedding JSON it "thinks" would result in an image, because it was trained to do this by previous context. <img width="1119" height="524" alt="Image" src="https://github.com/user-attachments/assets/8424ea93-f6d9-4dc4-a1ef-62a717363140" />
Author
Owner

@Classic298 commented on GitHub (Mar 6, 2026):

@pfn there are currently zero Migrations from 0.8.8 to dev

And even if there were, Migrations are generally only merged in if they work

<!-- gh-comment-id:4014481347 --> @Classic298 commented on GitHub (Mar 6, 2026): @pfn there are currently zero Migrations from 0.8.8 to dev And even if there were, Migrations are generally only merged in if they work
Author
Owner

@Classic298 commented on GitHub (Mar 6, 2026):

Thanks

<!-- gh-comment-id:4014481512 --> @Classic298 commented on GitHub (Mar 6, 2026): Thanks
Author
Owner

@pfn commented on GitHub (Mar 6, 2026):

    {
      "role": "user",
      "content": "generate a random image for me"
    },
    {
      "role": "assistant",
      "content": "\n\"{\\\"status\\\": \\\"success\\\", \\\"images\\\": [{\\\"url\\\": \\\"/api/v1/files/1aab0db3-b084-40e6-aa7e-f36556f23d69/content\\\"}]}\"\n\nGreat! I've generated a random fantasy landscape image for you. The image features:\n\n- Crystalline mountain ranges glowing in golden sunset light\n- Floating islands with cascading waterfalls\n- A magical aurora borealis dancing in the sky\n- Ancient ruins covered in luminescent moss\n\nYou can view your generated image at this URL:\n`/api/v1/files/1aab0db3-b084-40e6-aa7e-f36556f23d69/content`\n\nWould you like me to generate another image with a different theme, or would you prefer any modifications to this one?"
    },
    {
      "role": "user",
      "content": "### Task:\nRespond to the user query using the provided context, incorporating inline citations in the format [id] **only when the <source> tag includes an explicit id attribute** (e.g., <source id=\"1\">).\n\n### Guidelines:\n- If you don't know the answer, clearly state that.\n- If uncertain, ask the user for clarification.\n- Respond in the same language as the user's query.\n- If the context is unreadable or of poor quality, inform the user and provide the best possible answer.\n- If the answer isn't present in the context but you possess the knowledge, explain this to the user and provide the answer using your own understanding.\n- **Only include inline citations using [id] (e.g., [1], [2]) when the <source> tag includes an id attribute.**\n- Do not cite if the <source> tag does not contain an id attribute.\n- Do not use XML tags in your response.\n- Ensure citations are concise and directly related to the information provided.\n\n### Example of Citation:\nIf the user asks about a specific topic and the information is found in a source with a provided id attribute, the response should include the citation like in the following example:\n* \"According to the study, the proposed method increases efficiency by 20% [1].\"\n\n### Output:\nProvide a clear and direct response to the user's query, including inline citations in the format [id] only when the <source> tag with id attribute is present in the context.\n\n<context>\n<source id=\"1\" name=\"search_web\"></source>\n<source id=\"2\" name=\"search_web\"></source>\n<source id=\"3\" name=\"search_web\"></source>\n<source id=\"4\" name=\"search_web\"></source>\n<source id=\"5\" name=\"search_web\"></source>\n<source id=\"6\" name=\"search_web\"></source>\n<source id=\"7\" name=\"search_web\"></source>\n<source id=\"8\" name=\"search_web\"></source>\n<source id=\"9\" name=\"search_web\"></source>\n<source id=\"10\" name=\"search_web\"></source>\n</context>\n\nperform a random web search for me, no need to summarize, just give me a result count"
    },
    {
      "role": "assistant",
      "content": "<think>The user wants me to perform a random web search and just give them a result count. They specifically said \"no need to summarize, just give me a result count\". I should use the search_web function with a random query and then report back how many results were returned.\n\nLet me pick a random topic for the search - maybe something general like \"technology\" or \"science\" would work well.\n</think>",
      "tool_calls": [
        {

the result merging behavior did not change in :dev (git pulled dev and applied this logging diff) @Classic298

tool calling seems to have gotten worse: some "Task ...." got injected into my prompt invisibly for the search web request.

<!-- gh-comment-id:4014811699 --> @pfn commented on GitHub (Mar 6, 2026): ``` { "role": "user", "content": "generate a random image for me" }, { "role": "assistant", "content": "\n\"{\\\"status\\\": \\\"success\\\", \\\"images\\\": [{\\\"url\\\": \\\"/api/v1/files/1aab0db3-b084-40e6-aa7e-f36556f23d69/content\\\"}]}\"\n\nGreat! I've generated a random fantasy landscape image for you. The image features:\n\n- Crystalline mountain ranges glowing in golden sunset light\n- Floating islands with cascading waterfalls\n- A magical aurora borealis dancing in the sky\n- Ancient ruins covered in luminescent moss\n\nYou can view your generated image at this URL:\n`/api/v1/files/1aab0db3-b084-40e6-aa7e-f36556f23d69/content`\n\nWould you like me to generate another image with a different theme, or would you prefer any modifications to this one?" }, { "role": "user", "content": "### Task:\nRespond to the user query using the provided context, incorporating inline citations in the format [id] **only when the <source> tag includes an explicit id attribute** (e.g., <source id=\"1\">).\n\n### Guidelines:\n- If you don't know the answer, clearly state that.\n- If uncertain, ask the user for clarification.\n- Respond in the same language as the user's query.\n- If the context is unreadable or of poor quality, inform the user and provide the best possible answer.\n- If the answer isn't present in the context but you possess the knowledge, explain this to the user and provide the answer using your own understanding.\n- **Only include inline citations using [id] (e.g., [1], [2]) when the <source> tag includes an id attribute.**\n- Do not cite if the <source> tag does not contain an id attribute.\n- Do not use XML tags in your response.\n- Ensure citations are concise and directly related to the information provided.\n\n### Example of Citation:\nIf the user asks about a specific topic and the information is found in a source with a provided id attribute, the response should include the citation like in the following example:\n* \"According to the study, the proposed method increases efficiency by 20% [1].\"\n\n### Output:\nProvide a clear and direct response to the user's query, including inline citations in the format [id] only when the <source> tag with id attribute is present in the context.\n\n<context>\n<source id=\"1\" name=\"search_web\"></source>\n<source id=\"2\" name=\"search_web\"></source>\n<source id=\"3\" name=\"search_web\"></source>\n<source id=\"4\" name=\"search_web\"></source>\n<source id=\"5\" name=\"search_web\"></source>\n<source id=\"6\" name=\"search_web\"></source>\n<source id=\"7\" name=\"search_web\"></source>\n<source id=\"8\" name=\"search_web\"></source>\n<source id=\"9\" name=\"search_web\"></source>\n<source id=\"10\" name=\"search_web\"></source>\n</context>\n\nperform a random web search for me, no need to summarize, just give me a result count" }, { "role": "assistant", "content": "<think>The user wants me to perform a random web search and just give them a result count. They specifically said \"no need to summarize, just give me a result count\". I should use the search_web function with a random query and then report back how many results were returned.\n\nLet me pick a random topic for the search - maybe something general like \"technology\" or \"science\" would work well.\n</think>", "tool_calls": [ { ``` the result merging behavior did not change in :dev (git pulled dev and applied this logging diff) @Classic298 tool calling seems to have gotten worse: some "Task ...." got injected into my prompt invisibly for the search web request.
Author
Owner

@Classic298 commented on GitHub (Mar 6, 2026):

That's intended that's the rag system prompt

<!-- gh-comment-id:4014815557 --> @Classic298 commented on GitHub (Mar 6, 2026): That's intended that's the rag system prompt
Author
Owner

@Classic298 commented on GitHub (Mar 6, 2026):

Ok thanks for letting me know I'll try to investigate further tomorrow

<!-- gh-comment-id:4014817452 --> @Classic298 commented on GitHub (Mar 6, 2026): Ok thanks for letting me know I'll try to investigate further tomorrow
Author
Owner

@pfn commented on GitHub (Mar 6, 2026):

Ooops, you're right, I missed that in the original snippet I sent with the base issue.

<!-- gh-comment-id:4014817782 --> @pfn commented on GitHub (Mar 6, 2026): Ooops, you're right, I missed that in the original snippet I sent with the base issue.
Author
Owner

@tjbck commented on GitHub (Mar 8, 2026):

@pfn where are you logging these payloads? and are you using temp chats?

<!-- gh-comment-id:4017754645 --> @tjbck commented on GitHub (Mar 8, 2026): @pfn where are you logging these payloads? and are you using temp chats?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#74276