16 instantiations of ImageContent
Microsoft.Extensions.AI.Abstractions.Tests (9)
ChatCompletion\ChatCompletionTests.cs (1)
242new ImageContent("http://localhost/image.png"),
ChatCompletion\ChatMessageTests.cs (4)
128new ImageContent("http://localhost/image"), 167new ImageContent("http://localhost/image"), 268new ImageContent(new Uri("https://fake-random-test-host:123"), "mime-type/2") 280new ImageContent(new BinaryData(new[] { 2, 1, 3 }, options: TestJsonSerializerContext.Default.Options), "mime-type/5")
ChatCompletion\StreamingChatCompletionUpdateExtensionsTests.cs (1)
174updates.Add(new() { Contents = [new ImageContent("https://uri")] });
ChatCompletion\StreamingChatCompletionUpdateTests.cs (3)
95new ImageContent("http://localhost/image"), 140new ImageContent("http://localhost/image"), 172new ImageContent("http://localhost/image"),
Microsoft.Extensions.AI.AzureAIInference.Tests (1)
AzureAIInferenceChatClientTests.cs (1)
589new ImageContent("http://dot.net/someimage.png"),
Microsoft.Extensions.AI.Integration.Tests (1)
ChatClientIntegrationTests.cs (1)
149new ImageContent(GetImageDataUri()),
Microsoft.Extensions.AI.OpenAI (4)
OpenAIModelMapper.ChatCompletion.cs (2)
534contentPart.ImageUri is not null ? new ImageContent(contentPart.ImageUri, contentPart.ImageBytesMediaType) : 535contentPart.ImageBytes is not null ? new ImageContent(contentPart.ImageBytes.ToMemory(), contentPart.ImageBytesMediaType) :
OpenAIModelMapper.ChatMessage.cs (2)
198contents.Add(new ImageContent(bytes.ToArray(), openAiContentPart.ImageBytesMediaType)); 202contents.Add(new ImageContent(openAiContentPart.ImageUri?.ToString() ?? string.Empty));
Microsoft.Extensions.AI.Tests (1)
ChatCompletion\ChatClientStructuredOutputExtensionsTests.cs (1)
151var expectedCompletion = new ChatCompletion([new ChatMessage(ChatRole.Assistant, [new ImageContent("https://example.com")])]);
18 references to ImageContent
Microsoft.Extensions.AI.Abstractions (4)
Contents\AIContent.cs (1)
14[JsonDerivedType(typeof(ImageContent), typeDiscriminator: "image")]
Contents\ImageContent.cs (3)
16/// Initializes a new instance of the <see cref="ImageContent"/> class. 26/// Initializes a new instance of the <see cref="ImageContent"/> class. 37/// Initializes a new instance of the <see cref="ImageContent"/> class.
Microsoft.Extensions.AI.Abstractions.Tests (7)
ChatCompletion\ChatCompletionTests.cs (1)
278Assert.IsType<ImageContent>(update0.Contents[1]);
ChatCompletion\ChatMessageTests.cs (3)
319var imageContent = deserializedMessage.Contents[1] as ImageContent; 343imageContent = deserializedMessage.Contents[4] as ImageContent;
ChatCompletion\StreamingChatCompletionUpdateTests.cs (2)
195Assert.IsType<ImageContent>(result.Contents[1]); 196Assert.Equal("http://localhost/image", ((ImageContent)result.Contents[1]).Uri);
Contents\ImageContentTests.cs (1)
6public sealed class ImageContentTests : DataContentTests<ImageContent>;
Microsoft.Extensions.AI.AzureAIInference (2)
AzureAIInferenceChatClient.cs (2)
487case ImageContent imageContent when imageContent.Data is { IsEmpty: false } data: 491case ImageContent imageContent when imageContent.Uri is string uri:
Microsoft.Extensions.AI.Ollama (2)
OllamaChatClient.cs (2)
377if (currentTextMessage is not null && item is not ImageContent) 393case ImageContent imageContent when imageContent.Data is not null:
Microsoft.Extensions.AI.OpenAI (3)
OpenAIModelMapper.ChatCompletion.cs (1)
532ImageContent? imageContent;
OpenAIModelMapper.ChatMessage.cs (2)
223case ImageContent imageContent when imageContent.Data is { IsEmpty: false } data: 227case ImageContent imageContent when imageContent.Uri is string uri: