Home

Appendix

Application Icon   AI in Practice

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.

Capabilities

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. Let's look at where external AI works in DEVONthink.

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.

Document Summarization/Transformation: Summarize the document you're reading, or transform selected text via two buttons in the Navigation Bar.

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. And with the Data > New > Generate Image command and an appropriate AI model, describe an image and have it created for you. Additionally, some chat inquires can create new documents. You can read more about this in the AI and Your Documents section.

Search Syntax Assistance: When doing a toolbar search, an AI button lets you ask more naturally, e.g., "Show me PDF documents with more than 10 annotations." This shows the raw search syntax, kind:pdf md_annotationcount>10. You can copy this or just run the search.

Database Searching: You can ask AI to look for documents as you talk with the Chat assistant. For example, you could ask for it to find your espresso machine manual or a receipt for your telescope purchase. Fortunately, DEVONthink gives you a lot of control over what AI can access for searches, as mentioned in the previous subsection.

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 of where AI can be used. But let's look at some 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:

  • Icon
    Web: Do a general search of the Internet, including Wikipedia and PubMed.
  • Icon
    Wikipedia: Limit the search to Wikipedia.
  • Icon
    PubMed: Limit the search to the PubMed site.
  • Icon
    Database: This 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. We'll cover some specifics of this in the next subsection.

Controlling AI's Access

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. 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.

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 these important questions (depending on the responses you receive):

  • Icon
    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.
  • Icon
    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.
  • Icon
    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.
  • Icon
    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.
  • Icon
    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. Choose a model and use it as your normally would. Then choose a different model or AI engine in the popup menu. Now enter Same prompt and 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.