34 references to Tool
Microsoft.Extensions.AI (2)
ChatCompletion\FunctionInvokingChatClient.cs (1)
601ChatMessage message = new(ChatRole.Tool, contents);
ChatCompletion\OpenTelemetryChatClient.cs (1)
449else if (message.Role == ChatRole.Tool)
Microsoft.Extensions.AI.Abstractions.Tests (2)
ChatCompletion\ChatRoleTests.cs (1)
50Assert.Equal("tool", ChatRole.Tool.Value);
ChatCompletion\StreamingChatCompletionUpdateExtensionsTests.cs (1)
48new() { ChoiceIndex = 1, Text = "you!", Role = ChatRole.Tool, CreatedAt = new DateTimeOffset(3, 2, 3, 4, 5, 6, TimeSpan.Zero), AdditionalProperties = new() { ["e"] = "f", ["i"] = 42 } },
Microsoft.Extensions.AI.AzureAIInference (2)
AzureAIInferenceChatClient.cs (2)
277role.Equals(global::Azure.AI.Inference.ChatRole.Tool) ? ChatRole.Tool : 421else if (input.Role == ChatRole.Tool)
Microsoft.Extensions.AI.AzureAIInference.Tests (1)
AzureAIInferenceChatClientTests.cs (1)
511new(ChatRole.Tool, [new FunctionResultContent("abcd123", "GetMood", "happy")]),
Microsoft.Extensions.AI.Ollama.Tests (1)
OllamaChatClientTests.cs (1)
461new(ChatRole.Tool, [new FunctionResultContent("abcd1234", "GetPersonAge", 42)]),
Microsoft.Extensions.AI.OpenAI (4)
OpenAIModelMapper.ChatCompletion.cs (2)
506ChatMessageRole.Tool => ChatRole.Tool, 517role == ChatRole.Tool ? ChatMessageRole.Tool : ChatMessageRole.User;
OpenAIModelMapper.ChatMessage.cs (2)
79Role = ChatRole.Tool, 132else if (input.Role == ChatRole.Tool)
Microsoft.Extensions.AI.OpenAI.Tests (2)
OpenAIChatClientTests.cs (1)
995new (ChatRole.Tool,
OpenAISerializationTests.cs (1)
419Assert.Equal(ChatRole.Tool, msg.Role);
Microsoft.Extensions.AI.Tests (20)
ChatCompletion\FunctionInvokingChatClientTests.cs (19)
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.")]), 95new ChatMessage(ChatRole.Tool, 106new ChatMessage(ChatRole.Tool, 146new ChatMessage(ChatRole.Tool, 189new ChatMessage(ChatRole.Tool, 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)
113new(ChatRole.Tool, [new FunctionResultContent("12345", "GetPersonName", "John")]),