34 references to new
Microsoft.Extensions.AI.Abstractions (2)
ChatCompletion\ChatResponseFormat.cs (2)
28
public static ChatResponseFormatJson Json { get; } =
new
(schema: null);
37
new
(Throw.IfNull(schema),
Microsoft.Extensions.AI.Abstractions.Tests (32)
ChatCompletion\ChatResponseFormatTests.cs (32)
22
Assert.Throws<ArgumentException>("schemaName", () => new
ChatResponseFormatJson
(null, "name"));
23
Assert.Throws<ArgumentException>("schemaDescription", () => new
ChatResponseFormatJson
(null, null, "description"));
24
Assert.Throws<ArgumentException>("schemaName", () => new
ChatResponseFormatJson
(null, "name", "description"));
30
ChatResponseFormatJson f =
new
(null);
39
ChatResponseFormatJson f =
new
("{}", "name", "description");
52
Assert.False(ChatResponseFormat.Text.Equals(new
ChatResponseFormatJson
(null)));
53
Assert.False(ChatResponseFormat.Text.Equals(new
ChatResponseFormatJson
("{}")));
58
Assert.False(ChatResponseFormat.Json.Equals(new
ChatResponseFormatJson
("{}")));
60
Assert.True(ChatResponseFormat.Json.Equals(new
ChatResponseFormatJson
(null)));
61
Assert.Equal(ChatResponseFormat.Json.GetHashCode(), new
ChatResponseFormatJson
(null).GetHashCode());
63
Assert.True(new
ChatResponseFormatJson
("{}").Equals(new
ChatResponseFormatJson
("{}")));
64
Assert.Equal(new
ChatResponseFormatJson
("{}").GetHashCode(), new
ChatResponseFormatJson
("{}").GetHashCode());
66
Assert.False(new
ChatResponseFormatJson
("""{ "prop": 42 }""").Equals(new
ChatResponseFormatJson
("""{ "prop": 43 }""")));
67
Assert.NotEqual(new
ChatResponseFormatJson
("""{ "prop": 42 }""").GetHashCode(), new
ChatResponseFormatJson
("""{ "prop": 43 }""").GetHashCode()); // technically not guaranteed
69
Assert.False(new
ChatResponseFormatJson
("""{ "prop": 42 }""").Equals(new
ChatResponseFormatJson
("""{ "PROP": 42 }""")));
70
Assert.NotEqual(new
ChatResponseFormatJson
("""{ "prop": 42 }""").GetHashCode(), new
ChatResponseFormatJson
("""{ "PROP": 42 }""").GetHashCode()); // technically not guaranteed
72
Assert.True(new
ChatResponseFormatJson
("{}", "name", "description").Equals(new
ChatResponseFormatJson
("{}", "name", "description")));
73
Assert.False(new
ChatResponseFormatJson
("{}", "name", "description").Equals(new
ChatResponseFormatJson
("{}", "name", "description2")));
74
Assert.False(new
ChatResponseFormatJson
("{}", "name", "description").Equals(new
ChatResponseFormatJson
("{}", "name2", "description")));
75
Assert.False(new
ChatResponseFormatJson
("{}", "name", "description").Equals(new
ChatResponseFormatJson
("{}", "name2", "description2")));
77
Assert.Equal(new
ChatResponseFormatJson
("{}", "name", "description").GetHashCode(), new
ChatResponseFormatJson
("{}", "name", "description").GetHashCode());