Hi Guys,
Hope you are doing well. I need a help please. I have an openAI assistant and i want to use it in my python code. When i try to use a thread_id i create i got this error : openai.NotFoundError: Error code: 404 - {‘error’: {‘message’: “No thread found with id ‘Thread(id=‘thread_0cOCcAppTk41am2AwCfOmimK’, created_at=1709752888, metadata={}, object=‘thread’)’.”, ‘type’: ‘invalid_request_error’, ‘param’: None, ‘code’: None}}
But in openai platform this thread_id was create. This is the part of the code :
def format_json_response(self, input_string: str) → str:
# TODO: comment conserver le thread_Id selon quelle condition?
assistant = self.client.beta.assistants.retrieve(“asst_XXXXXXXXX”)
thread_id = self.client.beta.threads.create()
self.client.beta.threads.messages.create(thread_id=thread_id,
role="user",
content=input_string)
run = self.client.beta.threads.runs.create(thread_id=thread_id,
assistant_id=assistant.id)
self.__process_tool_calls(self.client, thread_id, run.id)
messages = self.client.beta.threads.messages.list(thread_id=thread_id)
return messages.data[0].content[0].text.value
Thanks for you help in advance.