Skip to content

exception when trying to use Vertex Express mode with platform adapter #60

@clarity99

Description

@clarity99

I'm trying to use IChatClient with Vertex AI Express mode.
I thought this would work:

var adapter = new VertextPlatformAdapter(expressMode: true, apiKey: key);

client = (IChatClient)new GenerativeAIChatClient(adapter,
                    selectedModel);

however, this throws an exception - No configuration found for Vertex AI.

Looking at the sourcecode, it tries to load credentials from the file if projectId is null.

Am I doing something wrong? Looking at example for express mode without IChatClient, I thought it should work:
var vertexAIClient = new VertexAI(apiKey: apiKey, expressMode: true);

However, even if I just run this example, (with VertexAI constructor) I get the same exception, as it seems to call the platformadapter anyway:

robRezCore.Components.Pages.NotesAI: Error: Error while calling AI. ex:System.Exception: No configuration found for Vertex AI.
   at VertextPlatformAdapter..ctor(String projectId, String region, Boolean expressMode, String apiKey, String accessToken, String apiVersion, IGoogleAuthenticator authenticator, String credentialsFile, Boolean validateAccessToken, ILogger logger) in /_/src/GenerativeAI/Platforms/VertextPlatformAdapter.cs:line 137
   at GenerativeAI.VertexAI..ctor(String projectId, String region, String accessToken, Boolean expressMode, String apiKey, String apiVersion, HttpClient httpClient, IGoogleAuthenticator authenticator, ILogger logger) in /_/src/GenerativeAI/Platforms/VertexAI.cs:line 46

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions