Hi everyone!
We are unable to attach new files to old threads.
We update the thread using this method: /docs/api-reference/threads/modifyThread
We pass the vector store thread with all the files, but if you request this thread using the /docs/api-reference/threads/getThread method, then there is no information about the linked files\vector stores.
object(Bitrix\Main\Result)#2409 (3) {
["isSuccess":protected]=>
bool(true)
["errors":protected]=>
object(Bitrix\Main\ErrorCollection)#2406 (1) {
["values":protected]=>
array(0) {
}
}
["data":protected]=>
array(1) {
["result"]=>
array(5) {
["id"]=>
string(31) "thread_1gTAhBlG0siDKaMxhMOKjkdr"
["object"]=>
string(6) "thread"
["created_at"]=>
int(1719307663)
["metadata"]=>
array(0) {
}
["tool_resources"]=>
array(2) {
["file_search"]=>
array(1) {
["vector_store_ids"]=>
array(1) {
[0]=>
string(27) "vs_seyjYbX3Ydkh2OPBEypMJwQn"
}
}
}
}
}
this is the answer after updating the thread with the method /docs/api-reference/threads/modifyThread
We see that the vector store is attached
in the thread itself you can also see that there are files. But at the same time, the Assistant responds in dialogue with the user that he does not have access to these files.
Request to add a vector storage to a thread
POST https://api.openai.com/v1/threads/thread_1gTAhBlG0siDKaMxhMOKjkdr body: {"tool_resources":{"file_search":{"vector_store_ids":["vs_seyjYbX3Ydkh2OPBEypMJwQn"]}}}
Response: { "id": "thread_1gTAhBlG0siDKaMxhMOKjkdr", "object": "thread", "created_at": 1719307663, "metadata": {}, "tool_resources": { "file_search": { "vector_store_ids": [ "vs_seyjYbX3Ydkh2OPBEypMJwQn" ] }, "code_interpreter": { "file_ids": [ "file-PmpJBjhwHnqVTiENiKxmzhT3", "file-HkxbcEsq0MkKGoqArrIYhH9W" ] } }
Launching the runner
POST https://api.openai.com/v1/threads/thread_1gTAhBlG0siDKaMxhMOKjkdr/runs body: {"assistant_id":"asst_idvcXonw2wKlUmBOJrvILIoO","tools":[{"type":"file_search"}]}
Response: { "id": "run_TAkAnsRRAFKrv5IQEFAd01wd", "object": "thread.run", "created_at": 1721131397, "assistant_id": "asst_idvcXonw2wKlUmBOJrvILIoO", "thread_id": "thread_1gTAhBlG0siDKaMxhMOKjkdr", "status": "queued", "started_at": null, "expires_at": 1721131997, "cancelled_at": null, "failed_at": null, "completed_at": null, "required_action": null, "last_error": null, "model": "gpt-4-turbo-2024-04-09", "instructions": "(OK instructions here, removed for clean answer)", "tools": [ { "type": "file_search" } ], "tool_resources": {}, "metadata": {}, "temperature": 1.0, "top_p": 1.0, "max_completion_tokens": null, "max_prompt_tokens": null, "truncation_strategy": { "type": "auto", "last_messages": null }, "incomplete_details": null, "usage": null, "response_format": "auto", "tool_choice": "auto", "parallel_tool_calls": true }
Response to the request “samsung TVs” (if it’s a new thread, then everything is ok, i.e. it searches through files and gives away the goods)
Response: { "object": "list", "data": [ { "id": "msg_V0I2kmGZhelOXbyrlUOdmi8a", "object": "thread.message", "created_at": 1721131396, "assistant_id": null, "thread_id": "thread_1gTAhBlG0siDKaMxhMOKjkdr", "run_id": null, "role": "user", "content": [ { "type": "text", "text": { "value": "телевизоры самсунг", "annotations": [] } } ], "attachments": [], "metadata": {} }, { "id": "msg_IkFCzNVIS49GX2gsdDaiqS3L", "object": "thread.message", "created_at": 1721131408, "assistant_id": "asst_idvcXonw2wKlUmBOJrvILIoO", "thread_id": "thread_1gTAhBlG0siDKaMxhMOKjkdr", "run_id": "run_TAkAnsRRAFKrv5IQEFAd01wd", "role": "assistant", "content": [ { "type": "text", "text": { "value": "Извините, но в нашем каталоге в данный момент нет информации о телевизорах Samsung. Я рекомендую вам посетить наш официальный сайт https://castore.uz/, где вы можете найти полный ассортимент телевизоров Samsung и других брендов. Вы также можете связаться с нашим колл-центром по номеру +998 (78) 140-00-11 для получения консультации или помощи в выборе телевизора. Если у вас есть другие вопросы или нужна дополнительная информация, не стесняйтесь обращаться ко мне.", "annotations": [] } } ], "attachments": [], "metadata": {} } ], "first_id": "msg_V0I2kmGZhelOXbyrlUOdmi8a", "last_id": "msg_IkFCzNVIS49GX2gsdDaiqS3L", "has_more": false }
If you translate, the assistant replies that there is no information about Samsung TVs in our catalog
What are we doing wrong?
