38 references to new
Microsoft.Extensions.AI.Abstractions (5)
ChatCompletion\ChatFinishReason.cs (5)
69public static ChatFinishReason Stop { get; } = new("stop"); 72public static ChatFinishReason Length { get; } = new("length"); 75public static ChatFinishReason ToolCalls { get; } = new("tool_calls"); 78public static ChatFinishReason ContentFilter { get; } = new("content_filter"); 86new(reader.GetString()!);
Microsoft.Extensions.AI.Abstractions.Tests (30)
ChatCompletion\ChatFinishReasonTests.cs (30)
15Assert.Equal("abc", new ChatFinishReason("abc").Value); 21Assert.Throws<ArgumentNullException>("value", () => new ChatFinishReason(null!)); 22Assert.Throws<ArgumentException>("value", () => new ChatFinishReason(" ")); 28Assert.True(new ChatFinishReason("abc").Equals(new ChatFinishReason("ABC"))); 29Assert.True(new ChatFinishReason("abc").Equals((object)new ChatFinishReason("ABC"))); 30Assert.True(new ChatFinishReason("abc") == new ChatFinishReason("ABC")); 31Assert.Equal(new ChatFinishReason("abc").GetHashCode(), new ChatFinishReason("ABC").GetHashCode()); 32Assert.False(new ChatFinishReason("abc") != new ChatFinishReason("ABC")); 34Assert.False(new ChatFinishReason("abc").Equals(new ChatFinishReason("def"))); 35Assert.False(new ChatFinishReason("abc").Equals((object)new ChatFinishReason("def"))); 36Assert.False(new ChatFinishReason("abc").Equals(null)); 37Assert.False(new ChatFinishReason("abc").Equals("abc")); 38Assert.False(new ChatFinishReason("abc") == new ChatFinishReason("def")); 39Assert.True(new ChatFinishReason("abc") != new ChatFinishReason("def")); 40Assert.NotEqual(new ChatFinishReason("abc").GetHashCode(), new ChatFinishReason("def").GetHashCode()); // not guaranteed due to possible hash code collisions 55Assert.Equal("test", new ChatFinishReason("test").Value); 56Assert.Equal("test", new ChatFinishReason("test").ToString()); 58Assert.Equal("TEST", new ChatFinishReason("TEST").Value); 59Assert.Equal("TEST", new ChatFinishReason("TEST").ToString()); 68ChatFinishReason role = new("abc");
Microsoft.Extensions.AI.AzureAIInference (1)
AzureAIInferenceChatClient.cs (1)
285new(s);
Microsoft.Extensions.AI.Ollama (1)
OllamaChatClient.cs (1)
227_ => new ChatFinishReason(response.DoneReason),
Microsoft.Extensions.AI.OpenAI (1)
OpenAIChatClient.cs (1)
393_ => new ChatFinishReason(s),