31 instantiations of FunctionResultContent
Microsoft.Extensions.AI (1)
ChatCompletion\FunctionInvokingChatClient.cs (1)
555return new FunctionResultContent(result.CallContent.CallId, result.CallContent.Name, functionResult, result.Exception);
Microsoft.Extensions.AI.Abstractions.Tests (9)
ChatCompletion\ChatMessageTests.cs (2)
131new FunctionResultContent(new FunctionCallContent("callId1", "fc2"), "result"), 294new FunctionResultContent(new FunctionCallContent("function-id", "plugin-name-function-name"), "function-result"),
ChatCompletion\StreamingChatCompletionUpdateTests.cs (1)
99new FunctionResultContent(new FunctionCallContent("callId1", "fc2"), "result"),
Contents\FunctionResultContentTests.cs (6)
15FunctionResultContent c = new("callId1", "functionName", null); 30FunctionResultContent c = new("id", "name", "result", e); 45FunctionResultContent c = new(new FunctionCallContent("id", "name"), "result", e); 57FunctionResultContent c = new("callId1", "functionName", null); 91var sut = new FunctionResultContent(new FunctionCallContent("id", "p1-f1"), "result"); 109var sut = new FunctionResultContent("callId1", "functionName", null, new InvalidOperationException("hello"));
Microsoft.Extensions.AI.Ollama.Tests (1)
OllamaChatClientTests.cs (1)
446new(ChatRole.Tool, [new FunctionResultContent("abcd1234", "GetPersonAge", 42)]),
Microsoft.Extensions.AI.Tests (20)
ChatCompletion\FunctionInvokingChatClientTests.cs (19)
43new ChatMessage(ChatRole.Tool, [new FunctionResultContent("callId1", "Func1", result: "Result 1")]), 45new ChatMessage(ChatRole.Tool, [new FunctionResultContent("callId2", "Func2", result: "Result 2: 42")]), 47new ChatMessage(ChatRole.Tool, [new FunctionResultContent("callId3", "VoidReturn", result: "Success: Function completed.")]), 72new FunctionResultContent("callId1", "Func1", result: "Result 1"), 73new FunctionResultContent("callId2", "Func2", result: "Result 2: 34"), 74new FunctionResultContent("callId3", "Func2", result: "Result 2: 56"), 80new FunctionResultContent("callId4", "Func2", result: "Result 2: 78"), 81new FunctionResultContent("callId5", "Func1", result: "Result 1")]), 109new FunctionResultContent("callId1", "Func", result: "hellohello"), 110new FunctionResultContent("callId2", "Func", result: "worldworld"), 142new FunctionResultContent("callId1", "Func", result: "hellohello"), 143new FunctionResultContent("callId2", "Func", result: "worldworld"), 170new ChatMessage(ChatRole.Tool, [new FunctionResultContent("callId1", "Func1", result: "Result 1")]), 172new ChatMessage(ChatRole.Tool, [new FunctionResultContent("callId2", "Func2", result: "Result 2: 42")]), 174new ChatMessage(ChatRole.Tool, [new FunctionResultContent("callId3", "VoidReturn", result: "Success: Function completed.")]), 217new ChatMessage(ChatRole.Tool, [new FunctionResultContent("callId2", "Func1", result: "Result 1")]), 219new ChatMessage(ChatRole.Tool, [new FunctionResultContent("callId2", "Func2", result: "Result 2: 42")]), 221new ChatMessage(ChatRole.Tool, [new FunctionResultContent("callId3", "VoidReturn", result: "Success: Function completed.")]), 262new ChatMessage(ChatRole.Tool, [new FunctionResultContent("callId1", "Func1", result: detailedErrors ? "Error: Function failed. Exception: Oh no!" : "Error: Function failed.")]),
ChatCompletion\OpenTelemetryChatClientTests.cs (1)
102new(ChatRole.Tool, [new FunctionResultContent("12345", "GetPersonName", "John")]),
30 references to FunctionResultContent
Microsoft.Extensions.AI (6)
ChatCompletion\FunctionInvokingChatClient.cs (4)
23/// producing a <see cref="FunctionResultContent"/>. 84/// the <see cref="FunctionResultContent.Exception"/> property. 122/// those messages to the list of messages, along with <see cref="FunctionResultContent"/> instances 529FunctionResultContent CreateFunctionResultContent(FunctionInvocationResult result)
ChatCompletion\OpenTelemetryChatClient.cs (2)
459foreach (FunctionResultContent frc in message.Contents.OfType<FunctionResultContent>())
Microsoft.Extensions.AI.Abstractions (4)
Contents\AIContent.cs (1)
13[JsonDerivedType(typeof(FunctionResultContent), typeDiscriminator: "functionResult")]
Contents\FunctionResultContent.cs (3)
19/// Initializes a new instance of the <see cref="FunctionResultContent"/> class. 37/// Initializes a new instance of the <see cref="FunctionResultContent"/> class. 56/// Initializes a new instance of the <see cref="FunctionResultContent"/> class.
Microsoft.Extensions.AI.Abstractions.Tests (12)
ChatCompletion\ChatMessageTests.cs (2)
377var functionResultContent = deserializedMessage.Contents[7] as FunctionResultContent;
Contents\FunctionResultContentTests.cs (10)
15FunctionResultContent c = new("callId1", "functionName", null); 30FunctionResultContent c = new("id", "name", "result", e); 45FunctionResultContent c = new(new FunctionCallContent("id", "name"), "result", e); 57FunctionResultContent c = new("callId1", "functionName", null); 91var sut = new FunctionResultContent(new FunctionCallContent("id", "p1-f1"), "result"); 96var deserializedSut = JsonSerializer.Deserialize<FunctionResultContent>(json, TestJsonSerializerContext.Default.Options); 109var sut = new FunctionResultContent("callId1", "functionName", null, new InvalidOperationException("hello")); 113var deserializedSut = JsonSerializer.Deserialize<FunctionResultContent>(json, TestJsonSerializerContext.Default.Options);
Microsoft.Extensions.AI.AzureAIInference (1)
AzureAIInferenceChatClient.cs (1)
431if (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)
380case FunctionResultContent frc:
Microsoft.Extensions.AI.OpenAI (1)
OpenAIChatClient.cs (1)
591if (item is FunctionResultContent resultContent)
Microsoft.Extensions.AI.Tests (4)
ChatCompletion\FunctionInvokingChatClientTests.cs (4)
189Assert.Contains(content, c => c is FunctionCallContent or FunctionResultContent); 193Assert.All(content, c => Assert.False(c is FunctionCallContent or FunctionResultContent)); 238Assert.Contains(content, c => c is FunctionCallContent or FunctionResultContent); 242Assert.All(content, c => Assert.False(c is FunctionCallContent or FunctionResultContent));