Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Introduce Microsoft.Extensions.AI to AIPlatform #13814

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<Project>
<ItemGroup>
<PackageVersion Include="Microsoft.Extensions.AI" Version="9.0.0-preview.9.24556.5" />
<PackageVersion Include="xunit" Version="2.9.2" />
<PackageVersion Include="xunit.assert" Version="2.9.2" />
<PackageVersion Include="xunit.core" Version="2.9.2" />
Expand Down Expand Up @@ -29,4 +30,4 @@
<PackageVersion Include="log4net" Version="2.0.17" />
<PackageVersion Include="NLog" Version="5.3.4" />
</ItemGroup>
</Project>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Version>1.0.0-beta09</Version>
<TargetFrameworks>netstandard2.0;net462</TargetFrameworks>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<Description>Implementation of Microsoft.Extensions.AI for Google client library to access the AI Platform API (v1beta).</Description>
<PackageTags>ai;ml;Google;Cloud</PackageTags>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.AI" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Google.Cloud.AIPlatform.V1Beta1\Google.Cloud.AIPlatform.V1Beta1.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#region HEADER
// Copyright 2024 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License"):
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#endregion

using Microsoft.Extensions.AI;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;

namespace Google.Cloud.AIPlatform.V1Beta1;

internal sealed class GoogleChatClient : IChatClient
{
private readonly PredictionServiceClient _predictionServiceClient;

public ChatClientMetadata Metadata { get; }

internal GoogleChatClient(PredictionServiceClient predictionServiceClient)
{
this._predictionServiceClient = predictionServiceClient;
}

public Task<ChatCompletion> CompleteAsync(
IList<ChatMessage> chatMessages,
ChatOptions options = null,
CancellationToken cancellationToken = default)
{
throw new System.NotImplementedException();
}

public IAsyncEnumerable<StreamingChatCompletionUpdate> CompleteStreamingAsync(
IList<ChatMessage> chatMessages,
ChatOptions options = null,
CancellationToken cancellationToken = default)
{
throw new System.NotImplementedException();
}

public TService GetService<TService>(object key = null) where TService : class
{
throw new System.NotImplementedException();
}

public void Dispose()
{
// TODO release managed resources here
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Google.Cloud.ClientTesting"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Google.Cloud.AIPlatform.V1Beta1.Snippets", "Google.Cloud.AIPlatform.V1Beta1.Snippets\Google.Cloud.AIPlatform.V1Beta1.Snippets.csproj", "{CD82E817-EA05-431B-84EE-A34AC5D67C38}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Google.Cloud.AIPlatform.V1Beta1.Extensions", "Google.Cloud.AIPlatform.V1Beta1.Extensions\Google.Cloud.AIPlatform.V1Beta1.Extensions.csproj", "{43D10BF9-255C-4E17-B683-BA2C501CF397}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -36,5 +38,9 @@ Global
{CD82E817-EA05-431B-84EE-A34AC5D67C38}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CD82E817-EA05-431B-84EE-A34AC5D67C38}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CD82E817-EA05-431B-84EE-A34AC5D67C38}.Release|Any CPU.Build.0 = Release|Any CPU
{43D10BF9-255C-4E17-B683-BA2C501CF397}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{43D10BF9-255C-4E17-B683-BA2C501CF397}.Debug|Any CPU.Build.0 = Debug|Any CPU
{43D10BF9-255C-4E17-B683-BA2C501CF397}.Release|Any CPU.ActiveCfg = Release|Any CPU
{43D10BF9-255C-4E17-B683-BA2C501CF397}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal