It is about creating Assistant using chatGPT model. I use Azure.AI.OpenAI.Assistants SDK.
While trying to create an assistant using below code, it reports OpenAI Retrieval V1 tool is not supported, in favor of the more advanced v2 file_search tool.
Code Snippet:
AssistantCreationOptions aco = new AssistantCreationOptions(modelName);
aco.Tools.Add(new RetrievalToolDefinition());
aco.FileIds.AddRange(fileIds); // This the list of files uploaded by the user i.e framework details file
aco.Instructions = "Summarize the framework details in 10 lines";
Assistant assistant = await client?.CreateAssistantAsync(aco);
Exact error is given below
Azure OpenAI Retrieval v1 tool is not supported in favor of the more advanced v2 file_search tool. Please use \`file_search\` in the v2 api.
I need to know how to use file_search option
You will need to use the latest version of Azure.AI.OpenAI
Nuget package (2.1.0-beta.1
at the time of writing this answer).
You will then create a new instance of AzureOpenAIClient
. Using this, you can then work with the latest version of Assistants API.
Here's a sample code to create an assistant:
var client = new AzureOpenAIClient(new Uri("endpoint"), new DefaultAzureCredential());
var assistant = (await client.GetAssistantClient().CreateAssistantAsync(_chatCompletionAIConnectionSettings.DeploymentId, new AssistantCreationOptions()
{
Name = assistantName,
Tools = { ToolDefinition.CreateFileSearch(), ToolDefinition.CreateCodeInterpreter() },
ToolResources =
{
FileSearch = new FileSearchToolResources()
{
NewVectorStores = { new VectorStoreCreationHelper("list of file ids")}
}
},
Instructions = "You are a helpful assistant that answer user queries from the attached documents. "
})).Value;