38 instantiations of FunctionResultContent
Microsoft.Extensions.AI (1)
ChatCompletion\FunctionInvokingChatClient.cs (1)
615return new FunctionResultContent(result.CallContent.CallId, result.CallContent.Name, functionResult) { Exception = result.Exception };
Microsoft.Extensions.AI.Abstractions.Tests (9)
ChatCompletion\ChatCompletionTests.cs (1)
252new FunctionResultContent("call123", "name", 42),
ChatCompletion\ChatMessageTests.cs (2)
132new FunctionResultContent("callId1", "fc2", "result"), 289new FunctionResultContent("function-id", "plugin-name-function-name", "function-result"),
ChatCompletion\StreamingChatCompletionUpdateTests.cs (1)
99new FunctionResultContent("callId1", "fc2", "result"),
Contents\FunctionResultContentTests.cs (5)
15FunctionResultContent c = new("callId1", "functionName", null); 27FunctionResultContent c = new("id", "name", "result"); 39FunctionResultContent c = new("callId1", "functionName", null); 69var sut = new FunctionResultContent("id", "p1-f1", "result"); 87var sut = new FunctionResultContent("callId1", "functionName", null) { Exception = new InvalidOperationException("hello") };
Microsoft.Extensions.AI.Ollama.Tests (1)
OllamaChatClientTests.cs (1)
461new(ChatRole.Tool, [new FunctionResultContent("abcd1234", "GetPersonAge", 42)]),
Microsoft.Extensions.AI.OpenAI.Tests (2)
OpenAIChatClientTests.cs (2)
897new FunctionResultContent("12345", "SayHello", "Said hello"), 898new FunctionResultContent("12346", "SayHi", "Said hi"),
Microsoft.Extensions.AI.Tests (25)
ChatCompletion\FunctionInvokingChatClientTests.cs (24)
59new ChatMessage(ChatRole.Tool, [new FunctionResultContent("callId1", "Func1", result: "Result 1")]), 61new ChatMessage(ChatRole.Tool, [new FunctionResultContent("callId2", "Func2", result: "Result 2: 42")]), 63new ChatMessage(ChatRole.Tool, [new FunctionResultContent("callId3", "VoidReturn", result: "Success: Function completed.")]), 97new FunctionResultContent("callId1", "Func1", result: "Result 1"), 98new FunctionResultContent("callId2", "Func2", result: "Result 2: 34"), 99new FunctionResultContent("callId3", "Func2", result: "Result 2: 56"), 108new FunctionResultContent("callId4", "Func2", result: "Result 2: 78"), 109new FunctionResultContent("callId5", "Func1", result: "Result 1") 148new FunctionResultContent("callId1", "Func", result: "hellohello"), 149new FunctionResultContent("callId2", "Func", result: "worldworld"), 191new FunctionResultContent("callId1", "Func", result: "hellohello"), 192new FunctionResultContent("callId2", "Func", result: "worldworld"), 221new ChatMessage(ChatRole.Tool, [new FunctionResultContent("callId1", "Func1", result: "Result 1")]), 223new ChatMessage(ChatRole.Tool, [new FunctionResultContent("callId2", "Func2", result: "Result 2: 42")]), 225new ChatMessage(ChatRole.Tool, [new FunctionResultContent("callId3", "VoidReturn", result: "Success: Function completed.")]), 273new ChatMessage(ChatRole.Tool, [new FunctionResultContent("callId2", "Func1", result: "Result 1")]), 275new ChatMessage(ChatRole.Tool, [new FunctionResultContent("callId2", "Func2", result: "Result 2: 42")]), 277new ChatMessage(ChatRole.Tool, [new FunctionResultContent("callId3", "VoidReturn", result: "Success: Function completed.")]), 296new ChatMessage(ChatRole.Tool, [new FunctionResultContent("callId2", "Func1", result: "Result 1")]), 298new ChatMessage(ChatRole.Tool, [new FunctionResultContent("callId2", "Func2", result: "Result 2: 42")]), 300new ChatMessage(ChatRole.Tool, [new FunctionResultContent("callId3", "VoidReturn", result: "Success: Function completed.")]), 339new ChatMessage(ChatRole.Tool, [new FunctionResultContent("callId1", "Func1", result: detailedErrors ? "Error: Function failed. Exception: Oh no!" : "Error: Function failed.")]), 398new ChatMessage(ChatRole.Tool, [new FunctionResultContent("callId1", "Func1", result: "Result 1")]), 454new ChatMessage(ChatRole.Tool, [new FunctionResultContent("callId1", "Func1", result: "Result 1")]),
ChatCompletion\OpenTelemetryChatClientTests.cs (1)
103new(ChatRole.Tool, [new FunctionResultContent("12345", "GetPersonName", "John")]),
34 references to FunctionResultContent
Microsoft.Extensions.AI (6)
ChatCompletion\FunctionInvokingChatClient.cs (4)
27/// producing a <see cref="FunctionResultContent"/>. 97/// the <see cref="FunctionResultContent.Exception"/> property. 140/// those messages to the list of messages, along with <see cref="FunctionResultContent"/> instances 589FunctionResultContent CreateFunctionResultContent(FunctionInvocationResult result)
ChatCompletion\OpenTelemetryChatClient.cs (2)
421foreach (FunctionResultContent frc in message.Contents.OfType<FunctionResultContent>())
Microsoft.Extensions.AI.Abstractions (2)
Contents\AIContent.cs (1)
13[JsonDerivedType(typeof(FunctionResultContent), typeDiscriminator: "functionResult")]
Contents\FunctionResultContent.cs (1)
19/// Initializes a new instance of the <see cref="FunctionResultContent"/> class.
Microsoft.Extensions.AI.Abstractions.Tests (12)
ChatCompletion\ChatCompletionTests.cs (1)
289Assert.IsType<FunctionResultContent>(update1.Contents[1]);
ChatCompletion\ChatMessageTests.cs (2)
366var functionResultContent = deserializedMessage.Contents[7] as FunctionResultContent;
Contents\FunctionResultContentTests.cs (9)
15FunctionResultContent c = new("callId1", "functionName", null); 27FunctionResultContent c = new("id", "name", "result"); 39FunctionResultContent c = new("callId1", "functionName", null); 69var sut = new FunctionResultContent("id", "p1-f1", "result"); 74var deserializedSut = JsonSerializer.Deserialize<FunctionResultContent>(json, TestJsonSerializerContext.Default.Options); 87var sut = new FunctionResultContent("callId1", "functionName", null) { Exception = new InvalidOperationException("hello") }; 91var deserializedSut = JsonSerializer.Deserialize<FunctionResultContent>(json, TestJsonSerializerContext.Default.Options);
Microsoft.Extensions.AI.AzureAIInference (1)
AzureAIInferenceChatClient.cs (1)
423if (item is FunctionResultContent resultContent)
Microsoft.Extensions.AI.Integration.Tests (1)
PromptBasedFunctionCallingChatClient.cs (1)
63if (message.Contents[itemIndex] is FunctionResultContent frc)
Microsoft.Extensions.AI.Ollama (1)
OllamaChatClient.cs (1)
411case FunctionResultContent frc:
Microsoft.Extensions.AI.OpenAI (1)
OpenAIChatClient.cs (1)
595if (item is FunctionResultContent resultContent)
Microsoft.Extensions.AI.Tests (10)
ChatCompletion\FunctionInvokingChatClientTests.cs (10)
245Assert.Contains(content, c => c is FunctionCallContent or FunctionResultContent); 249Assert.All(content, c => Assert.False(c is FunctionCallContent or FunctionResultContent)); 313Assert.Contains(content, c => c is FunctionCallContent or FunctionResultContent); 317Assert.All(content, c => Assert.False(c is FunctionCallContent or FunctionResultContent)); 555else if (expectedItem is FunctionResultContent expectedFunctionResult) 557var chatFunctionResult = (FunctionResultContent)chatItem; 622else if (expectedItem is FunctionResultContent expectedFunctionResult) 624var chatFunctionResult = (FunctionResultContent)chatItem;