betalgo / openai

.NET library for the OpenAI service API by Betalgo Ranul
https://ranultinga.com/
MIT License
2.9k stars 528 forks source link

Handling the Use of Two Resources Simultaneously in Azure OpenAI Dependency Injection #267

Closed qq312888991 closed 1 year ago

qq312888991 commented 1 year ago

For example, I have deployed GPT3.5 and Dall-e in Azure OpenAI, with deployment names "gpt35turbo" and "delleV2" respectively. The dependency injection code in my Program.cs file is as follows, but it only allows me to use one of the deployed resources. How can I use the "delleV2" deployment instead?

services.AddOpenAIService(settings =>
  {
      settings.ApiKey = builder.Configuration["OpenAPI:ApiKey"];
      settings.ProviderType = ProviderType.Azure;
      settings.ResourceName = builder.Configuration["OpenAPI:ResourceName"];
      settings.DeploymentId = “gpt35turbo”//How to coexist gpt35turbo and delleV2??
  });
Frogley commented 1 year ago

What you need is multi-instance dependency injection. I believe Tolga is working on this, you can check it here

kayhantolga commented 1 year ago

Yes @Frogley, I think multi-instance dependency injection will be ready this week.

qq312888991 commented 1 year ago

What you need is multi-instance dependency injection. I believe Tolga is working on this, you can check it here

Okay, I understand. Thank you

qq312888991 commented 1 year ago

Yes @Frogley, I think multi-instance dependency injection will be ready this week.

Okay, I understand. Thank you

kayhantolga commented 1 year ago

fixed in v7.0.0 https://github.com/betalgo/openai/pull/271