Prompt Buddy logoPrompt Buddy

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.

Import to Prompt Buddy

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

FileContainsUse For
SKILL.mdEntry point: scope, routing table, and workflow.Start here.
docs/conversation-state-openai-api-workflow-guide.mdA 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.textA 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-.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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

  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