Is it possible to add multiple ChatCompletion (AzureOpenID and VertexAIGemini) in one website? #7522
-
Hi Everyone, I have a requirement where I have to add two services (AzureOpenAI and VertexAIGemini) and call the specific service based on module selection. In my code, when I tried to get required service instance I am getting casting error. It only return the last service which was added. Code:string geminiModelId = "gemini-1.5-pro"; #pragma warning disable SKEXP0070 builder.Services.AddAzureOpenAIChatCompletion("gpt-4o", "https://gpt-04o.openai.azure.com/", Constants.GPT4Key); var app = builder.Build(); Kernel kernel = app.Services.GetRequiredService(); VertexAIGeminiChatCompletionService chat = (VertexAIGeminiChatCompletionService)app.Services.GetRequiredService(); Exception:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
We'd recommend you can specify the service ID and retrieve the service. |
Beta Was this translation helpful? Give feedback.
We'd recommend you can specify the service ID and retrieve the service.