Closed JP-droidic closed 1 month ago
I get a file generated by OpenAi assistant:
OpenAIAssistantAgent agent = await OpenAIAssistantAgent.CreateAsync( kernel: _semanticKernelHelper.BuildKernel(AIConfg.OpenAiChatGpt_4_0), config: new(_configuration.GetSection("AzureAi_4_5_Turbo")["ApiKey"], _configuration.GetSection("AzureAi_4_5_Turbo")["Endpoint"]), new() { //Instructions = AgentInstructions, Name = "coder", EnableCodeInterpreter = true, ModelId = "gpt-4o", });
and then for
OpenAIFileService fileService = new(_configuration.GetSection("AzureAi_4_5_Turbo")["ApiKey"]); foreach (FileReferenceContent fileReference in message.Items.OfType<FileReferenceContent>()) { Console.WriteLine($"# {message.Role} - {message.AuthorName ?? "*"}: @{fileReference.FileId}"); BinaryContent content = await fileService.GetFileContentAsync(fileReference.FileId);
I get the following error message:
HttpOperationException: Response status code does not indicate success: 401 (Unauthorized). Microsoft.SemanticKernel.Http.HttpClientExtensions.SendWithSuccessCheckAsync(HttpClient client, HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken) Microsoft.SemanticKernel.Http.HttpClientExtensions.SendWithSuccessCheckAsync(HttpClient client, HttpRequestMessage request, CancellationToken cancellationToken) Microsoft.SemanticKernel.Connectors.OpenAI.OpenAIFileService.StreamGetRequestAsync(string url, CancellationToken cancellationToken) Microsoft.SemanticKernel.Connectors.OpenAI.OpenAIFileService.GetFileContentAsync(string id, CancellationToken cancellationToken) AiEngine.SemanticKernel.SemanticKernelService+<>c__DisplayClass27_0+<<Agent>g__InvokeAgentAsync|0>d.MoveNext() in SemanticKernelService.cs + BinaryContent content = await fileService.GetFileContentAsync(fileReference.FileId); AiEngine.SemanticKernel.SemanticKernelService+<>c__DisplayClass27_0+<<Agent>g__InvokeAgentAsync|0>d.MoveNext() in SemanticKernelService.cs
@JP-droidic if you make an API call directly to the File Service, with the same API key, is it successful?
Going to go ahead and close this out since we didn't hear back. Feel free to reopen the issue.
I get a file generated by OpenAi assistant:
and then for
I get the following error message: