Prompt Buddy logoPrompt Buddy

openai · OpenAI Platform Docs

Conversation state

Methods for maintaining context in multi-turn interactions using manual message appending, the Conversations API for durable state management, or the previousresponseid parameter for threading responses.

Import to Prompt Buddy

Derived skill

Files assembled from official documentation

Viewing SKILL.md

Conversation state

Methods for maintaining context in multi-turn interactions using manual message appending, the Conversations API for durable state management, or the previousresponseid parameter for threading responses.

When To Use

Use when you need to implement multi-turn chat interfaces, persist conversation history across sessions, or chain model responses using specific identifiers.

Reference Files

FileContainsUse For
SKILL.mdEntry point: scope, routing table, and workflow.Start here.
docs/conversation-state-workflow-guide.mdA guide explaining methods for manually managing conversation state and using the Conversations API to preserve context across multiple message turns.Questions about a guide explaining methods for manually managing conversation state and using the Conversations API to preserve conte...
examples/conversation-state-openai-conversation-state.javascriptA JavaScript code example demonstrating how to pass a sequence of user and assistant messages to maintain conversation state using the OpenAI SDK.Exact payloads, commands, or snippets shown in A JavaScript code example demonstrating how to pass a sequence of user and assistant messages to maintain conversatio...
examples/conversation-state-openai-platform-docs-conversation-state.pythonA Python script demonstrating how to pass a list of message roles and content to the OpenAI client to maintain conversation state.Exact payloads, commands, or snippets shown in A Python script demonstrating how to pass a list of message roles and content to the OpenAI client to maintain conver...
examples/conversation-state-openai-conversation-state-javascript-history-manageme.javascriptA JavaScript example demonstrating how to manually manage conversation history by appending model responses to a local array for subsequent API calls.Exact payloads, commands, or snippets shown in A JavaScript example demonstrating how to manually manage conversation history by appending model responses to a loca...
examples/conversation-state-openai-conversation-state-python-history-management.pythonA Python script demonstrating how to manually manage conversation history by appending model responses to a list of message objects.Exact payloads, commands, or snippets shown in A Python script demonstrating how to manually manage conversation history by appending model responses to a list of m...
examples/conversation-state-openai-conversation-state.pythonA Python code example demonstrating how to create and manage conversation state using the OpenAI API.Exact payloads, commands, or snippets shown in A Python code example demonstrating how to create and manage conversation state using the OpenAI API.
examples/conversation-state-openai-conversation-state-2.pythonA Python code example demonstrating how to use the openai.responses.create method with a conversation ID to maintain state.Exact payloads, commands, or snippets shown in A Python code example demonstrating how to use the openai.responses.create method with a conversation ID to maintain...
examples/conversation-state-openai-platform-conversation-state.javascriptA JavaScript example demonstrating how to maintain conversation state using the OpenAI API by passing a previous response ID to a new request.Exact payloads, commands, or snippets shown in A JavaScript example demonstrating how to maintain conversation state using the OpenAI API by passing a previous resp...
examples/conversation-state-openai-conversation-state-3.pythonA Python script demonstrating how to maintain conversation state using the previous_response_id parameter in the OpenAI API.Exact payloads, commands, or snippets shown in A Python script demonstrating how to maintain conversation state using the previousresponseid parameter in the OpenAI...

What This Skill Covers

  • OpenAI provides a few ways to manage conversation state, which is important for preserving information across multiple messages or turns in a conversation.
  • Main sections: Manually manage conversation state, OpenAI APIs for conversation state, Using the Conversations API, Passing context from the previous response, previousresponseid in WebSocket mode.

Workflow

  1. Open the most relevant file under docs/ for the exact documented workflow and wording.
  2. Open schemas/ files for exact structured contracts.
  3. Open examples/ files for concrete requests, commands, snippets, and manifests.
  4. Do not add behavior or configuration that is not present in the attached source files.

Canonical source: https://developers.openai.com/api/docs/guides/conversation-state.md