This topic was automatically generated from Slack. You can find the original thread here.
Not sure if this is a flaw in the standard ChatGPT app works however, I’m running into an interesting problem when I set up a db for storing ChatGPT-4 conversation and using them as “message history”. Specifically, since the ChatGPT app is using the message history, it ignores the System message prop, which means that the first time the ChatGPT function runs, there’s no system instructions to give it context. See my loom here:
One thing I do in some of our own code. Don’t persist the system message in the chat history. Just:
Pull the rest of the messages from history
Construct the messages array you pass to GPT like so:
const history = this.db.get("history") ?? []
return [
{ role: "system", content: "System message" },
...history // expected to be an array of objects in the same format
]
[2:08 PM]
I am processing what you are saying. I read your other suggestion as well. The challenge I have is that my system message has injected step variables. The way it is set up now, the system message variables keep changing when the new user message processes. This is due to the persistence of the system message based on the way the db store is handling the message history. Ideally, I only need the first chat completion to store the system message with the injected step variables and be saved in the message history as an anchor system message that can be referenced in the message history (where the initial step variables don’t change), along with the current array of user/assistant message string.
(To your question, I am uncertain as to how I would initialize the the message history with the system message to start. My assumption is a custom ChatGPT code step based on your suggested handling of the system message and message history)
Thank you again for sharing your patience and knowledge, I appreciate it immensly.
daveshap/PineconeInfiniteMemoryChatbot
Let’s use Pinecone to give a basic chatbot INFINITE MEMORY Stars
174 Language
Python
Added by GitHub
Dylan Sather (Pipedream) [2:21 PM]
That makes sense re: the variable system message. At the end of the day, you just need to construct an array of objects in that message format that the Chat API expects. I’d try thinking about the problem from that perspective — you should be able to apply your rules and retrieve message history to generate the right array format for each execution, and pass that array to the Chat action in Pipedream.