-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
.Net: New Feature: OpenAIAssistantAgent's AddChatMessageAsync for files. #9790
Comments
Hi @aeras3637, thank you for this suggestion. I'm curious on which type of file you are aiming to upload? The Assistant API support both text and image content for input messages; although, Azure services / deployments are restricted to text-only. All other file content must be either referenced from a Vector Store (for the Additionally, files specific to a particular thread may be specified upon thread-creation via: https://github.com/microsoft/semantic-kernel/blob/main/dotnet/src/Agents/OpenAI/OpenAIThreadCreationOptions.cs (Either From a design perspective, we chose to avoid managing , obfuscating, or otherwise interfering with how a developer might defined and update a Vector Store. In terms of providing file-content to an assistant, we are constrained by what is possible via the API: https://platform.openai.com/docs/api-reference/assistants With that said, I'd very much be open to continuing to explore your proposal. Looking forward to your response. |
Hi @crickman, Thank you for your response. The files to be uploaded are in formats such as CSV and XLSX. At the start of the chat, I specify the FileId uploaded with OpenAIFileClient to CodeInterpreterFileIds in OpenAIAssistantAgent.CreateAsync. I create an agent, create a thread with CreateThreadAsync, and execute InvokeAsync. What I want to achieve is that, although I initially uploaded a file, there are cases where I want to upload additional files during the course of the chat conversation. However, I couldn't find a method to upload files in such cases. |
I see, thank you. You can use the https://platform.openai.com/docs/api-reference/threads/modifyThread Currently we don't directly expose patterns for thread modification. At this point in time, you can access the AssistantClient assistantClient = provider.Client.GetAssistantClient();
await assistantClient.ModifyThreadAsync(threadId, new ThreadModificationOptions() { ToolResources = { CodeInterpreter = { FileIds = { newFileId } } } }); |
Thank you. I was able to add the file with assistantClient.ModifyThreadAsync. When adding files from the conversation flow, it feels more natural to be able to add files with AddChatMessageAsync, do you plan to support this? |
I've left this issue open for consideration. I'm not entirely sure on the full impact of integrating this as part of create message loop, but we also have a request to support modify assistant scenario...so I'll be looking at modify cases broadly. |
name: OpenAIAssistantAgent's AddChatMessageAsync for files.
Please use OpenAIAssistantAgent's AddChatMessageAsync to correspond to the file.
You may want to upload a file in the middle of an Agent's conversation.
In AssistantMessageFactory.CreateOptions, only Metadata is supported and there is no way to pass FileId.
If FileReferenceContent is included in Items of ChatMessageContent, please set it to Attachments in MessageCreationOptions.
The text was updated successfully, but these errors were encountered: