1 write to CallId
Microsoft.Extensions.AI.Abstractions (1)
Contents\ToolCallContent.cs (1)
27
CallId
= Throw.IfNull(callId);
191 references to CallId
Microsoft.AspNetCore.Components.AI (5)
Blocks\FunctionInvocationContentBlock.cs (1)
39
Id = value.
CallId
;
Blocks\UIActionBlock.cs (1)
86
Result = new FunctionResultContent(Call.
CallId
?? Id, result);
Pipeline\FunctionApprovalHandler.cs (1)
35
? functionCall.
CallId
?? approvalRequest.RequestId
Pipeline\FunctionInvocationHandler.cs (1)
39
result.CallId == state.Call.
CallId
)
Pipeline\UIActionHandler.cs (1)
35
Id = call.
CallId
?? Guid.NewGuid().ToString("N")
Microsoft.Extensions.AI (24)
ChatCompletion\FunctionInvokingChatClient.cs (12)
921
/// if there is a matching <see cref="FunctionResultContent"/> with the same <see cref="ToolCallContent.
CallId
"/> in the same set of messages,
954
if (contents[j] is FunctionCallContent fcc && !fcc.InformationalOnly && resultCallIds.Contains(fcc.
CallId
))
964
/// if there is a matching <see cref="FunctionResultContent"/> with the same <see cref="ToolCallContent.
CallId
"/>, regardless of order.
999
if (resultCallIds.Contains(functionCallContents[i].
CallId
))
1287
frc.CallId == result.CallContent.
CallId
)
1311
return new FunctionResultContent(result.CallContent.
CallId
, functionResult) { Exception = result.Exception };
1454
_ = (approvalRequestCallIds ??= []).Add(tarc.ToolCall.
CallId
);
1460
_ = approvalRequestCallIds?.Remove(tarc.ToolCall.
CallId
);
1519
if (approvalResponse.ToolCall is not FunctionCallContent fcc || functionResultCallIds?.Contains(fcc.
CallId
) is true)
1567
return (AIContent)new FunctionResultContent(m.ResponseFunctionCallContent.
CallId
, result);
1722
updatedContent[i] = new ToolApprovalRequestContent(ComposeApprovalRequestId(fcc.
CallId
), fcc)
1790
message.Contents[contentIndex] = new ToolApprovalRequestContent(ComposeApprovalRequestId(functionCall.
CallId
), functionCall)
ChatCompletion\ImageGeneratingChatClient.cs (4)
336
newContents.Add(new ImageGenerationToolCallContent(functionCall.
CallId
));
373
var callId = FunctionInvokingChatClient.CurrentContext?.CallContent.
CallId
;
408
var callId = FunctionInvokingChatClient.CurrentContext?.CallContent.
CallId
;
426
var callId = FunctionInvokingChatClient.CurrentContext?.CallContent.
CallId
;
Common\FunctionInvocationProcessor.cs (1)
167
new(OpenTelemetryConsts.GenAI.Tool.Call.Id, context.CallContent.
CallId
),
Common\OtelMessageSerializer.cs (4)
80
Id = fcc.
CallId
,
136
Id = citcc.
CallId
,
159
Id = igtcc.
CallId
,
179
Id = mstcc.
CallId
,
Realtime\FunctionInvokingRealtimeClientSession.cs (1)
382
var functionResultContent = new FunctionResultContent(result.CallContent.
CallId
, resultValue)
Realtime\OpenTelemetryRealtimeClientSession.cs (2)
542
Id = fcc.
CallId
,
599
Id = mstcc.
CallId
,
Microsoft.Extensions.AI.Abstractions (9)
ChatCompletion\ChatResponseExtensions.cs (6)
244
if (webSearchCallIndexById.TryGetValue(webSearchCall.
CallId
, out int existingIndex))
254
contents[existingIndex] = new WebSearchToolCallContent(existing.
CallId
)
270
webSearchCallIndexById[webSearchCall.
CallId
] = i;
351
canMerge: static (r1, r2) => r1.
CallId
== r2.
CallId
,
378
return new(firstContent.
CallId
)
Contents\FunctionCallContent.cs (2)
114
if (
CallId
is not null)
116
display += $"{
CallId
}, ";
Contents\ToolResultContent.cs (1)
35
/// <see cref="ToolCallContent.
CallId
"/> value.
Microsoft.Extensions.AI.Abstractions.Tests (53)
AssertExtensions.cs (4)
54
Assert.Equal(expectedApprovalRequest.ToolCall.
CallId
, actualApprovalRequest.ToolCall.
CallId
);
63
Assert.Equal(expectedApprovalResponse.ToolCall.
CallId
, actualApprovalResponse.ToolCall.
CallId
);
ChatCompletion\ChatMessageTests.cs (2)
329
Assert.Equal("function-id", functionCallContent.
CallId
);
388
Assert.Equal("call1", funcCall.
CallId
);
ChatCompletion\ChatResponseUpdateExtensionsTests.cs (3)
1047
var ws1 = webSearchCalls.First(ws => ws.
CallId
== "ws1");
1055
var ws2 = webSearchCalls.First(ws => ws.
CallId
== "ws2");
1075
Assert.Equal("ws1", ws1.
CallId
);
Contents\CodeInterpreterToolCallContentTests.cs (4)
18
Assert.Equal("callId1", c.
CallId
);
27
Assert.Equal("call123", c.
CallId
);
81
Assert.Equal("call123", deserializedSut.
CallId
);
113
Assert.Equal("ci-call1", ciCall.
CallId
);
Contents\FunctionCallContentTests.cs (12)
26
Assert.Equal("callId1", c.
CallId
);
45
Assert.Equal("id", c.
CallId
);
64
Assert.Equal("callId1", c.
CallId
);
124
Assert.Equal("callId1", deserialized.
CallId
);
137
Assert.Equal("callId1", deserialized.
CallId
);
153
Assert.Equal(original.
CallId
, deserialized.
CallId
);
172
Assert.Equal("callId1", deserializedSut.
CallId
);
392
Assert.Equal("callId", content.
CallId
);
429
Assert.Equal(content.
CallId
, deserializedContent.
CallId
);
459
Assert.Equal("call123", funcCall.
CallId
);
Contents\ImageGenerationToolCallContentTests.cs (5)
17
Assert.Equal("call123", c.
CallId
);
25
Assert.Equal("img123", c.
CallId
);
47
Assert.Equal("img123", deserializedSut.
CallId
);
63
Assert.Equal("img456", ((ImageGenerationToolCallContent)deserialized).
CallId
);
83
Assert.Equal("img-call1", imgCall.
CallId
);
Contents\InputRequestContentTests.cs (1)
90
Assert.Equal("call1", funcCall.
CallId
);
Contents\InputResponseContentTests.cs (1)
92
Assert.Equal("call1", funcCall.
CallId
);
Contents\McpServerToolCallContentTests.cs (5)
21
Assert.Equal("callId1", c.
CallId
);
47
Assert.Equal("callId1", c.
CallId
);
82
Assert.Equal(content.
CallId
, deserializedContent.
CallId
);
112
Assert.Equal("call1", mcpCall.
CallId
);
Contents\ToolApprovalRequestContentTests.cs (3)
99
Assert.Equal(content.ToolCall.
CallId
, deserializedContent.ToolCall.
CallId
);
128
Assert.Equal("call1", funcCall.
CallId
);
Contents\ToolApprovalResponseContentTests.cs (5)
73
Assert.Equal(content.ToolCall.
CallId
, deserializedContent.ToolCall.
CallId
);
96
Assert.Equal(content.ToolCall.
CallId
, functionCall.
CallId
);
128
Assert.Equal("call1", funcCall.
CallId
);
Contents\ToolCallContentTests.cs (3)
18
Assert.Equal("callId1", c.
CallId
);
44
Assert.Equal("callId1", c.
CallId
);
102
Assert.Equal("tc1", toolCall.
CallId
);
Contents\WebSearchToolCallContentTests.cs (5)
17
Assert.Equal("callId", c.
CallId
);
26
Assert.Equal("ws_call123", c.
CallId
);
56
Assert.Equal("ws_call123", deserialized.
CallId
);
72
Assert.Equal("ws_call456", result.
CallId
);
94
Assert.Equal("ws-call1", wsCall.
CallId
);
Microsoft.Extensions.AI.Integration.Tests (1)
PromptBasedFunctionCallingChatClient.cs (1)
76
var toolCallJson = JsonSerializer.Serialize(new { fcc.
CallId
, fcc.Name, fcc.Arguments }, _jsonOptions);
Microsoft.Extensions.AI.OpenAI (6)
MicrosoftExtensionsAIChatExtensions.cs (2)
74
.OfType<FunctionCallContent>().Select(c => ChatToolCall.CreateFunctionToolCall(c.
CallId
, c.Name,
158
fcc.
CallId
,
OpenAIChatClient.cs (1)
219
ChatToolCall.CreateFunctionToolCall(fc.
CallId
, fc.Name, new(JsonSerializer.SerializeToUtf8Bytes(
OpenAIRealtimeClientSession.cs (1)
652
functionCall.
CallId
?? string.Empty,
OpenAIResponsesChatClient.cs (2)
1578
(idToContentMapping ??= [])[mstcc.
CallId
] = mstcc;
1583
callContent.
CallId
,
Microsoft.Extensions.AI.OpenAI.Tests (52)
OpenAIChatClientTests.cs (1)
1349
Assert.Equal("call_F9ZaqPWo69u0urxAhVt8meDW", fcc.
CallId
);
OpenAIConversionTests.cs (18)
1021
Assert.Equal("call_abc", fcc.
CallId
);
1027
Assert.Equal("mcp_call_123", mcpToolCallContent.
CallId
);
1059
Assert.Equal("mcpr_123", correlatedMcpCall.
CallId
);
1068
Assert.Equal("ws_123", wsToolCall.
CallId
);
1080
Assert.Equal("fs_123", fsToolCall.
CallId
);
1091
Assert.Equal("call_456", cuToolCall.
CallId
);
1239
Assert.Equal("call123", functionCall.
CallId
);
1320
Assert.Equal("call_abc", functionCallContent.
CallId
);
1335
McpServerToolCallContent? mcpToolCall = message.Contents.OfType<McpServerToolCallContent>().FirstOrDefault(c => c.
CallId
== "mcp_call_123");
1337
Assert.Equal("mcp_call_123", mcpToolCall.
CallId
);
1372
Assert.Equal("mcpr_123", correlatedMcpCall.
CallId
);
1379
WebSearchToolCallContent? webSearchToolCall = message.Contents.OfType<WebSearchToolCallContent>().FirstOrDefault(c => c.
CallId
== "ws_123");
1388
ToolCallContent? fileSearchToolCall = message.Contents.OfType<ToolCallContent>().FirstOrDefault(c => c.
CallId
== "fs_123");
1397
ToolCallContent? computerToolCall = message.Contents.OfType<ToolCallContent>().FirstOrDefault(c => c.
CallId
== "call_456");
1407
ToolCallContent? applyPatchToolCall = message.Contents.OfType<ToolCallContent>().FirstOrDefault(c => c.
CallId
== "call_patch_789");
2289
Assert.Equal("ws_1", wsCall.
CallId
);
2305
Assert.Equal("ws_2", wsCall.
CallId
);
2321
Assert.Equal("ws_3", wsCall.
CallId
);
OpenAIResponseClientIntegrationTests.cs (6)
51
Assert.NotNull(toolCallContent.
CallId
);
52
Assert.NotEmpty(toolCallContent.
CallId
);
100
Assert.NotNull(wsCall.
CallId
);
106
Assert.Equal(wsCall.
CallId
, wsResult.CallId);
167
Assert.NotNull(igCall.
CallId
);
171
Assert.Equal(igCall.
CallId
, igResult.CallId);
OpenAIResponseClientTests.cs (23)
1022
Assert.Equal("call_zw3...", computerToolCall.
CallId
);
1120
Assert.Equal("call_p7K8YjFwNjqMgkKhSiExgFH6", content.
CallId
);
1740
Assert.Equal("mcp_06ee3b1962eeb8470068e6b21cbaa081a3b5aa2a6c989f4c6f", call.
CallId
);
2117
Assert.Equal("mcp_68be4166acfc8191bc5e0a751eed358b0384f747588fc3f5", firstCall.
CallId
);
2129
Assert.Equal("mcp_68be416900f88191837ae0718339a4ce0384f747588fc3f5", secondCall.
CallId
);
2528
Assert.Equal("mcp_68be4503d45c819e89cb574361c8eba003a2537be0e84a54", firstCall.
CallId
);
2540
Assert.Equal("mcp_68be4505f134819e806c002f27cce0c303a2537be0e84a54", secondCall.
CallId
);
2737
Assert.Equal("mcp_689023b0fa88819f99f48aff343d5ad50475557f6fefb5f0", toolCall.
CallId
);
3509
Assert.Equal(codeCall.
CallId
, codeResult.CallId);
3729
Assert.Equal(codeCall.
CallId
, codeResult.CallId);
3818
Assert.Equal("ci_05d8f42f04f94cb80068fc3b80fba8819ea3bfbdd36e94bcf3", content.
CallId
);
3848
Assert.Equal("ci_05d8f42f04f94cb80068fc3b80fba8819ea3bfbdd36e94bcf3", codeCall.
CallId
);
6218
Assert.Equal("call_123", fcc.
CallId
);
6534
Assert.Equal("img_call_abc123", toolCall.
CallId
);
6640
Assert.Equal("img_call_def456", toolCall.
CallId
);
6799
Assert.Equal("img_call_ghi789", toolCall.
CallId
);
7006
Assert.Equal("call_patch_001", toolCall.
CallId
);
7291
Assert.Equal("ws_0ed9cd9f8606486b0069888072b3d08190818b61da9cf032a7", wsCall.
CallId
);
7423
Assert.Equal("ws_02441a08b3f3bf4b00698880914730819eb48b3ae0c359bff3", wsCallInProgress.
CallId
);
7428
Assert.Equal("ws_02441a08b3f3bf4b00698880914730819eb48b3ae0c359bff3", wsCallDone.
CallId
);
7455
Assert.Equal("ws_02441a08b3f3bf4b00698880914730819eb48b3ae0c359bff3", coalescedWsCall.
CallId
);
7459
Assert.Equal(coalescedWsCall.
CallId
, coalescedWsResult.CallId);
9091
Assert.Equal("call_tag_def", call.
CallId
);
test\Libraries\Microsoft.Extensions.AI.Abstractions.Tests\AssertExtensions.cs (4)
54
Assert.Equal(expectedApprovalRequest.ToolCall.
CallId
, actualApprovalRequest.ToolCall.
CallId
);
63
Assert.Equal(expectedApprovalResponse.ToolCall.
CallId
, actualApprovalResponse.ToolCall.
CallId
);
Microsoft.Extensions.AI.Stabilization.Tests (14)
test\Libraries\Microsoft.Extensions.AI.Abstractions.Tests\Contents\CodeInterpreterToolCallContentTests.cs (4)
18
Assert.Equal("callId1", c.
CallId
);
27
Assert.Equal("call123", c.
CallId
);
81
Assert.Equal("call123", deserializedSut.
CallId
);
113
Assert.Equal("ci-call1", ciCall.
CallId
);
test\Libraries\Microsoft.Extensions.AI.Abstractions.Tests\Contents\ImageGenerationToolCallContentTests.cs (5)
17
Assert.Equal("call123", c.
CallId
);
25
Assert.Equal("img123", c.
CallId
);
47
Assert.Equal("img123", deserializedSut.
CallId
);
63
Assert.Equal("img456", ((ImageGenerationToolCallContent)deserialized).
CallId
);
83
Assert.Equal("img-call1", imgCall.
CallId
);
test\Libraries\Microsoft.Extensions.AI.Abstractions.Tests\Contents\WebSearchToolCallContentTests.cs (5)
17
Assert.Equal("callId", c.
CallId
);
26
Assert.Equal("ws_call123", c.
CallId
);
56
Assert.Equal("ws_call123", deserialized.
CallId
);
72
Assert.Equal("ws_call456", result.
CallId
);
94
Assert.Equal("ws-call1", wsCall.
CallId
);
Microsoft.Extensions.AI.Tests (27)
ChatCompletion\DistributedCachingChatClientTest.cs (4)
820
Assert.Equal(expectedFcc.
CallId
, actualFcc.
CallId
);
854
Assert.Equal(expectedFcc.
CallId
, actualFcc.
CallId
);
ChatCompletion\FunctionInvokingChatClientApprovalsTests.cs (9)
1504
if (functionCall.
CallId
== "callId1")
1512
else if (functionCall.
CallId
== "callId2")
1598
Assert.Equal("callId1", approvalRequest1.ToolCall.
CallId
);
1606
Assert.Equal("callId2", approvalRequest2.ToolCall.
CallId
);
1614
Assert.Equal("callId1", approvalRequest3.ToolCall.
CallId
);
2094
McpServerToolCallContent mstcc => new McpServerToolCallContent(mstcc.
CallId
, mstcc.Name, mstcc.ServerName)
2098
FunctionCallContent fcc => new FunctionCallContent(fcc.
CallId
, fcc.Name, fcc.Arguments)
2146
.Select(t => t.ToolCall.
CallId
));
2157
.Where(fcc => !fcc.InformationalOnly && processedCallIds.Contains(fcc.
CallId
)))
ChatCompletion\FunctionInvokingChatClientTests.cs (6)
406
returnedFrc = new FunctionResultContent(ctx.CallContent.
CallId
, "Custom result from function")
569
returnedFrc = new DerivedFunctionResultContent(ctx.CallContent.
CallId
, "Derived result")
2180
Assert.Contains(response.Messages, m => m.Contents.Any(c => c is FunctionCallContent fcc && fcc.
CallId
== "callId1" && fcc.InformationalOnly));
2329
cloned.Add(new FunctionCallContent(fcc.
CallId
, fcc.Name, fcc.Arguments)
3500
m.Contents.Any(c => c is FunctionCallContent fcc2 && fcc2.
CallId
== "callId1" && fcc2.InformationalOnly));
3578
m.Contents.Any(c => c is FunctionCallContent fcc2 && fcc2.
CallId
== "callId1" && fcc2.InformationalOnly));
ChatCompletion\ImageGeneratingChatClientTests.cs (2)
340
Assert.Equal(callId, imageToolCallContent.
CallId
);
384
Assert.Equal(callId, imageToolCallContent.
CallId
);
ChatReduction\SummarizingChatReducerTests.cs (2)
219
Assert.Contains(resultList, m => m.Contents.Any(c => c is FunctionCallContent fc && fc.
CallId
== "call2"));
221
Assert.DoesNotContain(resultList, m => m.Contents.Any(c => c is FunctionCallContent fc && fc.
CallId
== "call1"));
test\Libraries\Microsoft.Extensions.AI.Abstractions.Tests\AssertExtensions.cs (4)
54
Assert.Equal(expectedApprovalRequest.ToolCall.
CallId
, actualApprovalRequest.ToolCall.
CallId
);
63
Assert.Equal(expectedApprovalResponse.ToolCall.
CallId
, actualApprovalResponse.ToolCall.
CallId
);