Skip to content

message

Classes:

Name Description
IncompleteDetails
Message

IncompleteDetails

Attributes:

Name Type Description
reason Literal['content_filter', 'max_tokens', 'run_cancelled', 'run_expired', 'run_failed']

The reason the message is incomplete.

reason instance-attribute

reason: Literal[
    "content_filter",
    "max_tokens",
    "run_cancelled",
    "run_expired",
    "run_failed",
]

The reason the message is incomplete.

Message

Attributes:

Name Type Description
assistant_id Optional[str]

If applicable, the ID of the

completed_at Optional[int]

The Unix timestamp (in seconds) for when the message was completed.

content List[MessageContent]

The content of the message in array of text and/or images.

created_at int

The Unix timestamp (in seconds) for when the message was created.

file_ids List[str]

A list of file IDs that

id str

The identifier, which can be referenced in API endpoints.

incomplete_at Optional[int]

The Unix timestamp (in seconds) for when the message was marked as incomplete.

incomplete_details Optional[IncompleteDetails]

On an incomplete message, details about why the message is incomplete.

metadata Optional[object]

Set of 16 key-value pairs that can be attached to an object.

object Literal['thread.message']

The object type, which is always thread.message.

role Literal['user', 'assistant']

The entity that produced the message. One of user or assistant.

run_id Optional[str]

If applicable, the ID of the

status Literal['in_progress', 'incomplete', 'completed']

The status of the message, which can be either in_progress, incomplete, or

thread_id str

The thread ID that

assistant_id class-attribute instance-attribute

assistant_id: Optional[str] = None

If applicable, the ID of the assistant that authored this message.

completed_at class-attribute instance-attribute

completed_at: Optional[int] = None

The Unix timestamp (in seconds) for when the message was completed.

content instance-attribute

content: List[MessageContent]

The content of the message in array of text and/or images.

created_at instance-attribute

created_at: int

The Unix timestamp (in seconds) for when the message was created.

file_ids instance-attribute

file_ids: List[str]

A list of file IDs that the assistant should use. Useful for tools like retrieval and code_interpreter that can access files. A maximum of 10 files can be attached to a message.

id instance-attribute

id: str

The identifier, which can be referenced in API endpoints.

incomplete_at class-attribute instance-attribute

incomplete_at: Optional[int] = None

The Unix timestamp (in seconds) for when the message was marked as incomplete.

incomplete_details class-attribute instance-attribute

incomplete_details: Optional[IncompleteDetails] = None

On an incomplete message, details about why the message is incomplete.

metadata class-attribute instance-attribute

metadata: Optional[object] = None

Set of 16 key-value pairs that can be attached to an object.

This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long.

object instance-attribute

object: Literal['thread.message']

The object type, which is always thread.message.

role instance-attribute

role: Literal['user', 'assistant']

The entity that produced the message. One of user or assistant.

run_id class-attribute instance-attribute

run_id: Optional[str] = None

If applicable, the ID of the run associated with the authoring of this message.

status instance-attribute

status: Literal['in_progress', 'incomplete', 'completed']

The status of the message, which can be either in_progress, incomplete, or completed.

thread_id instance-attribute

thread_id: str

The thread ID that this message belongs to.