Implementation:Openai Openai python Response Compaction Item Param
| Knowledge Sources | |
|---|---|
| Domains | API_Types, Responses_API |
| Last Updated | 2026-02-15 00:00 GMT |
Overview
Concrete parameter type for supplying a compaction item as input to the Responses API, provided by the openai-python SDK.
Description
ResponseCompactionItemParam is a Pydantic model used to pass a compaction item (generated by the v1/responses/compact API) back into a subsequent Responses API request. It contains the encrypted_content of the compaction summary, a fixed type of "compaction", and an optional id field. This type is auto-generated from the OpenAI OpenAPI specification by Stainless.
Usage
Import ResponseCompactionItemParam when constructing input items for a Responses API request that should include previously compacted conversation data.
Code Reference
Source Location
- Repository: openai-python
- File: src/openai/types/responses/response_compaction_item_param.py
Signature
class ResponseCompactionItemParam(BaseModel):
"""A compaction item generated by the v1/responses/compact API."""
encrypted_content: str
type: Literal["compaction"]
id: Optional[str] = None
Import
from openai.types.responses import ResponseCompactionItemParam
I/O Contract
Fields
| Name | Type | Required | Description |
|---|---|---|---|
| encrypted_content | str |
Yes | The encrypted content of the compaction summary. |
| type | Literal["compaction"] |
Yes | The type of the item. Always "compaction".
|
| id | Optional[str] |
No | The ID of the compaction item. |
Usage Examples
from openai.types.responses import ResponseCompactionItemParam
# Pass a compacted summary back into a new request
compaction_input = ResponseCompactionItemParam(
encrypted_content="encrypted_abc123...",
type="compaction",
)
response = client.responses.create(
model="gpt-4o",
input=[compaction_input],
)