History with conversation client.chat.completion

I want to translate a very long text and split it into small pieces.
I want each small text piece I ask the CHATGPT for its summary.
Create a conversation with ChatGPT for the first text piece. The next text pieces will be in this conversation.

but my code seems to always create new conversations.

def create_message(self):
    return [
        {"role": "system", "content": self.system_message},
        {"role": "user", "content": self.ffc_message},
        {"role": "user", "content": self.cgc_messag},
    ]

    for idx, segment in enumerate(segments):
        try:
            prompt = self.create_prompt(segment)
            if idx == 0:
                messages = self.create_message()
                messages.append({"role": "user", "content": prompt})
            else:
                # Continue the conversation with subsequent segments
                messages.append({"role": "user", "content": prompt})
            response = self.client.chat.completions.create(
                model=self.model,
                messages=messages,
                max_tokens=1000,
                n=1,
                stop=None,

                # conversation_id=conversation_id
            )
            # completion = response.parse()
            assistant_response = response.choices[0].message.content.strip()

Your operations shown do not constitute a “chat”.

A conversation is not just me telling you things - it is you remembering what we had just discussed.

It is also not you just blindly reading a document to me every time we talk - maybe you’d want to tell me what you expect from me in every following thing you say - instructions.

Therefore, you’ll need to append both the last AI response as “assistant”, and only then the newest task you want AI to perform as “user”.

You can see that happening at the bottom of this linked post where the chat history has assistant appended.

(it also lets you see the streaming chunks of a function call that has no code listening if you ask for a fortune).