Skip to content

[Feature Request] Improve Function Calling compatibility for local GGUF models via LM Studio (XML-like tool calls) #31

@tungtapcode-tech

Description

@tungtapcode-tech

Description

Hello Auto-Deep-Research Team,

First of all, thank you for creating this amazing open-source project! I've been trying to set it up with a local LLM environment using LM Studio, and I've run into a fundamental compatibility issue with how function/tool calls are handled.

After extensive debugging with multiple top-tier GGUF models, it's clear that the current implementation of Auto-Deep-Research expects OpenAI's standard JSON tool_calls format, which is not what many popular local models produce via LM Studio.

The Problem

When running Auto-Deep-Research with various GGUF models (including Meta-Llama-3-8B-Instruct, Deepseek-R1-Qwen3-8B, and Mistral-7B-Instruct-v0.2) through an LM Studio OpenAI-compatible endpoint, the models correctly reason about using tools. However, they generate tool calls in an XML-like tag format directly within the content field of the response, instead of a separate tool_calls JSON object.

This leads to a KeyError: 'tool_calls' in autoagent/core.py or autoagent/fn_call_converter.py because the framework cannot find the expected JSON structure.

Example LLM Response from LM Studio (using Llama 3 8B Instruct)

Here is a typical response from the model, demonstrating the XML-like format:

{
  "id": "chatcmpl-kp7xnrr4gwpuh04x7fhea",
  "object": "chat.completion",
  "created": 1753150003,
  "model": "meta-llama-3-8b-instruct",
  "choices": [
    {
      "index": 0,
      "logprobs": null,
      "finish_reason": "stop",
      "message": {
        "role": "assistant",
        "content": "I'd be happy to help... Here are three key points:\n\n<function=transfer_to_coding_agent>\n<parameter=sub_task_description>The development of Explainable AI (XAI) in healthcare</parameter>\nAI systems will be able to provide clear and accurate explanations...\n</function>\n\n<function=transfer_to_coding_agent>\n<parameter=sub_task_description>Personalized medicine using AI-driven genomic analysis</parameter>\nResearchers have made significant progress...\n</function>"
      }
    }
  ],
  "usage": { ... }
}
As you can see, the tool call is embedded as <function=...> within the content string.
Proposed Solution / Feature Request

To greatly improve compatibility with the growing local LLM ecosystem (especially users of LM Studio, Ollama, etc.), I would like to request the implementation of a parser for this XML-like tool call format.

This would likely involve modifying the convert_non_fncall_messages_to_fncall_messages function in autoagent/fn_call_converter.py to:

    Check if the content string contains these <function=...> tags.

    If so, parse the function name and parameters from the string.

    Construct a valid tool_calls JSON object from the parsed information.

This would allow Auto-Deep-Research to correctly execute tools with a much wider range of popular local models, making the project significantly more accessible and robust for users who prioritize privacy and cost-effectiveness.

Thank you for your consideration! This is a fantastic project and I believe this improvement would be a game-changer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions