"Save to Devonthink" from ChatGPT: A Truly Useful Academic Workflow

I have explored all sorts of AI software to help with academic research. My goal is not for AI to write content for me but rather to help me locate the best sources. Lots of AI apps have issues with hallucinating false information. And when they do not hallucinate there are issues of finding pertinent information and how to format/archive that information in a useful way.

The example here demonstrates a workflow for medicine but it would be applicable for any academic discipline. The automation with Devonthink is applicable for many other use cases too.

The tools:

  • Consensus is a “RAG AI” academic search application. That means it queries with AI but its output is restricted to specific content from the web (Retrieval Augmented Generatoin) - thus its rate of hallucination, while not zero, is extremely low. While everything needs to be verified, I find it more accurate for most searches than PubMed
  • Consensus can be used not only as a web app but also as a “Custom GPT” if you have paid for an OpenAI GPT Plus subscription - this looks like ChatGPT but it is RAG based so it has the same extremely low rate of hallucination

  • If you subscribe to ChatGPT plus you also have the ability to create your own custom GPT which helps limit hallucination and/or helps you integrate with any apps on the web that have an API or webhook support:

  • Creating a custom GPT is not hard at all - it is based on prompts, not coding. And there is even a custom GPT which is amazing at writing schemas for creating your own custom GPT. I was able to create a custom GPT for this project in under 30 minutes.

This is the schema for my “Save to Devonthink” Custom GPT created with the GPT Action Schema Creator:

{
  "openapi": "3.0.0",
  "info": {
    "title": "Send Chat as HTML to Devonthink",
    "version": "1.0.0",
    "description": "This action captures specified chat content and sends it as raw HTML to the specified webhook URL: https://hook.us1.make.com/xxxxxxxxxx, along with a suggested file title. The response from the webhook is then relayed back to the GPT. This is triggered by the GPT request 'Save to Devonthink'."
  },
  "servers": [
    {
      "url": "https://hook.us1.make.com/xxxxxxxxx",
      "description": "Webhook server to receive chat content in HTML format for Devonthink"
    }
  ],
  "paths": {
    "/": {
      "get": {
        "summary": "Send HTML content and title to Devonthink webhook",
        "operationId": "SendChatAsHTMLtoDevonthink",
        "parameters": [
          {
            "name": "htmlContent",
            "in": "query",
            "required": true,
            "description": "Raw HTML content of the chat to be sent",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "suggestedTitle",
            "in": "query",
            "required": true,
            "description": "Suggested title for the resulting HTML file",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Returns the response from the webhook",
            "content": {
              "application/json": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "description": "Shows the actual raw failure message"
          }
        }
      }
    }
  }
}
  • Make.com is a web automation site competing with Zapier - in many ways it is easier to use and more capable as well as less expensive than Zapier. I was able to create a Make.com scenario to integrate my custom GPT with Dropbox in under 30 minutes.

This is the blueprint that can be imported to re-create the scenario in make.com:

blueprint.json.zip (1.9 KB)

  • Devonthink integrates with Dropbox through indexing. So if I can automate saving to a specific Dropbox folder I have actually automated integrating with Devonthink

So how does this all come together?

I can do a query on the Consensus custom GPT. Then if I prefix my next query with @ it lets me route the query to my custom “Save to Devonthink” GPT. The results are then saved to the designated group in Devonthink based on the instructions I give in the GPT.

Net result:

And this is the output saved to my Devonthink database:

PRP for Elbow Pain - PubMed Articles Summary-1.html.zip (2.9 KB)

This is probably the most useful automation/workflow I have ever created - it is profoundly helpful to me in working on academic literature queries and is equally applicable to many other use cases as well.

ChatGPT costs $20/month. Make.com has a free tier but you are likely to want the $9/month tier. The practical utility from that is pretty notable for anyone who uses the web to search for accurate information with citations to the source.

9 Likes

Where is this illustrated?

My original prompt to the custom GPT was not included in the post:

I did include the subsequent prompt to revise the desired output format slightly:

@BLUEFROG

If your question is how do I query the Consensus Custom GPT and then use its output as the basis for a prompt to my own custom GPT, I press the @ button and ChatGPT Plus comes up with a menu letting me switch to a different custom GPT for the next prompt:

Yes, that’s what I was wondering. I don’t have access to Consensus as I don’t have an upgraded ChatGPT account at this time.

I have not fully understood, what make.com is needed for in this workflow.

I think it’s, in this workflow, essentially a web server that receives and returns information. I won’t be surprised if there are other ways (e.g. through API server of Obsidian or Logseq) to save the content. Any workflow is good as long as it works as intended.

Is it possible to use onedrive instead of Dropbox? Do I have to change any code for that, or would the make.com settings allow to do so?

The “Action” step in the “Save to Devonthink” custom GPT is upload a file to Dropbox. This requires specifying either an API call to do this or a webhook to do this.

While I am familiar with API calls and have a modest knowledge of Javascript, these take me a whole lot longer to do than they would take a professional full-time coder. Make.com is a GUI which lets you create either API calls or webhooks with no code and much faster than by coding.

So yes, you could build my workflow in many other ways; what I have shown is a way to build it that works well and takes minimal time.

Yes, Devonthink can index a OneDrive folder. And Make.com supports uploading files to OneDrive. You would simply change the Dropbox step in make.com and substitute the module to upload a file to OneDrive.

Make.com supports over 1,000 other web apps as well - so you could modify the workflow to do lots of other things instead of or in addition to “Save to Devonthink.”

Thanks for the really intriguing workflow! I am reconsidering my academic and writing workflow, and recognize the potential great value of your process. I am super-intrigued, but also am totally new to using AI. Therefore, I would like to ask for a few clarifications regarding your process, and please forgive any dumb questions on my part.

I have a subscription to Chat GPT Pro, and have saved Consensus to my sidebar. To my understanding, you start by prompting Consensus to minimize hallucinations. So far, so good.

Your statement, ‘If you subscribe to ChatGPT plus you also have the ability to create your own custom GPT which helps limit hallucination and/or helps you integrate with any apps on the web that have an API or webhook support’ means that you are using Consensus on top of Chat GPT (which you mentioned above), but nothing new in the process, is that correct?

You then inserted an image of your custom GPT (Save to Devonthink?), which I presume you created in GPT Action Schema Creator, is that correct? Here is where I get a bit confused, sorry to say.

My best guess is that GPT Action Schema Creator works through Make, to save the GPT output to your Dropbox folder, which is synced to DTP. If that is correct, how did you start in GPT Action Schema Creator? How did you get it to see and interact with Make?

Once I figure this out, I believe I understand your workflow: You prompt Consensus, review the output, then if you like and trust the output, you hit the @, select your custom “Save to Devonthink” GPT to run the same prompt, which then works through Make to send the output to Dropbox, which is then, I presume, indexed with Devonthink.

Let me know if I am completely off-base. Again, kudos for your excellent work and thank you for sharing it.

Gretings @sawxray - I am glad to answer questions. All questions are good ones.

1 - A subscription to Chat GPT Plus gives you the ability to view lots of custom GPTs, of which Consensus is one. A GPT is a customized version of ChatGPT that has a specialized field of knowledge or is programmed to do some specialized functions.

[Soon OpenAI plans to make it free to view public GPTs - but still you will need ChatGPT Plus to make your own]

This is the collection of publicly shared custom GPTs - among these is Consensus

https://openai.com/index/introducing-the-gpt-store/

2 - I created a custom GPT through this OpenAI site

https://chatgpt.com/gpts/mine

Further instructions here -

https://help.openai.com/en/articles/8554397-creating-a-gpt

3 - Creating a Schema is the hardest part of creating your own custom GPT - this is a custom GPT to help you make the Schema - it makes it much easier to create the GPT

https://chatgpt.com/g/g-SENFY7fep-gpt-action-schema-creator

  1. You still have to tell the Schema Creator how to save the output of your GPT to Dropbox (or wherever else you want to do that). Normally that requires writing code to call APIs or webhooks. Make.com simplifies that process enormously. You can instead create a Make.com webhook scenario. Then just tell the Schema Creator GPT that for your action you want to call the make.com webhook by giving the schema creator the URL for your make.com scenario

So basically I told the Schema Creator - “I need a schema for a custom GPT that takes the chat output, converts it to HTML, and passes that HTML to a webhook with URL http://www.xxxxxxxxxx.xxxx”. Then the schema creator gave me the schema which I could copy/paste into the GPT creator. Later if I want to make changes I can just copy/paste the schema back to the Schema creator and say “Change this schema so it does yyyy instead of/in addition to xxx”

You seem to understand about 90% of it - hopefully that clarifies the rest - if not let me know what else you need to know

If you wanted - as a first step you could just take my schema and substitute your own make.com webhook URL and put that into your custom GPT - that should work.

Also - you do not repeat the prompt when you go to @Save to Devonthink. You need only prompt it with “Save to Devonthink.” Or simply “Save” may work. Or “Save with a bigger font” or “Save with an extra column summarizing the abstract” etc etc etc.

1 Like

@rkaplan Thanks so much for taking the time to respond, with all the detail you provided. Appreciated!

To follow on, step by step:

  1. No problem. Subscribed to Chat GPT, plan to use it. No trouble finding Consensus, adding it to the sidebar, and giving it prompts as a custom GPT within Chat GPT. We’re all good there, everything works.

  2. and 3. I’m a little lost at the 10,000 foot level about the relationship of the custom GPT (Save to Devonthink) and the schema. If I understand correctly from your detailed description, the custom GPT takes your prompt and creates the output, the schema waits for the output and then acts on it by converting it to HTML, the schema then sends the HTML to your custom Make process. Its probably obvious to regular users of Chat GPT, sorry if I’m being dense!

If I am getting closer to squeezing this into my head, may I ask what step you started your Make process with? And does your Make process convert the HTML?

As regards ‘Also - you do not repeat the prompt when you go to @Save to Devonthink. You need only prompt it with “Save to Devonthink.” Or simply “Save” may work. Or “Save with a bigger font” or “Save with an extra column summarizing the abstract” etc etc etc.’:

My understanding was that you had run a prompt first in Consensus; then you enter @; then you have a pull-down with choices, including your custom GPT ‘Save to Devonthink,’ so that all you had to do after ‘@’ is click that custom GPT. I believe I have that right. The additional examples you added can modify the Save to Devonthink but still follow on to the custom GPT and the schema.

Many thanks again for sharing, and for helping us understand. It’s tremendously exciting for me! Kudos to you.

Custom GPT and Schema - The Schema is the method OpenAI has devised to configure or define how a GPT will work. At base, a GPT starts out with the same abilities as ChatGPT. The schema lets you restrict or add to those abilities. You can limit the scope of response a GPT can offer. You can define specific data/documents which the GPT will use instead of or in addition to the standard GPT knowledge base. And you can add “Actions” to a GPT; Actions allow a GPT to interact with the rest of the internet in order to receive or send data.

A schema is not written in programming code but rather generally written in natural language. But it needs to be formatted using JSON in a very structured way. The Schema Creator helps you to create the JSON schema so you need not focus on the specific formatting rules.

My “Save to Devonthink” schema is pretty simple. It has standard default ChatGPT capabilities except that I add to it one action. The action I add is that a “Save” command will send the requested content in HTML format to a webhook. The ability to create HTML content is a standard core ability of ChatGPT. You could easily define fonts, colors, columns in a talbe, etc just by adjusting your prompt to the GPT; that’s all standard ChatGPT capabilitiy.

In turn, the webhook is hosted at make.com. That webhook scenario takes the HTML it receives, creates a Dropbox file with it, and sends back a response confirming success.

Make.com Scenario - My original post includes an image of the Make.com scenario as well as a “blueprint.” You can import that blueprint into make.com in order to re-create it (just add your own Dropbox credentials). It is a pretty straightforward make.com scenario with just 3 steps: (1) Receive HTML via Webhook; (2) Create a file in Dropbox using the received HTML data; and (3) Send a Webhook response confirming success

Sounds like you understand the rest of it well.

do I understand it correctly, that make.com needs full access to dropbox? do you trust them for allowing such access rights?

Yes - they are a competitor to Zapier and similarly respected/trusted. I have never heard any issues of security breaches from either.

But to be clear - you are authorizing access to Dropbox via Oauth2 - you do not give make.com your Dropbox login/password.

If you are not willing to work with web integrations like that then you are losing out on some incredibly useful use cases on the web.

Emphasis definitely mine. :wink:

This is only distantly related to Devonthink at this point - but the end result does end with “Save to Devonthink” and certainly a good number of those who use Devonthink are interested in its application in academic and related professional work.

TypingMind is a AI front-end which allows use of multiple language models and also allows use of custom plugins to enhance the capability of off-shelf LLMs.

Consensus.app is an outstanding AI-driven search engine which retrieves academic citations in almost any field. They have recently relased a beta API.

I configured their API to work with TypingMind. The result is an impressive ability to analyze, critique, and/or rebut academic articles. [And then save the result to Devonthink.]