Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <apikey> with your OpenAI API key.
var agent = new OpenAIClient("<apikey>")
.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."));
Expand All @@ -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 <resource> 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://<resource>.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."));
Expand Down
4 changes: 2 additions & 2 deletions dotnet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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."));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
Loading