RAG (Retrieval Augemented Generation) and DevonThink

Earlier in the year, I made a pitch for building RAG in DEVONthink. At the time we discussed the difficulties. A friend of mine has built a version in .NET.

The whole thing can be done locally. The obvious benefit in the long run would be the semantic search: “Find me all the documents on the subject ….”, in addition see also sections would become richer. Many other benefits. — The obvious cost is storage, back of the envelope math for PDFs assumes 20-25% of the original document size for the RAG DB. (Assuming a ~3000 dimensions in the vector DB and assuming the use of quantization)

DEVONthink already supports RAG in various ways (e.g. various search options or selected documents’ contents and properties to augment AI context) in the chat assistant. But we’ll consider a vector database and semantic search for future releases.

7 Likes

I was not aware that RAG is already supported in the chat assistant. Could you please share more details, or point me to the relevant section of the documentation?

An integration of DTP4 with a vector database and RAG would be very exciting. I fully understand that expressing interest in such a feature is not a promise that it will be implemented or available in the near term. That said, I genuinely appreciate the open discussion around potential features and your openness to considering ideas like this.

In my view, this transparency is a major advantage of the new DTP4 pricing model, as it allows developers to be supported in a sustainable way and enables features to evolve continuously rather than being postponed until a major release.

Thank you as well for the excellent DTP4 software. It is a truly impressive product, and I greatly appreciate the work that has gone into it.

2 Likes

Thanks. Goal achieved. The intent was to put it on your radar and show that it is feasible. (The last time it came up suggestions were made about feasibility.)

The world of not in a rush.

1 Like

I use DEVONthink less for creative endeavours and more for record keeping and storage of academic journal articles. I use my own ollama model. Being able to incorporate training with RAG would allow significant improvements in automation (e.g. tagging journal files, creating file names for receipts/statements) while maintaining privacy.

2 Likes

Actually it was already on the radar before and we’re evaluating various options.

2 Likes

Simply put, RAG means that the trained knowledge of LLMs is augmented. See my examples above. E.g. a database or web search performed by the chat assistant enhances and updates its knowledge (for example to summarize today’s world wide news). Just like the content or properties of selected documents can extend the trained knowledge and provide relevant context. And a vector database and its semantic search is just another example that provides additional input to the LLM.

1 Like

I recently tried building a related DEVONthink plugin. Its core features are:

  • Hybrid search. It combines keyword search, AI semantic search with RAG, DEVONthink’s “See Also”, and Online result, then merges and ranks them.

  • Read-only by design. It can only read and search your data. It cannot write, edit, or delete anything.

3 Likes

Interesting… how practically useful has it been for you?

I work in English every day, but it isn’t my native language, so my database contains many Chinese materials. RAG helps with finding files across languages. Honestly, I enjoyed building the plugin more than using it, and I don’t use it often. DEVONthink already meets my daily needs.

DEVONthink seems to give higher relevance rank to files in the same folder. From my experience, your design encourages users to organize their materials instead of just collecting everything.

I’m also testing Research Expansion Mode. The agent runs a three-step workflow and produces a structured research report.

Step 1: Review your knowledge base.
Step 2: Search the web for new content.
Step 3: Generate the report.

Normal chat is “you ask, it answers.” Research Expansion is “you give a topic, it runs a full round of literature and web research, then tells you what you have, what’s missing, and what to add.”

Wow. Thanks. Now I just have to go and digest. I just need a test database to play with.

@BLUEFROG practically utility? The repo is 24hrs old. Who knows.

I did just skim the code, and it looks like lit’s relying on the Gemini and OpenAI Embedding models. Which I’ve seen in use for RAG in the Obsidian Copilot plugin.

I don’t have time to test this week or next week, but the code is promising. (I’m not a security expert, so I haven’t done a security audit.)

The age of a repo is not an indicator of a project’s actual age, only when it was pushed to GitHub. I often build and run projects for months to ensure they’re solid and actually useful. And certainly not every project is put into GitHub.

And I was asking about the practical usefulness to the author.

1 Like

No worries and I’m glad to hear DEVONthink works for you out-of-the-box. It does for thousands of others as well!

Honestly, I enjoyed building the plugin more than using it, and I don’t use it often.

Indeed some projects are just nice to teach yourself something and flex a little. I have such a project I’ve been using for a few months and extending throughout January. :slight_smile:

DEVONthink seems to give higher relevance rank to files in the same folder. From my experience, your design encourages users to organize their materials instead of just collecting everything.

Relevance relies on more than location and DEVONthink is built to support both shallow and deep groupings.

significant in what way? You are referring to very menial tasks here.

Did you read this comment above…

I use my own ollama model.

Based on what model?

1 Like