openai · OpenAI Platform Docs
Conversation state | OpenAI API
Explains how to manage and maintain context in multi-turn interactions by passing previous message history back to the model.
Derived skill
Files assembled from official documentation
Viewing SKILL.md
Conversation state | OpenAI API
Explains how to manage and maintain context in multi-turn interactions by passing previous message history back to the model.
When To Use
Use when you need to implement multi-turn chat interfaces or maintain context across a sequence of user and assistant messages.
Reference Files
| File | Contains | Use For |
|---|---|---|
SKILL.md | Entry point: scope, routing table, and workflow. | Start here. |
docs/conversation-state-openai-api-workflow-guide.md | A guide explaining methods for managing conversation state and context across multiple turns using OpenAI APIs. | Questions about a guide explaining methods for managing conversation state and context across multiple turns using OpenAI APIs. |
examples/conversation-state-openai-api-openai-api-chat-completions-conversation-s.text | A JavaScript code example demonstrating how to pass a sequence of message roles and content to maintain conversation state using the OpenAI Chat Completions API. | Exact payloads, commands, or snippets shown in A JavaScript code example demonstrating how to pass a sequence of message roles and content to maintain conversation... |
examples/conversation-state-openai-api-openai-api-python-conversation-state-chat-.text | A Python script demonstrating how to maintain conversation state by passing a list of previous message roles and content to the chat completions endpoint. | Exact payloads, commands, or snippets shown in A Python script demonstrating how to maintain conversation state by passing a list of previous message roles and cont... |
examples/conversation-state-openai-api-openai-api-conversation-state-nodejs.text | A Node.js code example demonstrating how to pass a sequence of user and assistant messages to maintain conversation state using the OpenAI API. | Exact payloads, commands, or snippets shown in A Node.js code example demonstrating how to pass a sequence of user and assistant messages to maintain conversation s... |
examples/conversation-state-openai-api-openai-api-conversation-state-python.text | A Python script demonstrating how to pass a list of message roles and content to maintain conversation state using the OpenAI client. | Exact payloads, commands, or snippets shown in A Python script demonstrating how to pass a list of message roles and content to maintain conversation state using th... |
examples/conversation-state-openai-api-openai-api-chat-completions-nodejs-convers.text | A Node.js code example demonstrating how to manually manage conversation state by appending chat completion messages to a history array. | Exact payloads, commands, or snippets shown in A Node.js code example demonstrating how to manually manage conversation state by appending chat completion messages... |
examples/conversation-state-openai-api-openai-api-python-conversation-history-man.text | A Python script demonstrating how to maintain conversation state by appending chat completion messages to a history list. | Exact payloads, commands, or snippets shown in A Python script demonstrating how to maintain conversation state by appending chat completion messages to a history l... |
examples/conversation-state-openai-api-openai-api-conversation-state-nodejs-histo.text | A Node.js code example demonstrating how to manage conversation history and use the store parameter with the OpenAI API. | Exact payloads, commands, or snippets shown in A Node.js code example demonstrating how to manage conversation history and use the store parameter with the OpenAI API. |
examples/conversation-state-openai-api-openai-api-python-conversation-history-man-2.text | A Python script demonstrating how to manually manage conversation state by appending model responses to a message history list using the OpenAI client. | Exact payloads, commands, or snippets shown in A Python script demonstrating how to manually manage conversation state by appending model responses to a message his... |
examples/conversation-state-openai-api-openai-api-conversation-state-create.text | A text example demonstrating the use of the openai.conversations.create method to manage conversation state. | Exact payloads, commands, or snippets shown in A text example demonstrating the use of the openai.conversations.create method to manage conversation state. |
examples/conversation-state-openai-api-openai-api-conversation-state-python-reque.text | A Python code snippet demonstrating how to pass a conversation ID to the OpenAI API to maintain conversation state. | Exact payloads, commands, or snippets shown in A Python code snippet demonstrating how to pass a conversation ID to the OpenAI API to maintain conversation state. |
examples/conversation-state-openai-api-openai-api-conversation-state-nodejs-2.text | A Node.js code example demonstrating how to maintain conversation state using the OpenAI API by passing a previous response ID. | Exact payloads, commands, or snippets shown in A Node.js code example demonstrating how to maintain conversation state using the OpenAI API by passing a previous re... |
examples/conversation-state-openai-api-openai-api-conversation-state-python-2.text | A Python script 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 Python script demonstrating how to maintain conversation state using the OpenAI API by passing a previous response... |
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
- Open the most relevant file under
docs/for the exact documented workflow and wording. - Open
schemas/files for exact structured contracts. - Open
examples/files for concrete requests, commands, snippets, and manifests. - 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
