diff --git a/README.md b/README.md index 5dc11508e7..2b40333063 100644 --- a/README.md +++ b/README.md @@ -125,12 +125,13 @@ Create a simple Agent, using OpenAI Responses, that writes a haiku about the Mic ```c# // dotnet add package Microsoft.Agents.AI.OpenAI --prerelease -using System; +using Microsoft.Agents.AI; using OpenAI; +using OpenAI.Responses; // Replace the with your OpenAI API key. var agent = new OpenAIClient("") - .GetOpenAIResponseClient("gpt-4o-mini") + .GetResponsesClient("gpt-4o-mini") .AsAIAgent(name: "HaikuBot", instructions: "You are an upbeat assistant that writes beautifully."); Console.WriteLine(await agent.RunAsync("Write a haiku about Microsoft Agent Framework.")); @@ -142,14 +143,17 @@ Create a simple Agent, using Azure OpenAI Responses with token based auth, that // dotnet add package Microsoft.Agents.AI.OpenAI --prerelease // dotnet add package Azure.Identity // Use `az login` to authenticate with Azure CLI -using System; +using System.ClientModel.Primitives; +using Azure.Identity; +using Microsoft.Agents.AI; using OpenAI; +using OpenAI.Responses; // Replace and gpt-4o-mini with your Azure OpenAI resource name and deployment name. var agent = new OpenAIClient( new BearerTokenPolicy(new AzureCliCredential(), "https://ai.azure.com/.default"), new OpenAIClientOptions() { Endpoint = new Uri("https://.openai.azure.com/openai/v1") }) - .GetOpenAIResponseClient("gpt-4o-mini") + .GetResponsesClient("gpt-4o-mini") .AsAIAgent(name: "HaikuBot", instructions: "You are an upbeat assistant that writes beautifully."); Console.WriteLine(await agent.RunAsync("Write a haiku about Microsoft Agent Framework.")); diff --git a/dotnet/README.md b/dotnet/README.md index 4e52260f56..c6f3750286 100644 --- a/dotnet/README.md +++ b/dotnet/README.md @@ -11,16 +11,16 @@ ### Basic Agent - .NET ```c# -using System; using Azure.AI.OpenAI; using Azure.Identity; using Microsoft.Agents.AI; +using OpenAI.Responses; var endpoint = Environment.GetEnvironmentVariable("AZURE_OPENAI_ENDPOINT")!; var deploymentName = Environment.GetEnvironmentVariable("AZURE_OPENAI_DEPLOYMENT_NAME")!; var agent = new AzureOpenAIClient(new Uri(endpoint), new AzureCliCredential()) - .GetOpenAIResponseClient(deploymentName) + .GetResponsesClient(deploymentName) .AsAIAgent(name: "HaikuBot", instructions: "You are an upbeat assistant that writes beautifully."); Console.WriteLine(await agent.RunAsync("Write a haiku about Microsoft Agent Framework.")); diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests/MediaInputTest.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests/MediaInputTest.cs index a208e10b2d..5400628ba3 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests/MediaInputTest.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.IntegrationTests/MediaInputTest.cs @@ -36,9 +36,24 @@ public async Task ValidateFileUrlAsync(string fileSource, string mediaType, bool await this.ValidateFileAsync(new UriContent(fileSource, mediaType), useConversation); } + // Temporarily disabled [Theory] + [Trait("Category", "IntegrationDisabled")] [InlineData(ImageReference, "image/jpeg", true)] [InlineData(ImageReference, "image/jpeg", false)] + public async Task ValidateImageFileDataAsync(string fileSource, string mediaType, bool useConversation) + { + // Arrange + byte[] fileData = await DownloadFileAsync(fileSource); + string encodedData = Convert.ToBase64String(fileData); + string fileUrl = $"data:{mediaType};base64,{encodedData}"; + this.Output.WriteLine($"Content: {fileUrl.Substring(0, Math.Min(112, fileUrl.Length))}..."); + + // Act & Assert + await this.ValidateFileAsync(new DataContent(fileUrl), useConversation); + } + + [Theory] [InlineData(PdfReference, "application/pdf", true)] [InlineData(PdfReference, "application/pdf", false)] public async Task ValidateFileDataAsync(string fileSource, string mediaType, bool useConversation) @@ -53,7 +68,9 @@ public async Task ValidateFileDataAsync(string fileSource, string mediaType, boo await this.ValidateFileAsync(new DataContent(fileUrl), useConversation); } + // Temporarily disabled [Theory] + [Trait("Category", "IntegrationDisabled")] [InlineData(PdfReference, "doc.pdf", true)] [InlineData(PdfReference, "doc.pdf", false)] public async Task ValidateFileUploadAsync(string fileSource, string documentName, bool useConversation)