Skip to content

Commit b7bb5b9

Browse files
committed
Some cleanup
1 parent 7b01ed9 commit b7bb5b9

File tree

8 files changed

+10
-17
lines changed

8 files changed

+10
-17
lines changed

eng/MSBuild/Shared.props

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,4 @@
4646
<ItemGroup Condition="'$(InjectStringSplitExtensions)' == 'true'">
4747
<Compile Include="$(MSBuildThisFileDirectory)\..\..\src\Shared\StringSplit\*.cs" LinkBase="Shared\StringSplit" />
4848
</ItemGroup>
49-
50-
<ItemGroup Condition="'$(InjectSharedAIExtensions)' == 'true'">
51-
<Compile Include="$(MSBuildThisFileDirectory)\..\..\src\Shared\AIExtensions\*.cs" LinkBase="Shared\AIExtensions" />
52-
</ItemGroup>
5349
</Project>

src/Libraries/Microsoft.Extensions.AI.AzureAIInference/Microsoft.Extensions.AI.AzureAIInference.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
<InjectSharedDiagnosticIds>true</InjectSharedDiagnosticIds>
2626
<InjectSharedEmptyCollections>true</InjectSharedEmptyCollections>
2727
<InjectStringHashOnLegacy>true</InjectStringHashOnLegacy>
28-
<InjectSharedAIExtensions>true</InjectSharedAIExtensions>
2928
</PropertyGroup>
3029

3130
<ItemGroup>

src/Libraries/Microsoft.Extensions.AI.Ollama/Microsoft.Extensions.AI.Ollama.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
<InjectSharedDiagnosticIds>true</InjectSharedDiagnosticIds>
2727
<InjectSharedEmptyCollections>true</InjectSharedEmptyCollections>
2828
<InjectStringHashOnLegacy>true</InjectStringHashOnLegacy>
29-
<InjectSharedAIExtensions>true</InjectSharedAIExtensions>
3029
</PropertyGroup>
3130

3231
<ItemGroup>

src/Libraries/Microsoft.Extensions.AI.OpenAI/Microsoft.Extensions.AI.OpenAI.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
<InjectSharedServerSentEvents>true</InjectSharedServerSentEvents>
2828
<InjectRequiredMemberOnLegacy>true</InjectRequiredMemberOnLegacy>
2929
<InjectCompilerFeatureRequiredOnLegacy>true</InjectCompilerFeatureRequiredOnLegacy>
30-
<InjectSharedAIExtensions>true</InjectSharedAIExtensions>
3130
</PropertyGroup>
3231

3332
<ItemGroup>

src/Libraries/Microsoft.Extensions.AI.OpenAI/OpenAIModelMapper.ChatMessage.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,9 @@ private static List<ChatMessageContentPart> ToOpenAIChatContent(IList<AIContent>
220220
break;
221221

222222
case DataContent dataContent when dataContent.HasMediaTypePrefix("image/"):
223-
if (dataContent.Data is { IsEmpty: false } data)
223+
if (dataContent.ContainsData)
224224
{
225-
parts.Add(ChatMessageContentPart.CreateImagePart(BinaryData.FromBytes(data), dataContent.MediaType));
225+
parts.Add(ChatMessageContentPart.CreateImagePart(BinaryData.FromBytes(dataContent.Data!.Value), dataContent.MediaType));
226226
}
227227
else if (dataContent.Uri is string uri)
228228
{

test/Libraries/Microsoft.Extensions.AI.Abstractions.Tests/ChatCompletion/ChatMessageTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@ public void Text_GetSet_UsesFirstTextContent()
124124
{
125125
ChatMessage message = new(ChatRole.User,
126126
[
127-
new DataContent("http://localhost/audio", mediaType: "audio/mpeg"),
128-
new DataContent("http://localhost/image", mediaType: "image/png"),
127+
new DataContent("http://localhost/audio"),
128+
new DataContent("http://localhost/image"),
129129
new FunctionCallContent("callId1", "fc1"),
130130
new TextContent("text-1"),
131131
new TextContent("text-2"),
@@ -163,8 +163,8 @@ public void Text_Set_AddsTextMessageToListWithNoText()
163163
{
164164
ChatMessage message = new(ChatRole.User,
165165
[
166-
new DataContent("http://localhost/audio", mediaType: "audio/mpeg"),
167-
new DataContent("http://localhost/image", mediaType: "image/png"),
166+
new DataContent("http://localhost/audio"),
167+
new DataContent("http://localhost/image"),
168168
new FunctionCallContent("callId1", "fc1"),
169169
]);
170170
Assert.Equal(3, message.Contents.Count);

test/Libraries/Microsoft.Extensions.AI.Abstractions.Tests/ChatCompletion/StreamingChatCompletionUpdateTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,8 @@ public void Text_Set_AddsTextMessageToListWithNoText()
136136
{
137137
Contents =
138138
[
139-
new DataContent("http://localhost/audio", "audio/mpeg"),
140-
new DataContent("http://localhost/image", "image/png"),
139+
new DataContent("http://localhost/audio"),
140+
new DataContent("http://localhost/image"),
141141
new FunctionCallContent("callId1", "fc1"),
142142
]
143143
};
@@ -169,7 +169,7 @@ public void JsonSerialization_Roundtrips()
169169
Contents =
170170
[
171171
new TextContent("text-1"),
172-
new DataContent("http://localhost/image", "image/png"),
172+
new DataContent("http://localhost/image"),
173173
new FunctionCallContent("callId1", "fc1"),
174174
new DataContent("data"u8.ToArray()),
175175
new TextContent("text-2"),

test/Libraries/Microsoft.Extensions.AI.Tests/ChatCompletion/ChatClientStructuredOutputExtensionsTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ public async Task FailureUsage_NullJson()
148148
[Fact]
149149
public async Task FailureUsage_NoJsonInResponse()
150150
{
151-
var expectedCompletion = new ChatCompletion([new ChatMessage(ChatRole.Assistant, [new DataContent("https://example.com", "image/png")])]);
151+
var expectedCompletion = new ChatCompletion([new ChatMessage(ChatRole.Assistant, [new DataContent("https://example.com")])]);
152152
using var client = new TestChatClient
153153
{
154154
CompleteAsyncCallback = (messages, options, cancellationToken) => Task.FromResult(expectedCompletion),

0 commit comments

Comments
 (0)