How to "modify" an API response, with a second API call?

Hi,

I am new here, and new to this in general - so please bear with me.

I want to “modify” an API response.
Meaning - I asked ChatGPT, using an API call, to write a story, let’s say.
Now, I want to shorten this story. With a new API call. How do I pass and “connect” the previous response with this new one? is there some “ID” for the first response I can use?
For better context - I am using Wized (Webflow, FinSweet), I am not a developer and don’t how to write code.
Thanks everyone

Welcome to the forum.

There is no “state”… which means you need to send the entire prompt (what you want in it) each time… so in your case you would send back the output with a message like “Make this shorter…” or similar.

Good luck!

You have to post whatever part of the prior conversation you’d like to use for the “context” of your question:

Assuming you have this as your request:

public class ChatGPTRequest {
    private String model;
    private List<ChatMessage> messages;
    private double temperature;
}

and Chat Message as

public class ChatMessage {
    private String role;
    private String content;
}

Just submit all prior “conversation” questions and answers each time, The “role” will be alternating between “assistant” and “user” in this list of ChatMessages. Also you can make the first ChatMessage be a “system” role to configure the “system” (tells AI what it’s role will be…like “You are a helpful assistant”)

Of course the final (at the end of the list) “user” ChatMessage represents the “new” question you’re asking.

EDIT: My app has a “hierarchical context” based on a tree structure so in this class:

you can see the buildChatHistory method ‘walks up’ the conversation thread to build all the “context” it can find.