OpenAIConversationsSession
이 콘텐츠는 아직 번역되지 않았습니다.
Implements
Section titled “Implements”SessionOpenAISessionApiTagged<"conversations">
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new OpenAIConversationsSession(options?): OpenAIConversationsSession;Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
|
|
Returns
Section titled “Returns”OpenAIConversationsSession
Properties
Section titled “Properties”[OPENAI_SESSION_API]
Section titled “[OPENAI_SESSION_API]”readonly [OPENAI_SESSION_API]: "conversations";Implementation of
Section titled “Implementation of”OpenAISessionApiTagged.[OPENAI_SESSION_API]Accessors
Section titled “Accessors”sessionId
Section titled “sessionId”Get Signature
Section titled “Get Signature”get sessionId(): string | undefined;Returns
Section titled “Returns”string | undefined
Methods
Section titled “Methods”addItems()
Section titled “addItems()”addItems(items): Promise<void>;Append new items to the conversation history.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
|
|
|
Items to add to the session history. |
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”Session.addItemsclearSession()
Section titled “clearSession()”clearSession(): Promise<void>;Remove all items that belong to the session and reset its state.
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”Session.clearSessiongetItems()
Section titled “getItems()”getItems(limit?): Promise<AgentInputItem[]>;Retrieve items from the conversation history.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
|
|
|
The maximum number of items to return. When provided the most recent limit items should be returned in chronological order. |
Returns
Section titled “Returns”Promise<AgentInputItem[]>
Implementation of
Section titled “Implementation of”Session.getItemsgetSessionId()
Section titled “getSessionId()”getSessionId(): Promise<string>;Ensure and return the identifier for this session.
Returns
Section titled “Returns”Promise<string>
Implementation of
Section titled “Implementation of”Session.getSessionIdpopItem()
Section titled “popItem()”popItem(): Promise<AgentInputItem | undefined>;Remove and return the most recent item from the conversation history if it exists.
Returns
Section titled “Returns”Promise<AgentInputItem | undefined>
Implementation of
Section titled “Implementation of”Session.popItemprepareHistoryItemForModelInput()
Section titled “prepareHistoryItemForModelInput()”prepareHistoryItemForModelInput(item): AgentInputItem;Optionally rewrite a stored history item before it is sent back to the model.
Session implementations can use this to strip provider-managed replay metadata while
preserving their public getItems() shape for UI and deletion workflows.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
|
|
|
Returns
Section titled “Returns”AgentInputItem
Implementation of
Section titled “Implementation of”Session.prepareHistoryItemForModelInputprepareHistoryItemsForPersistenceComparison()
Section titled “prepareHistoryItemsForPersistenceComparison()”prepareHistoryItemsForPersistenceComparison(items): AgentInputItem[];Optionally normalize stored and expected history before persistence reconciliation compares them.
Session implementations can use this to remove backend-assigned metadata while preserving
their public getItems() shape.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
|
|
|
Returns
Section titled “Returns”AgentInputItem[]
Implementation of
Section titled “Implementation of”Session.prepareHistoryItemsForPersistenceComparisonpreserveReasoningItemIdsForPersistence()
Section titled “preserveReasoningItemIdsForPersistence()”preserveReasoningItemIdsForPersistence(): boolean;Optionally preserve reasoning item IDs when persisting generated output.
Some remote session stores require provider-assigned reasoning identities to accept stored reasoning items, even when model replay should omit those IDs.
Returns
Section titled “Returns”boolean
Implementation of
Section titled “Implementation of”Session.preserveReasoningItemIdsForPersistencereplaceHistoryWithCompaction()
Section titled “replaceHistoryWithCompaction()”replaceHistoryWithCompaction(items): Promise<void>;Optionally replace the logical session history with a compaction marker and its retained suffix without resetting the session identity.
Implementations may append the replacement when their backend treats the leading compaction item as the authoritative replay boundary. If this method is absent, the runner falls back to clearing and rebuilding the session with rollback protection.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
|
|
|
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”Session.replaceHistoryWithCompaction