2 types derived from ChatToolMode
Microsoft.Extensions.AI.Abstractions (2)
ChatCompletion\AutoChatToolMode.cs (1)
15public sealed class AutoChatToolMode : ChatToolMode
ChatCompletion\RequiredChatToolMode.cs (1)
15public sealed class RequiredChatToolMode : ChatToolMode
54 references to ChatToolMode
Microsoft.Extensions.AI (2)
ChatCompletion\FunctionInvokingChatClient.cs (2)
274options.ToolMode = ChatToolMode.Auto; 380options.ToolMode = ChatToolMode.Auto;
Microsoft.Extensions.AI.Abstractions (9)
ChatCompletion\AutoChatToolMode.cs (2)
12/// Use <see cref="ChatToolMode.Auto"/> to get an instance of <see cref="AutoChatToolMode"/>. 18/// <remarks>Use <see cref="ChatToolMode.Auto"/> to get an instance of <see cref="AutoChatToolMode"/>.</remarks>
ChatCompletion\ChatOptions.cs (2)
54public ChatToolMode ToolMode { get; set; } = ChatToolMode.Auto;
ChatCompletion\ChatToolMode.cs (4)
22/// <summary>Initializes a new instance of the <see cref="ChatToolMode"/> class.</summary> 29/// Gets a predefined <see cref="ChatToolMode"/> indicating that tool usage is optional. 38/// Gets a predefined <see cref="ChatToolMode"/> indicating that tool usage is required, 44/// Instantiates a <see cref="ChatToolMode"/> indicating that tool usage is required,
ChatCompletion\RequiredChatToolMode.cs (1)
31/// <see cref="ChatToolMode.RequireAny"/> when any function can be selected.
Microsoft.Extensions.AI.Abstractions.Tests (41)
ChatCompletion\ChatOptionsTests.cs (7)
26Assert.Same(ChatToolMode.Auto, options.ToolMode); 41Assert.Same(ChatToolMode.Auto, clone.ToolMode); 78options.ToolMode = ChatToolMode.RequireAny; 92Assert.Same(ChatToolMode.RequireAny, options.ToolMode); 107Assert.Same(ChatToolMode.RequireAny, clone.ToolMode); 138options.ToolMode = ChatToolMode.RequireAny; 163Assert.Equal(ChatToolMode.RequireAny, deserialized.ToolMode);
ChatCompletion\ChatToolModeTests.cs (34)
14Assert.Same(ChatToolMode.Auto, ChatToolMode.Auto); 15Assert.Same(ChatToolMode.RequireAny, ChatToolMode.RequireAny); 21Assert.True(ChatToolMode.Auto == ChatToolMode.Auto); 22Assert.True(ChatToolMode.Auto.Equals(ChatToolMode.Auto)); 23Assert.False(ChatToolMode.Auto.Equals(ChatToolMode.RequireAny)); 24Assert.False(ChatToolMode.Auto.Equals(new RequiredChatToolMode(null))); 25Assert.False(ChatToolMode.Auto.Equals(new RequiredChatToolMode("func"))); 26Assert.Equal(ChatToolMode.Auto.GetHashCode(), ChatToolMode.Auto.GetHashCode()); 28Assert.True(ChatToolMode.RequireAny == ChatToolMode.RequireAny); 29Assert.True(ChatToolMode.RequireAny.Equals(ChatToolMode.RequireAny)); 30Assert.False(ChatToolMode.RequireAny.Equals(ChatToolMode.Auto)); 31Assert.False(ChatToolMode.RequireAny.Equals(new RequiredChatToolMode("func"))); 33Assert.True(ChatToolMode.RequireAny.Equals(new RequiredChatToolMode(null))); 34Assert.Equal(ChatToolMode.RequireAny.GetHashCode(), new RequiredChatToolMode(null).GetHashCode()); 35Assert.Equal(ChatToolMode.RequireAny.GetHashCode(), ChatToolMode.RequireAny.GetHashCode()); 50string json = JsonSerializer.Serialize(ChatToolMode.Auto, TestJsonSerializerContext.Default.ChatToolMode); 53ChatToolMode? result = JsonSerializer.Deserialize(json, TestJsonSerializerContext.Default.ChatToolMode); 54Assert.Equal(ChatToolMode.Auto, result); 60string json = JsonSerializer.Serialize(ChatToolMode.RequireAny, TestJsonSerializerContext.Default.ChatToolMode); 63ChatToolMode? result = JsonSerializer.Deserialize(json, TestJsonSerializerContext.Default.ChatToolMode); 64Assert.Equal(ChatToolMode.RequireAny, result); 70string json = JsonSerializer.Serialize(ChatToolMode.RequireSpecific("myFunc"), TestJsonSerializerContext.Default.ChatToolMode); 73ChatToolMode? result = JsonSerializer.Deserialize(json, TestJsonSerializerContext.Default.ChatToolMode); 74Assert.Equal(ChatToolMode.RequireSpecific("myFunc"), result);
Microsoft.Extensions.AI.Integration.Tests (2)
ChatClientIntegrationTests.cs (2)
275ToolMode = ChatToolMode.RequireAny, 297ToolMode = ChatToolMode.RequireSpecific(shieldsUpTool.Metadata.Name),