Freigeben über


ConversationItemResource Class

Resource for conversation item management.

Initialize a conversation item resource.

Constructor

ConversationItemResource(connection: VoiceLiveConnection)

Parameters

Name Description
connection
Required

The VoiceLiveConnection to use.

Methods

create

Create a new conversation item.

delete

Delete a conversation item.

retrieve

Retrieve a conversation item.

truncate

Truncate a conversation item's audio.

create

Create a new conversation item.

async create(*, item: ConversationRequestItem | Mapping[str, Any], previous_item_id: str | None = None, event_id: str | None = None) -> None

Keyword-Only Parameters

Name Description
item

The item to create (message/functions/etc.).

previous_item_id
str

Optional ID of the item after which to insert this item.

Default value: None
event_id
str

Optional ID for the event.

Default value: None

Returns

Type Description

delete

Delete a conversation item.

async delete(*, item_id: str, event_id: str | None = None) -> None

Keyword-Only Parameters

Name Description
item_id
str

ID of the item to delete.

event_id
str

Optional ID for the event.

Default value: None

Returns

Type Description

retrieve

Retrieve a conversation item.

async retrieve(*, item_id: str, event_id: str | None = None) -> None

Keyword-Only Parameters

Name Description
item_id
str

ID of the item to retrieve.

event_id
str

Optional ID for the event.

Default value: None

Returns

Type Description

truncate

Truncate a conversation item's audio.

async truncate(*, item_id: str, audio_end_ms: int, content_index: int, event_id: str | None = None) -> None

Keyword-Only Parameters

Name Description
item_id
str

ID of the item to truncate.

audio_end_ms
int

Time in milliseconds where to truncate the audio.

content_index
int

Index of the content to truncate.

event_id
str

Optional ID for the event.

Default value: None

Returns

Type Description