Hi everyone,
I’ve been running into a problem I can’t seem to fix.
When I create an assistant, upload a file → create a thread = works and I can query my uploaded file
BUT if I then update my file to a newer version (new data file to read from), my existing thread is no longer able to read it.
So it looks like older threads aren’t able to access newer assistant files.
What I do: When a new data file is to be uploaded, I do delete the old one. Is this wrong? (just not to get a gigantic pile of files).
Anyone else ran into this problem?
I use PHP, code below
1. Creation of my assistant
$assistant = OpenAI::assistants()->create([
'instructions' => $instructionPrompt,
'name' => $name,
'tools' => [
[
'type' => 'code_interpreter',
],
[
'type' => 'retrieval',
]
],
'model' => 'gpt-3.5-turbo-1106',
]);
2. Uploading my JSON data file & attach to assistant
$response = OpenAI::files()->upload([
'purpose' => 'assistants',
'file' => $json,
]);
if (!$response || !$response->id) throw new \Exception('Error [1]: could not upload file');
$response = OpenAI::assistants()->files()->create($assistantId, [
'file_id' => $response->id,
]);
if (!$response || !$response->id) throw new \Exception('Error [2]: Could attach file to assistant
3. Adding mu message to the thread ( the fileId is a valid id, triple checked)
$message = OpenAI::threads()->messages()->create(
$threadId,
[
'role' => 'user',
'content' => $message,
'file_ids' => [$fileId],
],
);