OpenAIResponsesCompactionSessionOptions
이 콘텐츠는 아직 번역되지 않았습니다.
type OpenAIResponsesCompactionSessionOptions = object;Properties
Section titled “Properties”client?
Section titled “client?”optional client: OpenAI;OpenAI client used to call responses.compact.
When omitted, the session will use getDefaultOpenAIClient() if configured. Otherwise it
creates a new OpenAI() instance via new OpenAI().
model?
Section titled “model?”optional model: OpenAI.ResponsesModel;The OpenAI model to use for responses.compact.
Defaults to DEFAULT_OPENAI_MODEL. The value must resemble an OpenAI model name (for example
gpt-*, o*, or a fine-tuned ft:gpt-* identifier), otherwise the constructor throws.
shouldTriggerCompaction()?
Section titled “shouldTriggerCompaction()?”optional shouldTriggerCompaction: (context) => boolean | Promise<boolean>;Custom decision hook that determines whether to call responses.compact.
The default implementation compares the length of OpenAIResponsesCompactionDecisionContext.compactionCandidateItems to an internal threshold (10). Override this to support token-based triggers or other heuristics using OpenAIResponsesCompactionDecisionContext.compactionCandidateItems or OpenAIResponsesCompactionDecisionContext.sessionItems.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
|
|
Returns
Section titled “Returns”boolean | Promise<boolean>
underlyingSession?
Section titled “underlyingSession?”optional underlyingSession: Session & object;Session store that receives items and holds the compacted history.
The underlying session is the source of truth for persisted items. Compaction clears the
underlying session and writes the output items returned by responses.compact.
This must not be an OpenAIConversationsSession, because compaction relies on the Responses
API previous_response_id flow.
Defaults to an in-memory session for demos.
Type Declaration
Section titled “Type Declaration”| Name | Type |
|---|---|
|
|
|