44 references to new
Microsoft.Extensions.AI.Abstractions (5)
ChatCompletion\ChatRole.cs (5)
22
public static ChatRole System { get; } =
new
("system");
25
public static ChatRole Assistant { get; } =
new
("assistant");
28
public static ChatRole User { get; } =
new
("user");
31
public static ChatRole Tool { get; } =
new
("tool");
96
new
(reader.GetString()!);
Microsoft.Extensions.AI.Abstractions.Tests (30)
ChatCompletion\ChatResponseTests.cs (1)
130
ChatResponse response = new(new ChatMessage(new
ChatRole
("customRole"), "Text"))
ChatCompletion\ChatResponseUpdateExtensionsTests.cs (1)
55
Assert.Equal(new
ChatRole
("human"), message.Role);
ChatCompletion\ChatRoleTests.cs (28)
15
Assert.Equal("abc", new
ChatRole
("abc").Value);
21
Assert.Throws<ArgumentNullException>("value", () => new
ChatRole
(null!));
22
Assert.Throws<ArgumentException>("value", () => new
ChatRole
(" "));
28
Assert.True(new
ChatRole
("abc").Equals(new
ChatRole
("ABC")));
29
Assert.True(new
ChatRole
("abc").Equals((object)new
ChatRole
("ABC")));
30
Assert.True(new
ChatRole
("abc") == new
ChatRole
("ABC"));
31
Assert.False(new
ChatRole
("abc") != new
ChatRole
("ABC"));
33
Assert.False(new
ChatRole
("abc").Equals(new
ChatRole
("def")));
34
Assert.False(new
ChatRole
("abc").Equals((object)new
ChatRole
("def")));
35
Assert.False(new
ChatRole
("abc").Equals(null));
36
Assert.False(new
ChatRole
("abc").Equals("abc"));
37
Assert.False(new
ChatRole
("abc") == new
ChatRole
("def"));
38
Assert.True(new
ChatRole
("abc") != new
ChatRole
("def"));
40
Assert.Equal(new
ChatRole
("abc").GetHashCode(), new
ChatRole
("abc").GetHashCode());
41
Assert.Equal(new
ChatRole
("abc").GetHashCode(), new
ChatRole
("ABC").GetHashCode());
42
Assert.NotEqual(new
ChatRole
("abc").GetHashCode(), new
ChatRole
("def").GetHashCode()); // not guaranteed
57
ChatRole role =
new
("abc");
Microsoft.Extensions.AI.AzureAIInference (2)
AzureAIInferenceChatClient.cs (2)
37
private static ChatRole ChatRoleDeveloper { get; } =
new
("developer");
272
new
ChatRole
(role.ToString());
Microsoft.Extensions.AI.Ollama (1)
OllamaChatClient.cs (1)
274
return new ChatMessage(
new
(message.Role), contents);
Microsoft.Extensions.AI.OpenAI (2)
OpenAIModelMapper.ChatCompletion.cs (1)
542
_ => new
ChatRole
(role.ToString()),
OpenAIModelMapper.ChatMessage.cs (1)
17
public static ChatRole ChatRoleDeveloper { get; } = new
ChatRole
("developer");
Microsoft.Extensions.AI.Tests (4)
ChatCompletion\DistributedCachingChatClientTest.cs (4)
43
new ChatMessage(new
ChatRole
("fakeRole"), "This is some content")
221
Role = new
ChatRole
("fakeRole2"),
234
Role = new
ChatRole
("fakeRole2"),
607
new ChatMessage(new
ChatRole
("fakeRole"),