DT4 - fails with document when using local ai

Good morning,

I get errors when I chose a document and ask some questions about it?

image

If required: I captured the local traffic with Wireshark.

If the size / context is a problem, I would expect a proper error message.

Please provide more detailed information in your inquiries. What are your AI > Chat settings?

Also, have you read the Getting Started > AI Explained section of the Help? Also, AI as it relates to DEVONthink is threaded throughout the manual. Look at the Windows > Help Viewer section in the Help.

Getting Started > AI Explained
Yes

Ollama

Msty.app + Ollama

And what exactly was selected, is this a main or document window? The same prompt using Ollama and Mistral Small works fine over here (rich text document selected in a main window)

What do you mean with main or document window?

I tried it again - different error though.

Isn’t Mistral Small the Online Model by Mistral?

Mistral AI offers various models, both via their API and as open source. Is the installed version of Ollama up to date?

No. It’s 0.6.2 embedded into Msty.app (https://msty.app). The latest one is 0.6.4

Hard to tell whether Msty.app uses a customized version of Ollama but I would definitely recommend the stand-alone version, especially as it’s easy to keep it updated.

But I think msty+ollama itself is working.

  1. Mistral Small (online)
  2. OpenAI GPT-4o
  3. Microsoft Phi 4 (msty+ollama)
  4. Mistral-Nemo (msty+ollama)


Whatever is different. Now msty+ollama returns a value DT4 can handle. No error. BTW: I don’t change anything with my setup.

This is already discussed in the Windows chapter of the built-in Help and manual.

Sorry! main window.

An LLM is not a library with static, concrete answers.

Sure, you ask what kind of software setup aka ollama version I use. Suggesting it might be a problem with an outdated ollama version - which can be totally true. :slight_smile:

I’m aware that each response of an LLM can be/is different given the temperature chosen. I tried to reproduce the error multiple times, with no luck.

This is the return value from Mistral Nemo extracted from a Wireshark Trace. Taken this morning when I opened this ticket.

Request

{
  "keep_alive" : "60m",
  "stream" : false,
  "messages" : [
    {
      "content" : "You are an integrated assistant of DEVONthink 4.0beta1, a document & knowledge management solution for macOS. Your replies should be concise and accurate. Be polite and helpful. Ask if something is unclear. In addition, format your replies using Markdown. The current date is 2025-04-04 and the weekday is Friday, the version of macOS is 14.7.4. One PDF document is currently selected. Only accessing the properties or the contents of the selected items is possible, changing them is deactivated in the settings.",
      "role" : "system"
    },
    {
      "content" : "what kind of document is this",
      "role" : "user"
    },
    {
      "content" : "<null>",
      "role" : "assistant",
      "tool_calls" : [
        {
          "function" : {
            "name" : "get_property",
            "arguments" : {
              "name" : "type"
            }
          }
        }
      ]
    },
    {
      "name" : "get_property",
      "role" : "tool",
      "content" : "ERROR: Invalid 'name' parameter"
    }
  ],
  "raw" : true,
  "model" : "mistral-nemo:latest",
  "tools" : [
    {
      "type" : "function",
      "function" : {
        "name" : "create_item",
        "parameters" : {
          "properties" : {
            "URL" : {
              "description" : "The URL of the new item.",
              "type" : "string"
            },
            "aliases" : {
              "description" : "Comma-separated aliases of the name.",
              "type" : "string"
            },
            "comment" : {
              "description" : "The comment of the new item.",
              "type" : "string"
            },
            "content" : {
              "description" : "The content of the new document. Depending on the type either plain text, Markdown text, HTML source or comma-separated values (CSV) for spreadsheets. Not required for groups and bookmarks.",
              "type" : "string"
            },
            "name" : {
              "description" : "The name for the new item.",
              "type" : "string"
            },
            "tags" : {
              "description" : "Comma-separated tags of the new item.",
              "type" : "string"
            },
            "type" : {
              "description" : "The type of the new item.",
              "enum" : [
                "group",
                "bookmark",
                "Markdown",
                "HTML",
                "note",
                "text",
                "RTF",
                "spreadsheet"
              ],
              "type" : "string"
            }
          },
          "required" : [
            "name",
            "type"
          ],
          "type" : "object"
        },
        "description" : "Create and save a new item (a document, bookmark or group) in the current database. Do not use this to update existing items, this function can only create new items."
      }
    },
    {
      "type" : "function",
      "function" : {
        "name" : "show_database_search",
        "parameters" : {
          "type" : "object",
          "properties" : {
            "query" : {
              "type" : "string",
              "description" : "A valid DEVONthink search query. The search syntax supports prefixes (e.g. modified:, size: or name:), operators (NOT, AND, OR, OPT, XOR, NEAR, BEFORE, AFTER, NEXT) and wildcards (*?)."
            }
          },
          "required" : [
            "query"
          ]
        },
        "description" : "Show search results for the given query in the user interface. Use this tool only if the user wants to explicitly find certain items or documents in the databases. Do not use this to find items or documents on your own."
      }
    },
    {
      "type" : "function",
      "function" : {
        "name" : "perform_database_search",
        "parameters" : {
          "type" : "object",
          "properties" : {
            "query" : {
              "type" : "string",
              "description" : "A valid DEVONthink search query. The search syntax supports prefixes (e.g. modified:, size: or name:), operators (NOT, AND, OR, OPT, XOR, NEAR, BEFORE, AFTER, NEXT) and wildcards (*?)."
            }
          },
          "required" : [
            "query"
          ]
        },
        "description" : "Search the given query in the current database. Use this tool to gather additional information from the database, e.g. research material. Do not use this to retrieve information related to support or the user interface, e.g. the window and its item list."
      }
    },
    {
      "type" : "function",
      "function" : {
        "name" : "create_image",
        "parameters" : {
          "type" : "object",
          "properties" : {
            "style" : {
              "type" : "string",
              "enum" : [
                "natural",
                "vivid"
              ],
              "description" : "The image's style."
            },
            "prompt" : {
              "description" : "This prompt describes the image's contents and appearance.",
              "type" : "string"
            }
          },
          "required" : [
            "prompt"
          ]
        },
        "description" : "Create an image based on a user prompt requesting the creation of an image. An AI image generation tool (Dall-E 3) is used. Use this tool only if the user wants to explicitly create an image. Do not use this tool for graphs, charts or diagrams. Never. No kidding."
      }
    },
    {
      "type" : "function",
      "function" : {
        "name" : "perform_web_search",
        "parameters" : {
          "properties" : {
            "query" : {
              "description" : "A valid search query for the search engines Google, Bing and Brave. The search syntax supports common operators like AND, OR, NOT, phrases, parentheses and the site: prefix to limit the search to a website.",
              "type" : "string"
            }
          },
          "required" : [
            "query"
          ],
          "type" : "object"
        },
        "description" : "Search on the internet (the web) using popular search engines (Google, Bing and Brave). Use this tool to gather missing or additional or real-time information from the web, e.g. latest news, events, weather, stock prices or election results, or if desired by the user. Do not use this tool to search on PubMed or on Wikipedia but you could use this tool in case of failed PubMed or Wikipedia searches or in addition to these searches too if necessary."
      }
    },
    {
      "type" : "function",
      "function" : {
        "name" : "perform_wikipedia_search",
        "parameters" : {
          "properties" : {
            "query" : {
              "description" : "A valid search query for Wikipedia. The search syntax supports common operators like AND, OR, NOT, phrases and parentheses.",
              "type" : "string"
            }
          },
          "required" : [
            "query"
          ],
          "type" : "object"
        },
        "description" : "Search on Wikipedia, the free online encyclopedia. Use this tool to gather additional or latest facts, e.g. on culture, geography, health, history, human activities, mathematics, nature, people, philosophy, religion, science, society, technology etc., but do not use this tool to search on PubMed."
      }
    },
    {
      "type" : "function",
      "function" : {
        "name" : "perform_pubmed_search",
        "parameters" : {
          "properties" : {
            "query" : {
              "description" : "A valid search query for PubMed. The search syntax supports common operators like AND, OR, NOT, phrases and parentheses.",
              "type" : "string"
            }
          },
          "required" : [
            "query"
          ],
          "type" : "object"
        },
        "description" : "Search on PubMed, the national library of medicine. Use this tool only to search for the latest scientific or medical news and abstracts."
      }
    },
    {
      "type" : "function",
      "function" : {
        "name" : "get_property",
        "parameters" : {
          "type" : "object",
          "properties" : {
            "name" : {
              "type" : "string",
              "enum" : [
                "name",
                "URL",
                "aliases",
                "tags",
                "comment",
                "annotation",
                "creation date",
                "modification date",
                "addition date",
                "text",
                "transcription",
                "html",
                "source",
                "columns",
                "cells",
                "reference",
                "reference URL",
                "item link",
                "UUID"
              ],
              "description" : "The name of the property."
            }
          },
          "required" : [
            "name"
          ]
        },
        "description" : "Get a given property of the selected item"
      }
    },
    {
      "type" : "function",
      "function" : {
        "name" : "get_contents",
        "parameters" : {
          "type" : "object",
          "properties" : {

          },
          "required" : [

          ]
        },
        "description" : "Get the text contents of the selected document, e.g. to analyze, compare, summarize or describe it."
      }
    },
    {
      "type" : "function",
      "function" : {
        "name" : "compile_script",
        "parameters" : {
          "properties" : {
            "value" : {
              "description" : "The AppleScript or JavaScript source code of the script.",
              "type" : "string"
            }
          },
          "required" : [
            "value"
          ],
          "type" : "object"
        },
        "description" : "Compiles AppleScript or JavaScript for Automation (JXA) source code to validate its syntax. This function cannot be used to execute scripts and does not support other languages, do not even try to do this. The code is only validated & compiled, that's all."
      }
    }
  ],
  "temperature" : 0,
  "n" : 1,
  "max_tokens" : 4096,
  "echo" : false,
  "options" : {
    "num_ctx" : 2048
  }
}

Response

{"model":"mistral-nemo:latest","created_at":"2025-04-04T06:26:10.695617Z","message":{"role":"assistant","content":"It seems like you forgot to provide a name for your document. (e.g., \"Hello, World!\") Please try again with a valid title."},"done_reason":"stop","done":true,"total_duration":2900062000,"load_duration":18689042,"prompt_eval_count":27,"prompt_eval_duration":357531458,"eval_count":32,"eval_duration":2522415667}

DEVONthink 4 also logs additional information to ~/Library/Application Support/DEVONthink/Chat.log. Does this log include any hints?

There’s no log - unfortunately:

Does DEVONthink have Full Disk Access enabled in System Settings > Privacy & Security?

The log is named Chat.log but it’s not inside the Chat folder, it’s inside ~/Library/Application Support/DEVONthink (just like the Console.log)

1 Like

Thanks. Found it.

2025-04-04 08:25:19,746 WARNING: Ollama (mistral-nemo:latest): Invalid get_property name: type
2025-04-04 08:26:07,791 INFO: Ollama (mistral-nemo:latest): Tool call 'get_property': {
    name = type;
}
2025-04-04 08:26:07,792 WARNING: Ollama (mistral-nemo:latest): Invalid get_property name: type
2025-04-04 08:31:25,959 INFO: Ollama (mistral-nemo:latest): Tool call 'get_property': {
    name = type;
}
2025-04-04 16:39:00,531 INFO: Ollama (mistral-nemo:latest): Tool call 'get_property': {
    name = type;
}
2025-04-04 16:39:00,531 WARNING: Ollama (mistral-nemo:latest): Invalid get_property name: type
2025-04-04 16:41:39,362 INFO: Ollama (mistral-nemo:latest): Tool call 'get_property': {
    name = type;
}
2025-04-04 16:41:39,364 WARNING: Ollama (mistral-nemo:latest): Invalid get_property name: type
2025-04-04 16:42:25,730 INFO: Ollama (mistral-nemo:latest): Tool call 'get_property': {
    name = type;
}
2025-04-04 16:42:25,731 WARNING: Ollama (mistral-nemo:latest): Invalid get_property name: type
2025-04-04 16:43:12,046 INFO: Ollama (mistral-nemo:latest): Tool call 'get_property': {
    name = type;

Fixed the setting. But I looked at the wrong place for the log. Found it now.

Mistral Nemo returned some invalid, hallucinated tool calls. Is this the original 12b model?