#Sequence prompting

1 messages · Page 1 of 1 (latest)

hard burrow
#

I want to follow a sequence of prompts.
Each time I make a call to the API it starts off with no prior context, unlike the chat.openai.com
Is there a way to maintain state of the model during a session?

Here's an example of what I'm looking for:
Prompt 1: [Prompt]
Prompt 2: With the result from Prompt 1, do [action].
Prompt 3: With the result from Prompt 2, do [action].

wraith sonnet
#

For example:

#
[
  {
    "role": "user",
    "content": "What's 1+1"
  },
  {
    "role": "assistant",
    "content": "1+1 equals 2"
  },
  {
    "role": "user",
    "content": "Now divide that by 4"
  },
  {
    "role": "assistant",
    "content": "2 divided by 4 equals 0.5"
  }
]

This is how a message object may look like, by using this approach, chatgpt will use previous responses to answer a question

hard burrow
wraith sonnet
# hard burrow Thanks for responding. Wouldn't including the message myself be a manual process...

Not necessairly, first you make an array, you append the first question to it, e.g. ```json
{
"role": "user",
"content": "What's 1+1"
}

then you make your API call using this array, when you get a response, you append that to the array aswell, your array will look something like this now: 
```json
[
  {
    "role": "user",
    "content": "What's 1+1"
  },
  {
    "role": "assistant",
    "content": "1+1 equals 2"
  }
]

Then you append another message to the array etc. You can repeat this process as many times you want