Added by Python
I’ve got it as None or null with the (retrieve) message method (by individual message ID). Python openai 1.26 (which has it as a validation type).
get https://api.openai.com/v1/threads/{thread_id}/messages/{message_id}
>>>message = client.beta.threads.messages.retrieve(
message_id="msg_4xrZJi49...",
thread_id="thread_nmSSVF...",
)
>>>print(json.dumps(message.model_dump(), indent=2))
{
"id": "msg_4xrZJi49...",
"assistant_id": "asst_AI0PRu...",
"attachments": [],
"completed_at": null,
"content": [
{
"text": {
"annotations": [],
"value": "It appears there were no search results related ...!"
},
"type": "text"
}
],
"created_at": 1715148407,
"incomplete_at": null,
"incomplete_details": null,
"metadata": {},
"object": "thread.message",
"role": "assistant",
"run_id": "run_GZ88cWCTSC...",
"status": null,
"thread_id": "thread_nmSSVF..."
}
However, not actually in the http response:
import os, json, urllib3
thread = "thread_nmSSVFV..."
message = "msg_4xrZJi49..."
url = f"https://api.openai.com/v1/threads/{thread}/messages/{message}"
headers = {
"Content-Type": "application/json",
"Authorization": f"Bearer {os.environ.get('OPENAI_API_KEY')}",
"OpenAI-Beta": "assistants=v2"
}
http = urllib3.PoolManager()
try:
response = http.request(
"GET",
url,
headers=headers
# body=json.dumps({"command": "go bananas"})
)
except Exception as e:
print(f"Error: {e}")
if response.status != 200:
print(f"HTTP error {response.status}: {response.data.decode('utf-8')}")
else:
reply = json.loads(response.data.decode("utf-8"))
print(response.data)
bytes:
b'{\n "id": "msg_4xrZJi49...",\n "object": "thread.message",\n "created_at": 1715148407,\n "assistant_id": "asst_AI0PRuCNCdfzEQzzTEbHrKBT",\n "thread_id": "thread_nmSSVFVI...",\n "run_id": "run_GZ88cW...",\n "role": "assistant",\n "content": [\n {\n "type": "text",\n "text": {\n "value": "It appears there were no search results related...",\n "annotations": []\n }\n }\n ],\n "attachments": [],\n "metadata": {}\n}'