这是关于使用chatGPT模型创建Assistant。我使用 Azure.AI.OpenAI.Assistants SDK。
尝试使用以下代码创建助手时,报告不支持 OpenAI Retrieval V1 工具,转而使用更高级的 v2 file_search 工具。
代码片段:
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);
具体错误如下
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.
我需要知道如何使用 file_search 选项
您将需要使用最新版本的
Azure.AI.OpenAI
Nuget 包(在撰写此答案时为 2.1.0-beta.1
)。
然后您将创建
AzureOpenAIClient
的新实例。使用它,您就可以使用最新版本的 Assistants API。
这是创建助手的示例代码:
var client = new AzureOpenAIClient(new Uri("endpoint"), new DefaultAzureCredential());
var assistant = await client.GetAssistantClient().CreateAssistantAsync("deployment-id", new AssistantCreationOptions()
{
Name = assistantName,
Tools = { ToolDefinition.CreateFileSearch(), ToolDefinition.CreateCodeInterpreter() },
Instructions = "You are a helpful assistant that answer user queries from the attached documents. "
})).Value;