9 writes to MediaType
Microsoft.Extensions.AI.Abstractions.Tests (5)
Contents\HostedFileContentTests.cs (5)
72c.MediaType = "image/png"; 75c.MediaType = "application/pdf"; 78c.MediaType = null; 92Assert.Throws<ArgumentException>("value", () => c.MediaType = invalidMediaType); 103HostedFileContent c = new("id123") { MediaType = mediaType };
Microsoft.Extensions.AI.OpenAI (2)
OpenAIAssistantsChatClient.cs (1)
231(hcitrc.Outputs ??= []).Add(new HostedFileContent(output.ImageFileId) { MediaType = "image/*" });
OpenAIResponsesChatClient.cs (1)
1140results.Add(new HostedFileContent(part.InputImageFileId) { MediaType = "image/*", RawRepresentation = part });
Microsoft.Extensions.AI.OpenAI.Tests (2)
OpenAIResponseClientTests.cs (2)
3896new FunctionResultContent("call_file", new HostedFileContent("file-abc123") { MediaType = "image/png", Name = "result.png" }) 4242new FunctionResultContent("call_hosted_file", new HostedFileContent("file-xyz789") { MediaType = "text/plain", Name = "document.txt" })
15 references to MediaType
Microsoft.Extensions.AI (2)
ChatCompletion\OpenTelemetryChatClient.cs (2)
296MimeType = fc.MediaType, 297Modality = DeriveModalityFromMediaType(fc.MediaType),
Microsoft.Extensions.AI.Abstractions (8)
Contents\HostedFileContent.cs (8)
54/// Determines whether the <see cref="MediaType"/>'s top-level type matches the specified <paramref name="topLevelType"/>. 56/// <param name="topLevelType">The type to compare against <see cref="MediaType"/>.</param> 57/// <returns><see langword="true"/> if the type portion of <see cref="MediaType"/> matches the specified value; otherwise, false.</returns> 63/// the specified <paramref name="topLevelType"/> against the type portion of <see cref="MediaType"/>. 66/// If <see cref="MediaType"/> is <see langword="null"/>, this method returns <see langword="false"/>. 69public bool HasTopLevelMediaType(string topLevelType) => MediaType is not null && DataUriParser.HasTopLevelMediaType(MediaType, topLevelType); 79if (MediaType is string mediaType)
Microsoft.Extensions.AI.Abstractions.Tests (5)
Contents\HostedFileContentTests.cs (5)
70Assert.Null(c.MediaType); 73Assert.Equal("image/png", c.MediaType); 76Assert.Equal("application/pdf", c.MediaType); 79Assert.Null(c.MediaType); 104Assert.Equal(mediaType, c.MediaType);