OpenAIConversationsSession class
Properties
| session |
|
| [OPENAI_SESSION_API] |
Methods
| add |
Append new items to the conversation history. |
| clear |
Remove all items that belong to the session and reset its state. |
| get |
Retrieve items from the conversation history. |
| get |
Ensure and return the identifier for this session. |
| pop |
Remove and return the most recent item from the conversation history if it exists. |
Constructor Details
OpenAIConversationsSession(OpenAIConversationsSessionOptions)
new OpenAIConversationsSession(options?: OpenAIConversationsSessionOptions)
Parameters
- options
-
OpenAIConversationsSessionOptions
Property Details
sessionId
string | undefined sessionId
Property Value
string | undefined
[OPENAI_SESSION_API]
[OPENAI_SESSION_API]: "conversations"
Property Value
"conversations"
Method Details
addItems(AgentInputItem[])
Append new items to the conversation history.
function addItems(items: AgentInputItem[]): Promise<void>
Parameters
- items
-
AgentInputItem[]
Items to add to the session history.
Returns
Promise<void>
clearSession()
Remove all items that belong to the session and reset its state.
function clearSession(): Promise<void>
Returns
Promise<void>
getItems(number)
Retrieve items from the conversation history.
function getItems(limit?: number): Promise<AgentInputItem[]>
Parameters
- limit
-
number
The maximum number of items to return. When provided the most recent <xref:limit> items should be returned in chronological order.
Returns
Promise<AgentInputItem[]>
getSessionId()
Ensure and return the identifier for this session.
function getSessionId(): Promise<string>
Returns
Promise<string>
popItem()
Remove and return the most recent item from the conversation history if it exists.
function popItem(): Promise<AgentInputItem | undefined>
Returns
Promise<AgentInputItem | undefined>