In the previous section, we introduced AI concepts and considerations as related to DEVONthink. Here we'll cover: where AI is integrated, some ideas for practical uses, an explanation of one of the important settings, controlling AI's access, and a few tips on getting better responses.

## Assistants

Though it is possible to have a chat with AI, DEVONthink isn't merely a front-end to an AI provider. It has been integrated into several aspects of the application, providing new or improved functions, complementing our own internal AI. For non-automated functions, you interact with AI via several assistants and a specialized server.

Chat Assistant: Many of your interactions will happen in the Chat inspector or Chat popover. Whether you're asking an impromptu question or chatting about the selected document, the assistant is made just for these things, all shown in a familiar message-style interface. And if you want to keep a record of the "conversation", you can easily save it as a reference for later. If you become a frequent AI user, you'll likely chat via the assistant often.

The Chat inspector inspector and the Chat popover have the same functionality but operate independently. When they open, they use the same default AI engine. However, each can use a different model and each conversation is isolated. So you could have a discussion in the inspector and issue commands in the popover, without losing continuity in either discussion.

Note the Chat inspector belongs to a window. So if you have an active chat in a main window and open a separate document window, it will not retain the previous chat. Also, the Chat popover is persistent, retaining its contents across relaunches of the application.

Search Assistant: When doing a toolbar search, press the AI button to open the Search assistant. This lets search with more natural language, e.g., "Show me PDF documents with more than 10 annotations." The AI processes and shows the raw search syntax, `kind:pdf md_annotationcount>10`.

Help Assistant: Instead of reading through DEVONthink's built-in help, you can open the Help assistant and ask questions. The AI model is given access to the documentation and may be able to provide answers and links to related parts of the documentation.

Script Assistant: If you want to create DEVONthink scripts but don't know how, AI can assist in drafting a script for you. Choose Data > New > Script to open the Script Editor window, choose a model, explain what you want, and let the AI code something for you.

MCP Server: An MCP server is an internal AI server allowing you to connect to and work with your databases while outside our application, but still in a controlled and safe manner. There are a wide variety of commands available encompassing many practical features, like: creating and modifying documents and getting information about them, document format conversions, searching databases, classifying and filing documents, transcribing speech-to-text or text recognition, performing online searches, file imports and exports, etc. Used in conjunction with MCP-capable applications, e.g., Claude Desktop, this expands the ways you can work with your data.

Once the server is set up, you will be able to ask questions and give instructions like, "Get this document's DOI. Then find the document online and download it to my Bibliography database with full CrossRef metadata."

One distinction to make between the Chat assistant and the MCP server is: prompt versus skills. In a chat you usually discuss things in a more impromptu manner. With MCP, you can create a range of connected commands and consolidate them into a skill to accomplish repetitive tasks. You define a generic set of MCP actions for AI to follow when the situation requires it. So instead of telling AI to file a particular email, give it examples and parameters to process and file future emails. Or create a system you run daily that examines and builds a report of things recently finished, due soon, or overdue. When run in conjunction with other MCP servers, you can create and run some very complex workflows.

And all DEVONthink's MCP interactions are done with your privacy and data-safety in mind. For a deeper dive on the topic, see the Appendix > MCP Server section.

## Capabilities

The possible uses of AI are extensive and as you work with it, you're likely to stumble onto new ways of using it. But here are a few common, broad functions.

Document Processing: Summarize the document you're reading, or transform selected text via two buttons in the Navigation Bar. Or use AI to change metadata like label, ratings, etc. Or have it examine the contents for tagging, renaming, etc.

Media and Image Processing: Process and transcribe audio and video files and examine images with machine learning. You can generate a transcript from audio or video files in your databases. Let AI determine the subject, transcribe text on signs, menus, etc. In both cases, the text is stored in one of a few ways. With one setting this can even happen automatically when adding the files to your database.

Document/Image Generation: Create documents with AI, both text-based and images. DEVONthink provides some AI templates made for creating text documents. Or use Data > New > Generate Image command to open the Generate Image window where you can describe an image and have AI create it for you. Additionally, some chat inquires can create new documents. You can read more about this in the AI and Your Documents section.

Database Searching: You can ask AI to look for documents as you talk with the Chat assistant, the Search assistant, or the MCP server. For example, you could ask for it to find your espresso machine manual or a receipt for your telescope purchase.

Automation: Using chat queries and responses in smart actions like `Chat – Query` and the chat-based placeholder `Query Response`, present new automation possibilities for everyone. Additionally, there are new AI-driven commands available in AppleScript and JavaScript.

## Practical Uses

The preceding section presents a more general view how you interact and broad uses. Let's look at a few example use cases and methods:

AI Renaming Files: It's not uncommon to get a document with a less than useful name. Select it and tell the Chat assistant to `Add the filename to the finder comments of this document then rename it with a reasonable name`. This lets you preserve the original name, if needed, but also gives you something easier to find at-a-glance or in searches. Alternatively, you could tell it to `Add only the filename as an alias on this document…`.

Another option is to use batch processing to rename selected files based on their content. These could be any type of file. Select a few documents and choose Rename to Chat Suggestion in the Tools > Batch Process submenu. Your default AI engine will attempt to examine each document and rename it. Note you can choose another engine by clicking the button.

AI Tagging Assistance: While it's possible to automatically tag documents on import, you may want to handle tagging on a case-by-case basis. Select a document and ask Chat, `What tags would you recommend for this document?`. If you like some of the suggestions but don't want to add specific ones, you could tell it to add them, e.g., `Add three broad and two specific tags from that list`. Or if this was in a recipe database, you could tell it to `Add the ingredients as tags`. And don't miss the AI commands Data > Tags > Add Chat Suggestions to Documents, Add Vision Suggestions to Images or the same commands in the Tags smart action.

AI Documents from Web Content: If you have a bookmark selected in DEVONthink and want to gather specific information from it, you can ask Chat to create a document for you. For example, if you were reading about how to build a birdhouse, you could use `Add the instructions on how to build a birdhouse on the selected page`. You could also try a less specific prompt, like `Capture the instructions on the selected page`. The default format will be Markdown but you can request plain text, Markdown, or HTML documents from Chat. However, it is possible for the AI to respond with a format it decides.

Here's another example: Imagine you're shopping for a car and looking at a bookmark in DEVONthink. You get some results you like but just want to extract some specific information separately. Tell Chat to `Capture the two cheapest cars newer than 2014 with less than 100,000 miles from this page`. With some AI engines, you may get the document and also some commentary about them as well.

AI Searches: With AI, you can do "semantic searches", essentially looking for things related by concept instead of specific terms. As an example, ask Chat to look for `documents that talk about vehicles` and watch it generate its own query, e.g, `searching for car* OR boat* or plane*…`. Logically, you can be more specific, as needed. In a database of PDFs from car manufacturers, you can ask for `documents about Italian vehicles` without mentioning a brand, and it will return documents about or that mention Italian vehicles.

One thing you may be surprised by is how natural a chat can be. Say you're gathering information for a local animal shelter and want to locate some of your documents on different breeds. You ask Chat, `What documents discuss Manx cats?`. You then ask, `What about collies?`. Then you ask very naturally, `ferrets?`, without repeating the full question, and get results. Using an AI with a large context window, the previous discussion is considered when replying to subsequent questions.

## AI Search Scope

The data stored for AI models is usually quite extensive, especially for commercial services. This means some questions can be answered directly from its own dataset. However, no service will have all the information needed for every reply and the training data stops at a certain point in the past. Due to these conditions, providing answers requires accessing data outside its own boundaries. This not only may provide more current information but can also reduce hallucinations.

Inside DEVONthink, AI has the ability to initiate a toolbar search. This is nothing more than an automated way of entering search terms. On its own it won't necessarily create an optimal search, e.g., using search prefixes, but it may produce some useful results.

Beyond the toolbar search, the options in the AI > Chat > Search settings come into play. These control where AI can search for information when creating a response for you. Note these aren't options it must use; they are ones it could use. If the LLM can't answer from its own data, it will try any of the options you've enabled. The options are: arXiv, general Web searching, Wikipedia, PubMed, or Database. The last option controls whether AI can examine the contents of documents in your database. If disabled, AI may use DEVONthink's toolbar search to display items but it can't access the contents of documents directly. If enabled, the AI can examine documents' contents in a toolbar search, in selected groups or documents in the item list, or selected locations in the Navigate sidebar. Next we'll cover how to use this "safely".

## Controlling AI's Access

Your databases likely contain private documents and information, things you may not want accessible to AI. When you're using the Chat assistant to search your databases with the Database search option enabled, it's important to understand how AI's access works. It's a simple and controllable concept that helps you limit its reach.

Selection: The AI firstly sees a selection as everything it has access to. This includes a selected document, even if it's not currently displayed in the view/edit pane. When you search, it will report it's "Searching the database", however it is only searching the selected item. If you have a group selected, AI will search the documents in that group and its subgroups. So selecting a document or a group gives you very strict control. And yes, if you select multiple groups, they will be all be used as the limits of AI's reach.

Location: On the next level, is the current location. If you're in a group with four unselected documents, AI considers the group and its documents as "the database". Whatever you ask it to search for will only involve those four documents. But not every group has only ungrouped documents. In this case, AI will search documents within the groups and subgroups of the location. If we follow the logic, this means as we ascend through parent groups, we are extending the range of groups AI can search while still confining it to the current location. And if we select the database in the Navigate sidebar, we are giving it access to all the documents in the root of the database. So if you're not quite sure what specific group you may need to search, you can go up as far as you're comfortable and the subgroups will be searched.

Extended Locations: To open up some other possibilities, select a local smart group in your database. AI also sees this as "the database" to be searched. If you want an even wider range, you can select a global smart group. And for more impromptu uses, AI will treat your database search results as the only place it can search. So you can use these dynamic items as ad-hoc locations, searching documents no matter where they are.

Additional Control: Now that we've seen how much access we can give, there may still be places we want AI to ignore. AI honors the same setting as our internal search engine, Exclude from Search, but also the explicit Exclude from Chat & MCP. Select a document or group and open the Generic inspector or the Info popover, and enable the exclusion. If this is a group, it will hide all its contents as well, so think about what you're excluding. You can even exclude an entire database from AI in the Database Properties.

## Get to know your AI

As AI engines aren't all the same, what you ask about and how you phrase things can vary. Also, their capabilities depend highly on the selection and the settings. So how do you know what is possible and how to talk to your AI engine? Open the Chat inspector or Chat popover and ask questions like these:

- Create a table of your capabilities: This produces a list of what the AI can do within DEVONthink. You may be surprised at what it is capable of. This one is the most important to get a real understanding of what's possible.
- Create a table of the properties you can get and set: If the AI can access or modify the properties of an item, it's good to know which ones.
- How can I effectively ask you to search for something?: It's important to know the terms and phrasing an AI model understands. Asked this way, it usually provides examples as well.
- How can I effectively tell you to create an item?: Following suit, you can determine how best to have AI create items, if it reported it can.
- How can I effectively tell you to update an item: If the AI reports it can update existing documents, it's good to know this phrasing too.

These questions can be especially useful if you're trying to decide which engine to use. Ask your questions, choose a different model or engine, and ask it the same ones. For future reference, you can save the chat or even tell the assistant to put its responses in a new document.

Another handy tip if you're testing, or even just curious about, how models respond to the same prompt. In the Chat assistant, choose a model and use it as your normally would. Then choose a different model or AI engine in the selector popup and click the button. The newly selected engine will respond to the last prompt you gave to the previous model. This can be useful when you're testing responses from specific models or AI settings.

## Tips and Considerations

Finally, here are a few tips to help you potentially get better results from AI…

Focusing with metadata: Tags, Finder comments and other metadata may play a factor in AI's searching. A PDF about canoes may not contain the word "hobby" but if you add it as a tag, it's more likely AI will find it. Adding it to Finder comments may improve the chances of being found. However, as noted in the next tip, precision is helpful. If you ask about documents regarding `hobbies`, the AI will likely look only for that plural term, not assuming you want it to consider `hobby` as well.

Phrasing and clear and specific prompts: Your phrasing can affect the method of searching. For example, if you say, `Find documents about hiking`, a toolbar search may be initiated. But if you instead say, `What documents mention hiking?`, the AI may examine the contents of available documents to find matches. If you are having problems getting an expected response, try rephrasing your prompt.

Providing clearer and more specific instructions is going to produce better responses. Consider the prompt about a selected document: `Translate this document to Spanish`. This will almost certainly result in the document's content changing, just as requested. But if you want to preserve the text, ask `What is the Spanish translation of this document?` This should return the translated text. But now what to do with it? You could save the chat or be even more specific in your prompt: `Translate the text of the selected document to Spanish and save it as a Markdown document. Include the original text in italics at the end of the new document. Preserve the document's original filename in the Finder comments`.

We hope these last two sections gave you a clearer understanding of the complementary, but powerful, role of external AI in DEVONthink. You'll find other passages threaded throughout other chapters, e.g., AI and Your Documents or the AI Assisted Automation section. As it is a feature of the higher editions, keep your eyes open for blue sidebars or sections of blue text as you read.