dotnet / eShop

A reference .NET application implementing an eCommerce site
MIT License
6.33k stars 1.87k forks source link

How do I enable the AI Chat? #277

Closed markjbrown closed 6 months ago

markjbrown commented 7 months ago

I'm trying to enable AI chat in this thing and can't seem to make this work.

I've added an endpoint and key in the appsettings for the AppHost project where it asks for one. In the WebApp project it only has "ChatModel" commented out. So tried then adding the deployment model name for GPT 3.5 16K for the account I am referencing above. Not working either.

Not sure what to try next. This says to add an API key but there is no placeholder for this.

image

markjbrown commented 7 months ago

Anybody else figured out how to make this work?

markjbrown commented 7 months ago

Anybody else having this problem?

I'd really like to get this to work as I am using eShop to shoot a video on how to build a purchasing prediction feature using ALS that also includes doing filtering a vector search using this prediction data.

thanks.

jamesmontemagno commented 6 months ago

@stephentoub are we able to add documentation for this?

luisquintanilla commented 6 months ago

When using Azure OpenAI, inside eShop.AppHost/appsettings.json, add the following section.

  "ConnectionStrings": {
    "OpenAi": "Endpoint=xxx;Key=xxx;"
  }

Replace the values with your own.

Then, in the AppHost Program.cs, set this value to true

https://github.com/dotnet/eShop/blob/faeb3fae58d08800d0f49b04d71d18309965232c/src/eShop.AppHost/Program.cs#L73

Here's additional guidance on the Aspire OpenAI component.

https://learn.microsoft.com/dotnet/aspire/azureai/azureai-openai-component?tabs=dotnet-cli

markjbrown commented 6 months ago

Thank you! @luisquintanilla and @jamesmontemagno