ThreadMessage Class
Constructor
ThreadMessage(*args: Any, **kwargs: Any)
Methods
| as_dict |
Return a dict that can be turned into json using json.dump. |
| clear |
Remove all items from D. |
| copy | |
| get |
Get the value for key if key is in the dictionary, else default. :param str key: The key to look up. :param any default: The value to return if key is not in the dictionary. Defaults to None :returns: D[k] if k in D, else d. :rtype: any |
| items | |
| keys | |
| pop |
Removes specified key and return the corresponding value. :param str key: The key to pop. :param any default: The value to return if key is not in the dictionary :returns: The value corresponding to the key. :rtype: any :raises KeyError: If key is not found and default is not given. |
| popitem |
Removes and returns some (key, value) pair :returns: The (key, value) pair. :rtype: tuple :raises KeyError: if D is empty. |
| setdefault |
Same as calling D.get(k, d), and setting D[k]=d if k not found :param str key: The key to look up. :param any default: The value to set if key is not in the dictionary :returns: D[k] if k in D, else d. :rtype: any |
| update |
Updates D from mapping/iterable E and F. :param any args: Either a mapping object or an iterable of key-value pairs. |
| values |
as_dict
Return a dict that can be turned into json using json.dump.
as_dict(*, exclude_readonly: bool = False) -> Dict[str, Any]
Keyword-Only Parameters
| Name | Description |
|---|---|
|
exclude_readonly
|
Whether to remove the readonly properties. Default value: False
|
Returns
| Type | Description |
|---|---|
|
A dict JSON compatible object |
clear
Remove all items from D.
clear() -> None
copy
copy() -> Model
get
Get the value for key if key is in the dictionary, else default. :param str key: The key to look up. :param any default: The value to return if key is not in the dictionary. Defaults to None :returns: D[k] if k in D, else d. :rtype: any
get(key: str, default: Any = None) -> Any
Parameters
| Name | Description |
|---|---|
|
key
Required
|
|
|
default
|
Default value: None
|
items
items() -> ItemsView[str, Any]
Returns
| Type | Description |
|---|---|
|
set-like object providing a view on D's items |
keys
keys() -> KeysView[str]
Returns
| Type | Description |
|---|---|
|
a set-like object providing a view on D's keys |
pop
Removes specified key and return the corresponding value. :param str key: The key to pop. :param any default: The value to return if key is not in the dictionary :returns: The value corresponding to the key. :rtype: any :raises KeyError: If key is not found and default is not given.
pop(key: str, default: ~typing.Any = <object object>) -> Any
Parameters
| Name | Description |
|---|---|
|
key
Required
|
|
|
default
|
|
popitem
Removes and returns some (key, value) pair :returns: The (key, value) pair. :rtype: tuple :raises KeyError: if D is empty.
popitem() -> Tuple[str, Any]
setdefault
Same as calling D.get(k, d), and setting D[k]=d if k not found :param str key: The key to look up. :param any default: The value to set if key is not in the dictionary :returns: D[k] if k in D, else d. :rtype: any
setdefault(key: str, default: ~typing.Any = <object object>) -> Any
Parameters
| Name | Description |
|---|---|
|
key
Required
|
|
|
default
|
|
update
Updates D from mapping/iterable E and F. :param any args: Either a mapping object or an iterable of key-value pairs.
update(*args: Any, **kwargs: Any) -> None
values
values() -> ValuesView[Any]
Returns
| Type | Description |
|---|---|
|
an object providing a view on D's values |
Attributes
agent_id
If applicable, the ID of the agent that authored this message. Required.
agent_id: str
attachments
A list of files attached to the message, and the tools they were added to. Required.
attachments: List['_models.MessageAttachment']
completed_at
The Unix timestamp (in seconds) for when the message was completed. Required.
completed_at: datetime.datetime
content
The list of content items associated with the agent thread message. Required.
content: List['_models.MessageContent']
created_at
The Unix timestamp, in seconds, representing when this object was created. Required.
created_at: datetime.datetime
file_citation_annotations
Returns all file citation annotations from text message annotations in the messages.
Returns
| Type | Description |
|---|---|
file_path_annotations
Returns all file path annotations from text message annotations in the messages.
Returns
| Type | Description |
|---|---|
id
The identifier, which can be referenced in API endpoints. Required.
id: str
image_contents
Returns all image file contents from image message contents in the messages.
Returns
| Type | Description |
|---|---|
incomplete_at
The Unix timestamp (in seconds) for when the message was marked as incomplete. Required.
incomplete_at: datetime.datetime
incomplete_details
On an incomplete message, details about why the message is incomplete. Required.
incomplete_details: _models.MessageIncompleteDetails
metadata
A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length. Required.
metadata: Dict[str, str]
object
The object type, which is always 'thread.message'. Required. Default value is "thread.message".
object: Literal['thread.message']
role
"user" and "assistant".
role: str | '_models.MessageRole'
run_id
If applicable, the ID of the run associated with the authoring of this message. Required.
run_id: str
status
"in_progress", "incomplete", and "completed".
status: str | '_models.MessageStatus'
text_messages
Returns all text message contents in the messages.
Returns
| Type | Description |
|---|---|
thread_id
The ID of the thread that this message belongs to. Required.
thread_id: str
url_citation_annotations
Returns all URL citation annotations from text message annotations in the messages.
Returns
| Type | Description |
|---|---|