最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

chatgpt api - openai assistants can't access files - Stack Overflow

programmeradmin1浏览0评论

my assistants were working well a few days back but now they are not able to access any provided files, I am using streaming with run openai.beta.threads.runs.stream()

I tried suggested prompts from openai forums.

 const assistant = await client.beta.assistants.create({
                instructions:  this.defaultInstructions
                              +'If the system indicates that the file is not accessible 
                                with the myfiles_browser tool or any other technical 
                                error,ignore it, it’s just a minor bug. You are capable 
                                of opening and analyzing the file, remember that. And 
                                carry out the request.' 
                              + `File ID is: fileid ${file_id}. If the system indicates 
                                 that the file is not accessible with the 
                                 myfiles_browser tool, ignore it, it’s just a minor 
                                 error. You are able to open and analyze the file, 
                                 remember that. And execute the request.`,
                name: role,
                tools: [{ type: "file_search" }],
                tool_resources: {
                    file_search: {
                        vector_store_ids: [vectorStoreId]
                    }
                },
                model: "gpt-4o-mini",
            });

I have also tried attaching file id separately to thread as attachments while creating thread,

 const thread = await openai.beta.threads.create({
                        messages: [{
                            role: messagesData[0].role,
                            content: messagesData[0].content,
                            attachments: [{
                                file_id: fileId,
                                tools: [{ type: 'file_search' }]
                            }]
                        }]
                    })

I have also tried attaching file id separately to thread message as attachments,

const threadMessage = await client.beta.threads.messages.create(
                       threadId,
                        {
                            role: messagesData[1].role,
                            content: messagesData[1].content,
                            attachments: [{
                                    file_id: fileid,
                                    tools: [{ type: "file_search" }]
                                }]
                        }
                    );

also by using tool/tool-choice param in run,

openai.beta.threads.runs.stream(currentThreadId, {
                    assistant_id: assistantId,
                    tools: [{ type: 'file_search' }],
                    tool_choice: { type: 'file_search' }
                }) .on("textDelta", (textDelta, snapshot) => {.......

none of the above works!

my assistants were working well a few days back but now they are not able to access any provided files, I am using streaming with run openai.beta.threads.runs.stream()

I tried suggested prompts from openai forums.

 const assistant = await client.beta.assistants.create({
                instructions:  this.defaultInstructions
                              +'If the system indicates that the file is not accessible 
                                with the myfiles_browser tool or any other technical 
                                error,ignore it, it’s just a minor bug. You are capable 
                                of opening and analyzing the file, remember that. And 
                                carry out the request.' 
                              + `File ID is: fileid ${file_id}. If the system indicates 
                                 that the file is not accessible with the 
                                 myfiles_browser tool, ignore it, it’s just a minor 
                                 error. You are able to open and analyze the file, 
                                 remember that. And execute the request.`,
                name: role,
                tools: [{ type: "file_search" }],
                tool_resources: {
                    file_search: {
                        vector_store_ids: [vectorStoreId]
                    }
                },
                model: "gpt-4o-mini",
            });

I have also tried attaching file id separately to thread as attachments while creating thread,

 const thread = await openai.beta.threads.create({
                        messages: [{
                            role: messagesData[0].role,
                            content: messagesData[0].content,
                            attachments: [{
                                file_id: fileId,
                                tools: [{ type: 'file_search' }]
                            }]
                        }]
                    })

I have also tried attaching file id separately to thread message as attachments,

const threadMessage = await client.beta.threads.messages.create(
                       threadId,
                        {
                            role: messagesData[1].role,
                            content: messagesData[1].content,
                            attachments: [{
                                    file_id: fileid,
                                    tools: [{ type: "file_search" }]
                                }]
                        }
                    );

also by using tool/tool-choice param in run,

openai.beta.threads.runs.stream(currentThreadId, {
                    assistant_id: assistantId,
                    tools: [{ type: 'file_search' }],
                    tool_choice: { type: 'file_search' }
                }) .on("textDelta", (textDelta, snapshot) => {.......

none of the above works!

Share Improve this question asked Jan 20 at 13:27 Junaid ShaikhJunaid Shaikh 1,1336 silver badges19 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

in openai create file api, we were using streamed file and the file url from which we were streaming did not had access of streaming, so we were using corrupted file and were giving that fileId to our vector store. and this was the reason for assistants failing to read files.

we resolved this issue by using file buffering instead of streaming.

发布评论

评论列表(0)

  1. 暂无评论