38 writes to Name
Microsoft.Extensions.AI.Abstractions (5)
ChatCompletion\ChatResponseExtensions.cs (1)
345return new DataContent(new ReadOnlyMemory<byte>(ms.GetBuffer(), 0, (int)ms.Length), first.MediaType) { Name = first.Name };
Contents\DataContent.cs (1)
197Name = name
Files\HostedFileDownloadStream.cs (1)
111Name = FileName,
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\JsonContext.DataContent.g.cs (1)
103Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.DataContent)obj).Name = value!,
Image\ImageGeneratorExtensions.cs (1)
184var dataContent = new DataContent(originalImageData, mediaType) { Name = fileName };
Microsoft.Extensions.AI.Abstractions.Tests (16)
ChatCompletion\ChatResponseUpdateExtensionsTests.cs (7)
923var image1 = new DataContent((byte[])[1, 2, 3, 4], "image/png") { Name = "image1.png" }; 924var image2 = new DataContent((byte[])[5, 6, 7, 8], "image/jpeg") { Name = "image2.jpg" }; 925var image3 = new DataContent((byte[])[9, 10, 11, 12], "image/png") { Name = "image3.png" }; 926var image4 = new DataContent((byte[])[13, 14, 15, 16], "image/gif") { Name = "image4.gif" }; 981var image1 = new DataContent((byte[])[1, 2, 3, 4], "image/png") { Name = "image1.png" }; 982var image2 = new DataContent((byte[])[5, 6, 7, 8], "image/jpeg") { Name = "image2.jpg" }; 983var image3 = new DataContent((byte[])[9, 10, 11, 12], "image/png") { Name = "image3.png" };
Contents\DataContentTests.cs (6)
159new DataContent(new ReadOnlyMemory<byte>([0x01, 0x02, 0x03, 0x04]), "application/octet-stream") { Name = "test.bin" }, 308content.Name = "test.bin"; 513Name = "myfile.json" 628DataContent content = new(testData, "image/png") { Name = "myimage.png" }; 657DataContent content = new(testData, "text/plain") { Name = $"testfile_{Guid.NewGuid()}.txt" }; 838Name = "specific-output.json"
Files\HostedFileClientExtensionsTests.cs (1)
19var content = new DataContent(data, "application/pdf") { Name = "doc.pdf" };
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\TestJsonSerializerContext.DataContent.g.cs (1)
101Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.DataContent)obj).Name = value!,
Image\ImageGeneratorExtensionsTests.cs (1)
64var dataContent = new DataContent(imageData, "image/png") { Name = "test.png" };
Microsoft.Extensions.AI.Evaluation.Reporting (1)
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\JsonContext.DataContent.g.cs (1)
103Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.DataContent)obj).Name = value!,
Microsoft.Extensions.AI.Evaluation.Reporting.Azure (1)
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\JsonContext.DataContent.g.cs (1)
103Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.DataContent)obj).Name = value!,
Microsoft.Extensions.AI.Integration.Tests (5)
ChatClientIntegrationTests.cs (1)
204new DataContent(ImageDataUri.GetPdfDataUri(), "application/pdf") { Name = "sample.pdf" },
ImageGeneratingChatClientIntegrationTests.cs (3)
158var originalImageData = new DataContent(testImageData, "image/png") { Name = "original.png" }; 374var originalImage = new DataContent(testImageData, "image/png") { Name = "test.png" }; 423Name = $"generated_image_{ImageCounter}.png"
ImageGeneratorIntegrationTests.cs (1)
95AIContent[] originalImages = [new DataContent(imageData, "image/png") { Name = "dotnet.png" }];
Microsoft.Extensions.AI.OpenAI (3)
OpenAIChatClient.cs (1)
809contentPart.FileBytes is not null ? new DataContent(contentPart.FileBytes.ToMemory(), contentPart.FileBytesMediaType) { Name = contentPart.Filename } :
OpenAIFileDownloadStream.cs (1)
51Name = FileName,
OpenAIResponsesChatClient.cs (1)
1706content = new DataContent(part.InputFileBytes, part.InputFileBytesMediaType ?? "application/octet-stream") { Name = part.InputFilename };
Microsoft.Extensions.AI.OpenAI.Tests (4)
OpenAIHostedFileClientIntegrationTests.cs (1)
178var dataContent = new DataContent(contentBytes, "text/plain") { Name = fileName };
OpenAIResponseClientIntegrationTests.cs (1)
640Tools = [AIFunctionFactory.Create(() => new DataContent(ImageDataUri.GetPdfDataUri(), "application/pdf") { Name = "document.pdf" }, "GetDocument", "Returns a PDF document")]
OpenAIResponseClientTests.cs (2)
5178new FunctionResultContent("call_pdf", new DataContent(pdfData, "application/pdf") { Name = "report.pdf" }) 5575new DataContent(pdfData, "application/pdf") { Name = "doc.pdf" },
Microsoft.Extensions.AI.Stabilization.Tests (1)
Generated\361d1da7f942c932\AIContentSerializationRegressionContext.DataContent.g.cs (1)
101Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.DataContent)obj).Name = value!,
Microsoft.Extensions.AI.Tests (2)
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\TestJsonSerializerContext.DataContent.g.cs (1)
101Setter = static (obj, value) => ((global::Microsoft.Extensions.AI.DataContent)obj).Name = value!,
Image\OpenTelemetryImageGeneratorTests.cs (1)
48new DataContent(new byte[] { 1, 2, 3, 4 }, "image/png") { Name = "moreOutput.png" },
38 references to Name
Microsoft.Extensions.AI (1)
ChatCompletion\ImageGeneratingChatClient.cs (1)
501imageId = imageContent.Name ?? Guid.NewGuid().ToString();
Microsoft.Extensions.AI.Abstractions (9)
ChatCompletion\ChatResponseExtensions.cs (3)
323canMerge: static (r1, r2) => r1.MediaType == r2.MediaType && r1.HasTopLevelMediaType("text") && r1.Name == r2.Name, 345return new DataContent(new ReadOnlyMemory<byte>(ms.GetBuffer(), 0, (int)ms.Length), first.MediaType) { Name = first.Name };
Contents\DataContent.cs (4)
206/// from the <see cref="Name"/> property, or a random name will be used with an extension based on the <see cref="MediaType"/>, if possible. 223if (Name is not null) 225name = Path.GetFileName(Name); 324/// <see cref="Name"/> may be used as part of the output file's name.
Files\HostedFileClientExtensions.cs (1)
45return client.UploadAsync(stream, content.MediaType, content.Name, options, cancellationToken);
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\JsonContext.DataContent.g.cs (1)
102Getter = static obj => ((global::Microsoft.Extensions.AI.DataContent)obj).Name,
Microsoft.Extensions.AI.Abstractions.Tests (18)
Contents\DataContentTests.cs (13)
307Assert.Null(content.Name); 309Assert.Equal("test.bin", content.Name); 327Assert.Equal(Path.GetFileName(tempPath), content.Name); 354Assert.Equal(Path.GetFileName(tempPath), content.Name); 408Assert.Equal(Path.GetFileName(tempPath), content.Name); 432Assert.Null(content.Name); // Name can be assigned after the call if needed 448Assert.Null(content.Name); 638Assert.Equal(content.Name, Path.GetFileName(savedPath)); 660string expectedAbsolute = Path.Combine(cwdBefore, content.Name!); 668Assert.Equal(content.Name, Path.GetFileName(savedPath)); 723Assert.Equal("nested.html", content.Name); 843string expectedPath = Path.Combine(tempDir, content.Name); 998Assert.Equal("audio.wav", dataContent.Name);
Files\HostedFileClientExtensionsTests.cs (1)
375Assert.Equal("photo.png", result.Name);
Files\HostedFileDownloadStreamTests.cs (2)
31Assert.Equal("data.json", content.Name); 42Assert.Null(content.Name);
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\TestJsonSerializerContext.DataContent.g.cs (1)
100Getter = static obj => ((global::Microsoft.Extensions.AI.DataContent)obj).Name,
Image\ImageGeneratorExtensionsTests.cs (1)
123Assert.Equal(fileName, dataContent.Name);
Microsoft.Extensions.AI.Evaluation.Reporting (1)
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\JsonContext.DataContent.g.cs (1)
102Getter = static obj => ((global::Microsoft.Extensions.AI.DataContent)obj).Name,
Microsoft.Extensions.AI.Evaluation.Reporting.Azure (1)
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\JsonContext.DataContent.g.cs (1)
102Getter = static obj => ((global::Microsoft.Extensions.AI.DataContent)obj).Name,
Microsoft.Extensions.AI.Integration.Tests (2)
ImageGeneratingChatClientIntegrationTests.cs (2)
177Assert.Equal("original.png", originalImageContent.Name); 227Assert.Contains("generated_image_1", editedImage.Name);
Microsoft.Extensions.AI.OpenAI (4)
OpenAIChatClient.cs (1)
319return ChatMessageContentPart.CreateFilePart(BinaryData.FromBytes(dataContent.Data), dataContent.MediaType, dataContent.Name ?? $"{Guid.NewGuid():N}.pdf");
OpenAIImageGenerator.cs (1)
65dataContent.Name ??
OpenAIResponsesChatClient.cs (2)
1364(parts ??= []).Add(ResponseContentPart.CreateInputFilePart(BinaryData.FromBytes(dataContent.Data, dataContent.MediaType), dataContent.MediaType, dataContent.Name ?? $"{Guid.NewGuid():N}.pdf")); 1444FileName = dc.Name ?? $"file_{Guid.NewGuid():N}", // contrary to the docs, file_name is required
Microsoft.Extensions.AI.Stabilization.Tests (1)
Generated\361d1da7f942c932\AIContentSerializationRegressionContext.DataContent.g.cs (1)
100Getter = static obj => ((global::Microsoft.Extensions.AI.DataContent)obj).Name,
Microsoft.Extensions.AI.Tests (1)
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\TestJsonSerializerContext.DataContent.g.cs (1)
100Getter = static obj => ((global::Microsoft.Extensions.AI.DataContent)obj).Name,