84 writes to RawRepresentation
Microsoft.Extensions.AI.Abstractions (1)
ChatCompletion\ChatResponseExtensions.cs (1)
259RawRepresentation = existing.RawRepresentation ?? webSearchCall.RawRepresentation,
Microsoft.Extensions.AI.Abstractions.Tests (20)
ChatCompletion\ChatResponseUpdateExtensionsTests.cs (2)
1029new() { Contents = [new WebSearchToolCallContent("ws1") { Queries = ["second query"], RawRepresentation = rawRepresentation, AdditionalProperties = additionalProps }] }, 1110RawRepresentation = rawRepresentation,
Contents\AIContentTests.cs (2)
27c.RawRepresentation = raw; 41RawRepresentation = new object(),
Contents\CodeInterpreterToolCallContentTests.cs (1)
36c.RawRepresentation = raw;
Contents\CodeInterpreterToolResultContentTests.cs (1)
36c.RawRepresentation = raw;
Contents\FunctionCallContentTests.cs (1)
56c.RawRepresentation = raw;
Contents\FunctionResultContentTests.cs (1)
41c.RawRepresentation = raw;
Contents\HostedFileContentTests.cs (1)
51c.RawRepresentation = raw;
Contents\HostedVectorStoreContentTests.cs (1)
45c.RawRepresentation = raw;
Contents\ImageGenerationToolCallContentTests.cs (1)
29c.RawRepresentation = raw;
Contents\ImageGenerationToolResultContentTests.cs (1)
37c.RawRepresentation = raw;
Contents\McpServerToolCallContentTests.cs (1)
34c.RawRepresentation = raw;
Contents\McpServerToolResultContentTests.cs (1)
30c.RawRepresentation = raw;
Contents\TextContentTests.cs (1)
30c.RawRepresentation = raw;
Contents\TextReasoningContentTests.cs (1)
31c.RawRepresentation = raw;
Contents\ToolCallContentTests.cs (1)
36c.RawRepresentation = raw;
Contents\ToolResultContentTests.cs (1)
35c.RawRepresentation = raw;
Contents\WebSearchToolCallContentTests.cs (1)
35c.RawRepresentation = raw;
Contents\WebSearchToolResultContentTests.cs (1)
40c.RawRepresentation = raw;
Microsoft.Extensions.AI.OpenAI (50)
MicrosoftExtensionsAIChatExtensions.cs (2)
199fcc.RawRepresentation = toolCall; 229RawRepresentation = tcm,
OpenAIAssistantsChatClient.cs (3)
195fcc.RawRepresentation = ru; 208RawRepresentation = details, 225RawRepresentation = details,
OpenAIChatClient.cs (5)
404RawRepresentation = audioUpdate, 439RawRepresentation = tokenUsage, 531RawRepresentation = audio, 541callContent.RawRepresentation = toolCall; 822aiContent.RawRepresentation = contentPart;
OpenAIHostedFileClient.cs (2)
335RawRepresentation = openAIFile, 354RawRepresentation = file,
OpenAIRealtimeClientSession.cs (4)
1202RawRepresentation = mcpItem, 1226RawRepresentation = approvalItem, 1230[new ToolApprovalRequestContent(approvalId, toolCall) { RawRepresentation = approvalItem }], 1243RawRepresentation = toolDef,
OpenAIResponsesChatClient.cs (34)
212fcc.RawRepresentation = outputItem; 217message.Contents.Add(new FunctionResultContent(functionCallOutputItem.CallId, functionCallOutputItem.FunctionOutput) { RawRepresentation = functionCallOutputItem }); 229RawRepresentation = mtcari, 232RawRepresentation = mtcari, 251RawRepresentation = mtcari, 285RawRepresentation = wscri, 293message.Contents.Add(new ToolResultContent(outputItem.Id) { RawRepresentation = outputItem }); 297message.Contents.Add(new ToolCallContent(computerCall.CallId) { RawRepresentation = computerCall }); 301message.Contents.Add(new ToolResultContent(computerCallOutput.CallId) { RawRepresentation = computerCallOutput }); 305message.Contents.Add(new ToolCallContent(patchCall.CallId) { RawRepresentation = patchCall }); 309message.Contents.Add(new ToolResultContent(patchCallOutput.CallId) { RawRepresentation = patchCallOutput }); 313message.Contents.Add(new() { RawRepresentation = outputItem }); 490RawRepresentation = imageGenInProgress, 502RawRepresentation = codeInterpreterDeltaUpdate, 509RawRepresentation = webSearchInProgressUpdate, 532RawRepresentation = mtcari, 535RawRepresentation = mtcari, 554RawRepresentation = mtcari, 560yield return CreateUpdate(new FunctionResultContent(functionCallOutputItem.CallId, functionCallOutputItem.FunctionOutput) { RawRepresentation = functionCallOutputItem }); 581RawRepresentation = wscri, 621toolCallUpdate.Contents.Add(new ToolResultContent(outputItemDoneUpdate.Item.Id) { RawRepresentation = outputItemDoneUpdate.Item }); 626yield return CreateUpdate(new ToolCallContent(computerCall.CallId) { RawRepresentation = outputItemDoneUpdate.Item }); 630yield return CreateUpdate(new ToolResultContent(computerCallOutput.CallId) { RawRepresentation = computerCallOutput }); 635yield return CreateUpdate(new AIContent { RawRepresentation = outputItemDoneUpdate.Item }); 932RawRepresentation = rawRepresentation, 1742content.RawRepresentation = part; 1831RawRepresentation = uriSource, 1853RawRepresentation = mtci, 1882outputContents.Add(new UriContent(cicio.ImageUri, OpenAIClientExtensions.ImageUriToMediaType(cicio.ImageUri)) { RawRepresentation = cicio }); 1886outputContents.Add(new TextContent(ciclo.Logs) { RawRepresentation = ciclo }); 1906RawRepresentation = cicri, 1954var hfc = new HostedFileContent(fileId) { MediaType = mimeType, RawRepresentation = output }; 1974RawRepresentation = outputItem, 1986RawRepresentation = update,
Microsoft.Extensions.AI.OpenAI.Tests (4)
OpenAIConversionTests.cs (4)
851new AIContent { RawRepresentation = ResponseItem.CreateWebSearchCallItem() }, 852new AIContent { RawRepresentation = ResponseItem.CreateReferenceItem("123") }, 859new AIContent { RawRepresentation = ResponseItem.CreateReasoningItem("text") }, 863new AIContent { RawRepresentation = ResponseItem.CreateSystemMessageItem("test") },
Microsoft.Extensions.AI.Stabilization.Tests (7)
parent\Microsoft.Extensions.AI.Abstractions.Tests\Contents\CodeInterpreterToolCallContentTests.cs (1)
36c.RawRepresentation = raw;
parent\Microsoft.Extensions.AI.Abstractions.Tests\Contents\CodeInterpreterToolResultContentTests.cs (1)
36c.RawRepresentation = raw;
parent\Microsoft.Extensions.AI.Abstractions.Tests\Contents\HostedFileContentTests.cs (1)
51c.RawRepresentation = raw;
parent\Microsoft.Extensions.AI.Abstractions.Tests\Contents\ImageGenerationToolCallContentTests.cs (1)
29c.RawRepresentation = raw;
parent\Microsoft.Extensions.AI.Abstractions.Tests\Contents\ImageGenerationToolResultContentTests.cs (1)
37c.RawRepresentation = raw;
parent\Microsoft.Extensions.AI.Abstractions.Tests\Contents\WebSearchToolCallContentTests.cs (1)
35c.RawRepresentation = raw;
parent\Microsoft.Extensions.AI.Abstractions.Tests\Contents\WebSearchToolResultContentTests.cs (1)
40c.RawRepresentation = raw;
Microsoft.Extensions.AI.Tests (2)
ChatCompletion\FunctionInvokingChatClientTests.cs (2)
408RawRepresentation = "CustomRaw" 2335RawRepresentation = fcc.RawRepresentation
179 references to RawRepresentation
Microsoft.Extensions.AI.Abstractions (2)
ChatCompletion\ChatResponseExtensions.cs (2)
259RawRepresentation = existing.RawRepresentation ?? webSearchCall.RawRepresentation,
Microsoft.Extensions.AI.Abstractions.Tests (60)
ChatCompletion\ChatResponseUpdateExtensionsTests.cs (3)
1051Assert.Same(rawRepresentation, ws1.RawRepresentation); 1134Assert.Same(rawRepresentation, ws1First.RawRepresentation); 1140Assert.Same(rawRepresentation, ws1Second.RawRepresentation);
Contents\AIContentTests.cs (5)
16Assert.Null(c.RawRepresentation); 25Assert.Null(c.RawRepresentation); 28Assert.Same(raw, c.RawRepresentation); 45Assert.NotNull(original.RawRepresentation); 53Assert.Null(deserialized.RawRepresentation);
Contents\CodeInterpreterToolCallContentTests.cs (3)
16Assert.Null(c.RawRepresentation); 34Assert.Null(c.RawRepresentation); 37Assert.Same(raw, c.RawRepresentation);
Contents\CodeInterpreterToolResultContentTests.cs (3)
16Assert.Null(c.RawRepresentation); 34Assert.Null(c.RawRepresentation); 37Assert.Same(raw, c.RawRepresentation);
Contents\FunctionCallContentTests.cs (4)
23Assert.Null(c.RawRepresentation); 41Assert.Null(c.RawRepresentation); 54Assert.Null(c.RawRepresentation); 57Assert.Same(raw, c.RawRepresentation);
Contents\FunctionResultContentTests.cs (4)
17Assert.Null(c.RawRepresentation); 27Assert.Null(c.RawRepresentation); 39Assert.Null(c.RawRepresentation); 42Assert.Same(raw, c.RawRepresentation);
Contents\HostedFileContentTests.cs (3)
25Assert.Null(c.RawRepresentation); 49Assert.Null(c.RawRepresentation); 52Assert.Same(raw, c.RawRepresentation);
Contents\HostedVectorStoreContentTests.cs (3)
24Assert.Null(c.RawRepresentation); 43Assert.Null(c.RawRepresentation); 46Assert.Same(raw, c.RawRepresentation);
Contents\ImageGenerationToolCallContentTests.cs (3)
15Assert.Null(c.RawRepresentation); 27Assert.Null(c.RawRepresentation); 30Assert.Same(raw, c.RawRepresentation);
Contents\ImageGenerationToolResultContentTests.cs (3)
17Assert.Null(c.RawRepresentation); 35Assert.Null(c.RawRepresentation); 38Assert.Same(raw, c.RawRepresentation);
Contents\McpServerToolCallContentTests.cs (3)
18Assert.Null(c.RawRepresentation); 32Assert.Null(c.RawRepresentation); 35Assert.Same(raw, c.RawRepresentation);
Contents\McpServerToolResultContentTests.cs (3)
18Assert.Null(c.RawRepresentation); 28Assert.Null(c.RawRepresentation); 31Assert.Same(raw, c.RawRepresentation);
Contents\TextContentTests.cs (3)
18Assert.Null(c.RawRepresentation); 28Assert.Null(c.RawRepresentation); 31Assert.Same(raw, c.RawRepresentation);
Contents\TextReasoningContentTests.cs (3)
18Assert.Null(c.RawRepresentation); 29Assert.Null(c.RawRepresentation); 32Assert.Same(raw, c.RawRepresentation);
Contents\ToolCallContentTests.cs (3)
19Assert.Null(c.RawRepresentation); 34Assert.Null(c.RawRepresentation); 37Assert.Same(raw, c.RawRepresentation);
Contents\ToolResultContentTests.cs (3)
18Assert.Null(c.RawRepresentation); 33Assert.Null(c.RawRepresentation); 36Assert.Same(raw, c.RawRepresentation);
Contents\UsageContentTests.cs (2)
22Assert.Null(c.RawRepresentation); 39Assert.Null(c.RawRepresentation);
Contents\WebSearchToolCallContentTests.cs (3)
15Assert.Null(c.RawRepresentation); 33Assert.Null(c.RawRepresentation); 36Assert.Same(raw, c.RawRepresentation);
Contents\WebSearchToolResultContentTests.cs (3)
17Assert.Null(c.RawRepresentation); 38Assert.Null(c.RawRepresentation); 41Assert.Same(raw, c.RawRepresentation);
Microsoft.Extensions.AI.OpenAI (7)
OpenAIAssistantsChatClient.cs (1)
534case AIContent when content.RawRepresentation is MessageContent rawRep:
OpenAIChatClient.cs (2)
267if (content.RawRepresentation is ChatMessageContentPart raw) 292case AIContent when content.RawRepresentation is ChatMessageContentPart rawContentPart:
OpenAIResponsesChatClient.cs (4)
1319{ RawRepresentation: ResponseItem rawRep } => rawRep, 1343case AIContent when item.RawRepresentation is ResponseContentPart rawRep: 1406case AIContent when item.RawRepresentation is ResponseItem rawRep: 1540case AIContent when item.RawRepresentation is ResponseItem rawRep:
Microsoft.Extensions.AI.OpenAI.Tests (87)
OpenAIConversionTests.cs (54)
871Assert.Same(messages[0].Contents[1].RawRepresentation, items[1]); 872Assert.Same(messages[0].Contents[2].RawRepresentation, items[2]); 876Assert.Same(messages[1].Contents[1].RawRepresentation, items[5]); 877Assert.Same(messages[2].Contents[0].RawRepresentation, items[6]); 1030Assert.Null(mcpToolCallContent.RawRepresentation); // Intentionally null to avoid duplication during roundtrip 1035Assert.NotNull(mcpToolResultContent.RawRepresentation); 1036Assert.Same(mcpToolCall, mcpToolResultContent.RawRepresentation); 1042Assert.NotNull(approvalRequest.RawRepresentation); 1043Assert.Same(mcpApprovalRequest, approvalRequest.RawRepresentation); 1054Assert.NotNull(approvalResponse.RawRepresentation); 1055Assert.Same(mcpApprovalResponse, approvalResponse.RawRepresentation); 1069Assert.Null(wsToolCall.RawRepresentation); 1075Assert.Same(webSearchItem, wsToolResult.RawRepresentation); 1081Assert.Null(fsToolCall.RawRepresentation); 1086Assert.Same(fileSearchItem, fsToolResult.RawRepresentation); 1092Assert.Same(computerItem, cuToolCall.RawRepresentation); 1098Assert.Same(computerOutput, cuToolResult.RawRepresentation); 1101AIContent? apCallContent = updates[9].Contents.FirstOrDefault(c => c.RawRepresentation == applyPatchItem); 1103Assert.Same(applyPatchItem, apCallContent.RawRepresentation); 1106AIContent? apOutputContent = updates[10].Contents.FirstOrDefault(c => c.RawRepresentation == applyPatchOutputItem); 1108Assert.Same(applyPatchOutputItem, apOutputContent.RawRepresentation); 1145AIContent? genericContent = updates[0].Contents.FirstOrDefault(c => c.RawRepresentation == mcpApprovalResponse); 1148Assert.Same(mcpApprovalResponse, genericContent.RawRepresentation); 1307Assert.NotNull(textContent.RawRepresentation); 1308Assert.IsAssignableFrom<ResponseContentPart>(textContent.RawRepresentation); 1314Assert.NotNull(reasoningContent.RawRepresentation); 1315Assert.Same(reasoningItem, reasoningContent.RawRepresentation); 1322Assert.NotNull(functionCallContent.RawRepresentation); 1323Assert.Same(functionCallItem, functionCallContent.RawRepresentation); 1330Assert.NotNull(functionResultContent.RawRepresentation); 1331Assert.Same(functionOutputItem, functionResultContent.RawRepresentation); 1340Assert.Null(mcpToolCall.RawRepresentation); // Intentionally null to avoid duplication during roundtrip 1345Assert.NotNull(mcpToolResult.RawRepresentation); 1346Assert.Same(mcpToolCallItem, mcpToolResult.RawRepresentation); 1352Assert.NotNull(approvalRequestContent.RawRepresentation); 1353Assert.Same(mcpApprovalRequestItem, approvalRequestContent.RawRepresentation); 1359Assert.NotNull(nestedMcpCall.RawRepresentation); 1360Assert.Same(mcpApprovalRequestItem, nestedMcpCall.RawRepresentation); 1367Assert.NotNull(approvalResponseContent.RawRepresentation); 1368Assert.Same(mcpApprovalResponseItem, approvalResponseContent.RawRepresentation); 1381Assert.Null(webSearchToolCall.RawRepresentation); // Intentionally null to avoid duplication during roundtrip 1385Assert.Same(webSearchItem, webSearchToolResult.RawRepresentation); 1390Assert.Null(fileSearchToolCall.RawRepresentation); 1394Assert.Same(fileSearchItem, fileSearchToolResult.RawRepresentation); 1399Assert.Same(computerItem, computerToolCall.RawRepresentation); 1404Assert.Same(computerOutput, computerToolResult.RawRepresentation); 1409Assert.Same(applyPatchItem, applyPatchToolCall.RawRepresentation); 1414Assert.Same(applyPatchOutputItem, applyPatchToolResult.RawRepresentation); 1437AIContent? genericContent = message.Contents.FirstOrDefault(c => c.RawRepresentation == mcpApprovalResponseItem); 1440Assert.Same(mcpApprovalResponseItem, genericContent.RawRepresentation); 1460Assert.NotNull(content.RawRepresentation); 1461Assert.IsAssignableFrom<ResponseContentPart>(content.RawRepresentation); 1480Assert.NotNull(content.RawRepresentation); 1481Assert.IsAssignableFrom<ResponseContentPart>(content.RawRepresentation);
OpenAIHostedFileClientIntegrationTests.cs (4)
51Assert.NotNull(uploadedFile.RawRepresentation); 287if (content is CodeInterpreterToolResultContent { RawRepresentation: OpenAI.Responses.CodeInterpreterCallResponseItem cicri }) 357if (content is CodeInterpreterToolResultContent { RawRepresentation: OpenAI.Responses.CodeInterpreterCallResponseItem cicri }) 405if (content is CodeInterpreterToolResultContent { RawRepresentation: OpenAI.Responses.CodeInterpreterCallResponseItem cicri })
OpenAIHostedFileClientTests.cs (4)
121Assert.NotNull(result.RawRepresentation); 210Assert.NotNull(result.RawRepresentation); 269Assert.NotNull(files[0].RawRepresentation); 276Assert.NotNull(files[1].RawRepresentation);
OpenAIResponseClientIntegrationTests.cs (11)
344.Where(c => c.RawRepresentation is ResponseItem) 345.Select(c => ModelReaderWriter.Write((ResponseItem)c.RawRepresentation!, ModelReaderWriterOptions.Json).ToString()) 720Assert.NotNull(reasoningContent.RawRepresentation); 740Assert.Null(deserializedReasoning.RawRepresentation); 821Assert.Null(deserializedReasoning.RawRepresentation); 880.Where(c => c.RawRepresentation is ResponseItem) 881.Select(c => ModelReaderWriter.Write((ResponseItem)c.RawRepresentation!, ModelReaderWriterOptions.Json).ToString()) 990.Where(c => c.RawRepresentation is ResponseItem) 991.Select(c => ModelReaderWriter.Write((ResponseItem)c.RawRepresentation!, ModelReaderWriterOptions.Json).ToString()) 1040.Where(c => c.RawRepresentation is ResponseItem) 1041.Select(c => ModelReaderWriter.Write((ResponseItem)c.RawRepresentation!, ModelReaderWriterOptions.Json).ToString())
OpenAIResponseClientTests.cs (14)
911Assert.NotNull(computerUserItem.RawRepresentation); 913Assert.IsType<ComputerCallResponseItem>(computerUserItem.RawRepresentation); 1016var ccri = Assert.IsType<ComputerCallResponseItem>(content.RawRepresentation); 6077Assert.IsType<FunctionCallOutputResponseItem>(frc.RawRepresentation); 6856Assert.IsType<ApplyPatchCallItem>(toolCall.RawRepresentation); 6861Assert.IsType<ApplyPatchCallOutputItem>(toolResult.RawRepresentation); 7145Assert.NotNull(wsResult.RawRepresentation); 7151var source0Raw = Assert.IsType<WebSearchActionUriSource>(source0.RawRepresentation); 7156var source1Raw = Assert.IsType<WebSearchActionUriSource>(source1.RawRepresentation); 7273Assert.NotNull(wsCallInProgress.RawRepresentation); 7278Assert.Null(wsCallDone.RawRepresentation); 7286Assert.NotNull(wsResult.RawRepresentation); 7291Assert.IsType<WebSearchActionUriSource>(streamSource.RawRepresentation); 7309Assert.NotNull(coalescedWsResult.RawRepresentation);
Microsoft.Extensions.AI.Stabilization.Tests (21)
parent\Microsoft.Extensions.AI.Abstractions.Tests\Contents\CodeInterpreterToolCallContentTests.cs (3)
16Assert.Null(c.RawRepresentation); 34Assert.Null(c.RawRepresentation); 37Assert.Same(raw, c.RawRepresentation);
parent\Microsoft.Extensions.AI.Abstractions.Tests\Contents\CodeInterpreterToolResultContentTests.cs (3)
16Assert.Null(c.RawRepresentation); 34Assert.Null(c.RawRepresentation); 37Assert.Same(raw, c.RawRepresentation);
parent\Microsoft.Extensions.AI.Abstractions.Tests\Contents\HostedFileContentTests.cs (3)
25Assert.Null(c.RawRepresentation); 49Assert.Null(c.RawRepresentation); 52Assert.Same(raw, c.RawRepresentation);
parent\Microsoft.Extensions.AI.Abstractions.Tests\Contents\ImageGenerationToolCallContentTests.cs (3)
15Assert.Null(c.RawRepresentation); 27Assert.Null(c.RawRepresentation); 30Assert.Same(raw, c.RawRepresentation);
parent\Microsoft.Extensions.AI.Abstractions.Tests\Contents\ImageGenerationToolResultContentTests.cs (3)
17Assert.Null(c.RawRepresentation); 35Assert.Null(c.RawRepresentation); 38Assert.Same(raw, c.RawRepresentation);
parent\Microsoft.Extensions.AI.Abstractions.Tests\Contents\WebSearchToolCallContentTests.cs (3)
15Assert.Null(c.RawRepresentation); 33Assert.Null(c.RawRepresentation); 36Assert.Same(raw, c.RawRepresentation);
parent\Microsoft.Extensions.AI.Abstractions.Tests\Contents\WebSearchToolResultContentTests.cs (3)
17Assert.Null(c.RawRepresentation); 38Assert.Null(c.RawRepresentation); 41Assert.Same(raw, c.RawRepresentation);
Microsoft.Extensions.AI.Tests (2)
ChatCompletion\FunctionInvokingChatClientTests.cs (2)
434Assert.Equal("CustomRaw", capturedFrc.RawRepresentation); 2335RawRepresentation = fcc.RawRepresentation