Thread returns nothing/blank everytime

What’s the acceptable order to build a chat app with GPT? I’m following this order:

  1. Create Topic
  2. Send messages
  3. Process them with Run by linking to a wizard
  4. Force receiving messages on the thread via Retriever Thread
  5. VOILÁ! I have the messages (user and assistant) in hand!

However, when I check the thread messages, whether after step 2 or 4, everything is blank, but when I access the Dashboard (https://platform.openai.com/threads/) the same thread is populated.

Somebody help me?

What do you mean by “force”? Do you think that this could be a reason why it’s not being populated?

Also, how are we supposed to help you if you don’t post any code. The issue is clear that your code is not doing what it’s supposed to do.

Force is only be redundant to me, requesting again the answers.

The code:

from openai import OpenAI
import time

# Initialize the OpenAI client
client = OpenAI(api_key='APIIIIIIIiiiiiII-KEYYYYYYYYYYYYYYYYYYY')

# Create an empty thread
thread = client.beta.threads.create()
thread_id = thread.id
print(f"Created thread ID: {thread_id}")

# Send a message to the thread
message = client.beta.threads.messages.create(
  thread_id,
  role="user",
  content="Tell me a joke"
)
print(f"Sent message: {message}")

# Retrieve and print the thread details
retrieved_thread = client.beta.threads.retrieve(thread_id)
print(f"Retrieved thread: {retrieved_thread}")

# Run the thread with an assistant
client.beta.threads.runs.create(
  thread_id=thread_id,
  assistant_id="asst_CjXhuE05HmHfGuJT7r8pVIpm"
)

# Wait for the assistant to process the thread
time.sleep(10)

# Retrieve and print the updated thread details
updated_thread = client.beta.threads.retrieve(thread_id)
print(f"Updated thread: {updated_thread}")

The return about Thread:

Thread(id=‘thread_OSUxbiU8Dx9kh1JfcvIp7Ik4’, created_at=1716832308, metadata={}, object=‘thread’, tool_resources=ToolResources(code_interpreter=ToolResourcesCodeInterpreter(file_ids=), file_search=None))

You need to wait for the Thread to be completed before requesting the information. This is not an instant result.

https://platform.openai.com/docs/assistants/how-it-works/run-lifecycle

I have posted a link that demonstrates exactly what you are asking

I have the same problem while using the playground. The thread output just vanishes. The logs show it being completed. I believe this bug happened last November with version 1. Anyone have any idea how to fix this? Is there a specific browser we have to use?

@docdaven

I’ve the same issue so I give up and built a code with streaming. Send a message to me that I can give you the code.

To me was working 1 month ago and changes suddently.