Integrate into your own custom GPT

Add long term memory to your own custom GPTs with MemoryPlugin

Written By asad

Last updated 12 months ago

Custom GPTs

Custom GPTs are a feature in ChatGPT that let you create customized versions of ChatGPT with custom instructions and the ability to integrate documents into its knowledgebase and add capabilities via integrating external APIs.

With MemoryPlugin, you can also add long-term memory functionality to your custom GPT!

We make this very easy to do, all you need to do is import our OpenAPI Spec for Custom Integrations and set up some instructions + your auth token.

Key Concepts

Here’s the basic things you need to understand to set up MemoryPlugin within your custom GPT:

  • APIs - APIs let computer systems talk to each other. In the context of custom GPTs, APIs let your GPT use external tools like MemoryPlugin

  • OpenAPI Spec - This is a file that describes all the functionality of the API that a custom GPT can directly import and use

  • Auth Token - You will need a way to “log into” the API and that’s what the Auth Token does. You can get this from your Dashboard

  • Custom Instructions - You will need to guide the AI how it should use MemoryPlugin. This is just a basic text prompt and we will provide a template for you here

Instructions

Here’s how you can integrate MemoryPlugin into your Custom GPT.

You will want to start by opening the edit GPT window for your existing GPT, or create a new GPT.

The window looks like this:

Within the Configure tab, you will see an Actions section if you scroll the page all the way down.

Click Create new action.

That will bring you to this page. Here, you will want to click Import from URL, and enter the following link:

https://www.memoryplugin.com/openapi.json

Then on the Authentication section, click the Settings icon and select API key. Once you select API key, it will give you a few additional options, you want to select Bearer.

Then go to your MemoryPlugin Dashboard and copy the Auth Token. Keep in mind, this is a password to your account and should be kept confidential. Regenerate it if it’s accidentally exposed.

You will end up with the Authentication section looking like this. Hit Save.

Then back in the Configure tab, you have an Instructions section. You need to instruct your GPT how it should use MemoryPlugin.

  • You will need to tell it to load memories

  • You will need to tell it what kind of information to save to memory

  • You will need to instruct it to use a specific bucket

Please have a look at the prompt shared below, and tweak it to your liking. You can add the MemoryPlugin instructions after your own custom instructions.

Prompt from MemoryPlugin GPT

Shared below is the prompt that is used by the official MemoryPlugin Custom GPT. It is highly advisable that you stick to this version as much as possible, as we have refined it over many months based on issues that were shared with us by users.

Example
VERY IMPORTANT: ALWAYS fetch all memories at the start of each chat before responding (unless explicitly instructed otherwise), so you have context about me and can help me better. Use the `GetMemoriesAndBuckets` operation to do this. The `memory` tool allows you to persist information across conversations. Add to memory any information you want to remember. The information will appear in the context in future conversations. - Memories are stored in "buckets" - If you do not supply a bucket id when loading memories, all memories are loaded - if you do supply a bucket id, only those buckets memories are loaded - by default memories are added to the "General" bucket - new buckets cannot be named "General" - If you supply the bucketId when creating a new memory, it will be added to that bucket instead - Do not guess bucket IDs, they are random - When using bucket IDs, please make sure they are correct and are sent in the correct parameter. - When explicitly instructed to add a memory by the user, follow the users instructions strictly. I can use \m or +m as a shortcut to create a new memory. - before using any tool, review the tool use instructions thoroughly - Double-check the function schemas to make sure you are using the correct expected format. - Make sure your tool and/or function call matches the expected format and schema - if a JSON schema is specified, adhere to it strictly. - Verify all your tool calls with the usage instructions in the system prompt.