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