Skip to content

Commit

Permalink
resolve ambiguous namespace reference
Browse files Browse the repository at this point in the history
  • Loading branch information
jochenkirstaetter committed Mar 20, 2024
1 parent 1193948 commit 4ec58d7
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 10 deletions.
6 changes: 6 additions & 0 deletions src/Mscc.GenerativeAI.Google/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
### Fixed

## 0.8.1

### Fixed

- resolve ambiguous namespace reference

## 0.8.0

### Changed
Expand Down
16 changes: 8 additions & 8 deletions src/Mscc.GenerativeAI.Google/GenerativeModelGoogle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System.IO;
using System.Threading;
#endif
using Google.Apis.Auth.OAuth2;
using gauth = Google.Apis.Auth.OAuth2;
using Google.Apis.Util.Store;
using System.Security.Cryptography.X509Certificates;

Expand All @@ -30,7 +30,7 @@ public class GenerativeModelGoogle
private string _certificateFile = "key.p12";
private string _certificatePassphrase;

private ICredential _credential;
private gauth.ICredential _credential;
// private string ClientId;
// private string ClientSecret;

Expand All @@ -46,7 +46,7 @@ public class GenerativeModelGoogle
public GenerativeModelGoogle()
{
var clientSecrets = getClientSecrets();
_credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
_credential = gauth.GoogleWebAuthorizationBroker.AuthorizeAsync(
clientSecrets,
_scopes,
"user",
Expand All @@ -66,8 +66,8 @@ private GenerativeModelGoogle(string serviceAccountEmail, string certificate = n
certificate ?? _certificateFile,
passphrase ?? _certificatePassphrase,
X509KeyStorageFlags.Exportable);
_credential = new ServiceAccountCredential(
new ServiceAccountCredential.Initializer(serviceAccountEmail)
_credential = new gauth.ServiceAccountCredential(
new gauth.ServiceAccountCredential.Initializer(serviceAccountEmail)
{
Scopes = _scopes
}.FromCertificate(x509Certificate));
Expand Down Expand Up @@ -107,7 +107,7 @@ public GenerativeModel CreateModel(string model = Model.Gemini10Pro)
return generativeModel;
}

private ClientSecrets getClientSecrets()
private gauth.ClientSecrets getClientSecrets()
{
// _credentials = GoogleCredential.GetApplicationDefaultAsync();

Expand All @@ -116,7 +116,7 @@ private ClientSecrets getClientSecrets()
// _credentials = await GoogleCredential.FromFileAsync(_tokenFile);
// }
// if (!_credentials.)
ClientSecrets clientSecrets = null;
gauth.ClientSecrets clientSecrets = null;

// if (!string.IsNullOrEmpty(ClientId))
// {
Expand All @@ -128,7 +128,7 @@ private ClientSecrets getClientSecrets()
using (var stream = new FileStream(_clientFile, FileMode.Open, FileAccess.Read))
{
// clientSecrets = GoogleClientSecrets.Load(stream).Secrets;
clientSecrets = GoogleClientSecrets.FromStreamAsync(stream).Result.Secrets;
clientSecrets = gauth.GoogleClientSecrets.FromStreamAsync(stream).Result.Secrets;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@

<ItemGroup>
<PackageReference Include="Google.Apis.Auth" Version="1.67.0" />
<PackageReference Include="Mscc.GenerativeAI" Version="0.8.0" />
<PackageReference Include="Mscc.GenerativeAI" Version="0.8.*" />
</ItemGroup>

<ItemGroup>
Expand Down
6 changes: 6 additions & 0 deletions src/Mscc.GenerativeAI.Web/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
### Fixed

## 0.8.1

### Changed

- bump version

## 0.8.0

### Changed
Expand Down
2 changes: 1 addition & 1 deletion src/Mscc.GenerativeAI.Web/Mscc.GenerativeAI.Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="8.0.2" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="8.0.0" />
<PackageReference Include="Mscc.GenerativeAI" Version="0.8.0" />
<PackageReference Include="Mscc.GenerativeAI" Version="0.8.*" />
</ItemGroup>

<ItemGroup>
Expand Down
6 changes: 6 additions & 0 deletions src/Mscc.GenerativeAI/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
### Fixed

## 0.8.1

### Changed

- access modifier to avoid ambiguous type reference (ClientSecrets)

## 0.8.0

### Added
Expand Down

0 comments on commit 4ec58d7

Please sign in to comment.