Giter Club home page Giter Club logo

chat-copilot's Introduction

NOTE: This is a sample application to help you understand how Semantic Kernel and AI can work in Web Applications. This sample is NOT FOR PRODUCTION deployments.

Chat Copilot Sample Application

This sample allows you to build your own integrated large language model (LLM) chat copilot. The sample is built on Microsoft Semantic Kernel and has three components:

  1. A frontend application React web app
  2. A backend REST API .NET web API service
  3. A .NET worker service for processing semantic memory.

These quick-start instructions run the sample locally. They can also be found on the official Chat Copilot Microsoft Learn documentation page for getting started.

To deploy the sample to Azure, please view Deploying Chat Copilot after meeting the requirements described below.

IMPORTANT: This sample is for educational purposes only and is not recommended for production deployments.

IMPORTANT: Each chat interaction will call Azure OpenAI/OpenAI which will use tokens that you may be billed for.

Chat Copilot answering a question

Requirements

You will need the following items to run the sample:

  • .NET 7.0 SDK (via Setup install.* script)
  • Node.js (via Setup install.* script)
  • Yarn (via Setup install.* script)
  • Git
  • AI Service (one of the following is required)
AI Service Requirement
Azure OpenAI - Access
- Resource
- Deployed models (gpt-35-turbo and text-embedding-ada-002)
- Endpoint
- API key
OpenAI - Account
- API key

Instructions

Windows

  1. Open PowerShell as an administrator.

    NOTE: Ensure that you have PowerShell Core 6+ installed. This is different from the default PowerShell installed on Windows.

  2. Clone this repository

    git clone https://github.com/microsoft/chat-copilot
  3. Setup your environment.

    The following is a script to help you install the dependencies required. Feel free to install dotnet, nodejs, and yarn with your method of choice or use this script.

    cd <path to chat-copilot>\scripts\
    .\Install.ps1

    NOTE: This script will install Chocolatey, dotnet-7.0-sdk, nodejs, and yarn.

    NOTE: If you receive an error that the script is not digitally signed or cannot execute on the system, you may need to change the execution policy (see list of policies and scopes) or unblock the script.

  4. Configure Chat Copilot.

    .\Configure.ps1 -AIService {AI_SERVICE} -APIKey {API_KEY} -Endpoint {AZURE_OPENAI_ENDPOINT}
    • AI_SERVICE: AzureOpenAI or OpenAI.

    • API_KEY: The API key for Azure OpenAI or for OpenAI.

    • AZURE_OPENAI_ENDPOINT: The Azure OpenAI resource Endpoint address. This is only required when using Azure OpenAI, omit -Endpoint if using OpenAI.

    • IMPORTANT: For AzureOpenAI, if you deployed models gpt-35-turbo and text-embedding-ada-002 with custom names (instead of the default names), also use the parameters:

      -CompletionModel {DEPLOYMENT_NAME} -EmbeddingModel {DEPLOYMENT_NAME}

      Open the .\Configure.ps1 script to see all of the available parameters.

  5. Run Chat Copilot locally. This step starts both the backend API and frontend application.

    .\Start.ps1

    It may take a few minutes for Yarn packages to install on the first run.

    NOTE: Confirm pop-ups are not blocked and you are logged in with the same account used to register the application.

    • (Optional) To start ONLY the backend:

      .\Start-Backend.ps1

Linux/macOS

  1. Open Bash as an Administrator.

  2. Clone this repository

    git clone https://github.com/microsoft/chat-copilot
  3. Configure environment.

    The following is a script to help you install the dependencies required. Feel free to install dotnet, nodejs, and yarn with your method of choice or use this script.

    cd <path to chat-copilot>/scripts/

    Ubuntu/Debian Linux

    ./install-apt.sh

    NOTE: This script uses apt to install dotnet-sdk-7.0, nodejs, and yarn.

    macOS

    ./install-brew.sh

    NOTE: This script uses homebrew to install dotnet-sdk, nodejs, and yarn.

  4. Configure Chat Copilot.

    1. For OpenAI

      ./configure.sh --aiservice OpenAI --apikey {API_KEY}
      • API_KEY: The API key for OpenAI.
    2. For Azure OpenAI

      ./configure.sh --aiservice AzureOpenAI \
                     --endpoint {AZURE_OPENAI_ENDPOINT} \
                     --apikey   {API_KEY}
      • AZURE_OPENAI_ENDPOINT: The Azure OpenAI resource Endpoint address.
      • API_KEY: The API key for Azure OpenAI.

      IMPORTANT: If you deployed models gpt-35-turbo and text-embedding-ada-002 with custom names (instead of the default names), you need to specify the deployment names with three additional parameters:

      ./configure.sh --aiservice AzureOpenAI \
                     --endpoint        {AZURE_OPENAI_ENDPOINT} \
                     --apikey          {API_KEY} \
                     --completionmodel {DEPLOYMENT_NAME} \
                     --embeddingmodel  {DEPLOYMENT_NAME}
  5. Run Chat Copilot locally. This step starts both the backend API and frontend application.

    ./start.sh

    It may take a few minutes for Yarn packages to install on the first run.

    NOTE: Confirm pop-ups are not blocked and you are logged in with the same account used to register the application.

    • (Optional) To start ONLY the backend:

      ./start-backend.sh

(Optional) Run the memory pipeline

By default, the webapi is configured to work without the memory pipeline for synchronous processing documents. To enable asynchronous document processing, you need to configure the webapi and the memory pipeline. Please refer to the webapi README and the memory pipeline README for more information.

(Optional) Enable backend authentication via Azure AD

By default, Chat Copilot runs locally without authentication, using a guest user profile. If you want to enable authentication with Azure Active Directory, follow the steps below.

Requirements

Instructions

  1. Create an application registration for the frontend web app, using the values below

    • Supported account types: "Accounts in this organizational directory only ({YOUR TENANT} only - Single tenant)"
    • Redirect URI (optional): Single-page application (SPA) and use http://localhost:3000.
  2. Create a second application registration for the backend web api, using the values below:

    • Supported account types: "Accounts in this organizational directory only ({YOUR TENANT} only - Single tenant)"
    • Do not configure a Redirect URI (optional)

NOTE: Other account types can be used to allow multitenant and personal Microsoft accounts to use your application if you desire. Doing so may result in more users and therefore higher costs.

Take note of the Application (client) ID for both app registrations as you will need them in future steps.

  1. Expose an API within the second app registration

    1. Select Expose an API from the menu

    2. Add an Application ID URI

      1. This will generate an api:// URI

      2. Click Save to store the generated URI

    3. Add a scope for access_as_user

      1. Click Add scope

      2. Set Scope name to access_as_user

      3. Set Who can consent to Admins and users

      4. Set Admin consent display name and User consent display name to Access copilot chat as a user

      5. Set Admin consent description and User consent description to Allows the accesses to the Copilot chat web API as a user

    4. Add the web app frontend as an authorized client application

      1. Click Add a client application

      2. For Client ID, enter the frontend's application (client) ID

      3. Check the checkbox under Authorized scopes

      4. Click Add application

  2. Add permissions to web app frontend to access web api as user

    1. Open app registration for web app frontend

    2. Go to API Permissions

    3. Click Add a permission

    4. Select the tab APIs my organization uses

    5. Choose the app registration representing the web api backend

    6. Select permissions access_as_user

    7. Click Add permissions

  3. Run the Configure script with additional parameters to set up authentication.

    Powershell

    .\Configure.ps1 -AiService {AI_SERVICE} -APIKey {API_KEY} -Endpoint {AZURE_OPENAI_ENDPOINT} -FrontendClientId {FRONTEND_APPLICATION_ID} -BackendClientId {BACKEND_APPLICATION_ID} -TenantId {TENANT_ID} -Instance {AZURE_AD_INSTANCE}

    Bash

    ./configure.sh --aiservice {AI_SERVICE} --apikey {API_KEY} --endpoint {AZURE_OPENAI_ENDPOINT} --frontend-clientid {FRONTEND_APPLICATION_ID} --backend-clientid {BACKEND_APPLICATION_ID} --tenantid {TENANT_ID} --instance {AZURE_AD_INSTANCE}
    • AI_SERVICE: AzureOpenAI or OpenAI.
    • API_KEY: The API key for Azure OpenAI or for OpenAI.
    • AZURE_OPENAI_ENDPOINT: The Azure OpenAI resource Endpoint address. This is only required when using Azure OpenAI, omit -Endpoint if using OpenAI.
    • FRONTEND_APPLICATION_ID: The Application (client) ID associated with the application registration for the frontend.
    • BACKEND_APPLICATION_ID: The Application (client) ID associated with the application registration for the backend.
    • TENANT_ID : Your Azure AD tenant ID
    • AZURE_AD_INSTANCE (optional): The Azure AD cloud instance for the authenticating users. Defaults to https://login.microsoftonline.com.
  4. Run Chat Copilot locally. This step starts both the backend API and frontend application.

    Powershell

    .\Start.ps1

    Bash

    ./start.sh

Troubleshooting

  1. Issue: Unable to load chats.

    Details: interactionin_progress: Interaction is currently in progress.

    Explanation: The WebApp can display this error when the application is configured for a different AAD tenant from the browser, (e.g., personal/MSA account vs work/school account).

    Solution: Either use a private/incognito browser tab or clear your browser credentials/cookies. Confirm you are logged in with the same account used to register the application.

  2. Issue:: Challenges using text completion models, such as text-davinci-003

    Solution: For OpenAI, see model endpoint compatibility for the complete list of current models supporting chat completions. For Azure OpenAI, see model summary table and region availability.

  3. Issue: Localhost SSL certificate errors / CORS errors

    Cert-Issue

    Explanation: Your browser may be blocking the frontend access to the backend while waiting for your permission to connect.

    Solution:

    1. Confirm the backend service is running. Open a web browser and navigate to https://localhost:40443/healthz
      • You should see a confirmation message: Healthy
      • If your browser asks you to acknowledge the risks of visiting an insecure website, you must acknowledge this before the frontend can connect to the backend server.
    2. Navigate to http://localhost:3000 or refresh the page to use the Chat Copilot application.
  4. Issue: Yarn is not working.

    Explanation: You may have the wrong Yarn version installed such as v2.x+.

    Solution: Use the classic version.

    npm install -g yarn
    yarn set version classic
  5. Issue: Missing /usr/share/dotnet/host/fxr folder.

    Details: "A fatal error occurred. The folder [/usr/share/dotnet/host/fxr] does not exist" when running dotnet commands on Linux.

    Explanation: When .NET (Core) was first released for Linux, it was not yet available in the official Ubuntu repo. So instead, many of us added the Microsoft APT repo in order to install it. Now, the packages are part of the Ubuntu repo, and they are conflicting with the Microsoft packages. This error is a result of mixed packages. (Source: StackOverflow)

    Solution:

    # Remove all existing packages to get to a clean state:
    sudo apt remove --assume-yes dotnet*;
    sudo apt remove --assume-yes aspnetcore*;
    sudo apt remove --assume-yes netstandard*;
    
    # Set the Microsoft package provider priority
    echo -e "Package: *\nPin: origin \"packages.microsoft.com\"\nPin-Priority: 1001" | sudo tee /etc/apt/preferences.d/99microsoft-dotnet.pref;
    
    # Update and install dotnet
    sudo apt update;
    sudo apt install --assume-yes dotnet-sdk-7.0;

A note on branches

Every release is associated with a release branch. For instance, release v0.9 is on a branch called 0.9. Once a release is out, its branch will no longer be updated. The exception to this is the latest release branch, which will only receive bug fixes. This is to provide some stability to those for whom breaking changes and being on the bleeding edge (with the bugs it can entail) is not a desirable option.

Check out our other repos!

If you would like to learn more about Semantic Kernel and AI, you may also be interested in other repos the Semantic Kernel team supports:

Repo Description
Semantic Kernel A lightweight SDK that integrates cutting-edge LLM technology quickly and easily into your apps.
Semantic Kernel Docs The home for Semantic Kernel documentation that appears on the Microsoft learn site.
Semantic Kernel Starters Starter projects for Semantic Kernel to make it easier to get started.
Semantic Memory A service that allows you to create pipelines for ingesting, storing, and querying knowledge.

Join the community

We welcome your contributions and suggestions to the Chat Copilot Sample App! One of the easiest ways to participate is to engage in discussions in the GitHub repository. Bug reports and fixes are welcome!

To learn more and get started:

Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

License

Copyright (c) Microsoft Corporation. All rights reserved.

Licensed under the MIT license.

chat-copilot's People

Contributors

adrianwyatt avatar alliscode avatar amsacha avatar awharrison-28 avatar crickman avatar davearlin avatar dehoward avatar dependabot[bot] avatar dluc avatar gitri-ms avatar glahaye avatar hario90 avatar huangyingting avatar kbeaugrand avatar lemillermicrosoft avatar lextm avatar m2web avatar marcelojsilva avatar markwallace-microsoft avatar matthewbolanos avatar microsoftshannon avatar momuno avatar rainson12 avatar rogerbarreto avatar rubiktubik avatar shawncal avatar stephentoub avatar taochenosu avatar teresaqhoang avatar vivihung avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

chat-copilot's Issues

Getting 500s from Azure.AI.OpenAI.OpenAIClient.GetEmbeddingsAsync

Describe the bug

I'm trying to chat with the bot locally, however, this doesn't go anywhere and in web API logs I'm seeing a lot of errors that look like below. How do I debug this?

fail: SemanticKernel.Service.CopilotChat.Skills.ChatSkills.ChatSkill[0]
Cannot search collection f375dd31-e341-4ab0-a2c6-dc5087cb3aa6-LongTermMemory
Microsoft.SemanticKernel.AI.AIException: Service error: The service failed to process the request, HTTP status:500
---> Azure.RequestFailedException: Internal server error
Status: 500 (Internal Server Error)

  Content:
  { "statusCode": 500, "message": "Internal server error", "activityId": "19ccf22c-8e3d-4a93-8eb9-028cef52fd3a" }

  Headers:
  x-ms-client-request-id: 29beecdc-e4bc-4929-b5be-28594a1db6e1
  apim-request-id: REDACTED
  Strict-Transport-Security: REDACTED
  X-Content-Type-Options: REDACTED
  x-ms-region: REDACTED
  Date: Tue, 08 Aug 2023 00:13:25 GMT
  Content-Length: 111
  Content-Type: application/json

     at Azure.Core.HttpPipelineExtensions.ProcessMessageAsync(HttpPipeline pipeline, HttpMessage message, RequestContext requestContext, CancellationToken cancellationToken)
     at Azure.AI.OpenAI.OpenAIClient.GetEmbeddingsAsync(String deploymentOrModelName, EmbeddingsOptions embeddingsOptions, CancellationToken cancellationToken)
     at Microsoft.SemanticKernel.Connectors.AI.OpenAI.AzureSdk.ClientBase.RunRequestAsync[T](Func`1 request)
     --- End of inner exception stack trace ---
     at Microsoft.SemanticKernel.Connectors.AI.OpenAI.AzureSdk.ClientBase.RunRequestAsync[T](Func`1 request)
     at Microsoft.SemanticKernel.Connectors.AI.OpenAI.AzureSdk.ClientBase.InternalGetEmbeddingsAsync(IList`1 data, CancellationToken cancellationToken)
     at Microsoft.SemanticKernel.AI.Embeddings.EmbeddingGenerationExtensions.GenerateEmbeddingAsync[TValue,TEmbedding](IEmbeddingGeneration`2 generator, TValue value, CancellationToken cancellationToken)
     at Microsoft.SemanticKernel.Memory.SemanticTextMemory.SearchAsync(String collection, String query, Int32 limit, Double minRelevanceScore, Boolean withEmbeddings, CancellationToken cancellationToken)+MoveNext()

or

fail: SemanticKernel.Service.CopilotChat.Skills.ChatSkills.ChatSkill[0]
Cannot search collection f375dd31-e341-4ab0-a2c6-dc5087cb3aa6-WorkingMemory
Microsoft.SemanticKernel.AI.AIException: Service error: The service failed to process the request, HTTP status:500
---> Azure.RequestFailedException: Internal server error
Status: 500 (Internal Server Error)

  Content:
  { "statusCode": 500, "message": "Internal server error", "activityId": "95f34a4a-c52c-4121-a0e5-d58ab0d6a6e3" }

  Headers:
  x-ms-client-request-id: 8647cf4a-e191-4fa7-8480-b58c37977d0b
  apim-request-id: REDACTED
  Strict-Transport-Security: REDACTED
  X-Content-Type-Options: REDACTED
  x-ms-region: REDACTED
  Date: Tue, 08 Aug 2023 00:12:21 GMT
  Content-Length: 111
  Content-Type: application/json

To Reproduce
Steps to reproduce the behavior:

  1. Completed local devbox setup.
  2. Started the app.
  3. Typing questions and not getting responses reliably.

Expected behavior

Get responses reliably.

Platform

  • OS: Windows
  • IDE: VS Code
  • Language: C#
  • Source: main branch of the repo.

Improve documentation on how to set up AAD with Chat Copilot

When setting up the app for the first time with AAD authentication, a new AAD application is required. This needs to be documented, including the required settings.

The setup instructions should document all necessary steps to get the application running.

Documentation about AAD config is confusing

Section "(Optional) Enable backend authorization via Azure AD" of readme says "Ensure you created the required application registration mentioned in Start the WebApp FrontEnd application" and links to the #start-the-webapp-frontend-application anchor which doesn't exist.

ServiceOptionsController return all service options from a single request

Currently the ServiceOptionsController has separate APIs for each option. It'd be nice to have one API that returns all the options, reducing the number of requests required.

Note: the current implementation only has memories store type because that is the only requested option to show in the webapp. In the future if we desire to show more options, we should combine things in a single API and a single response model.

tenant ID not documented or used in configure script

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'configure.sh' step in setup
  2. the script accepts --tenantid as a parameter for setting up with Azure AD on a single enterprise. It's in the script though not documented in readme. on line 105 it then sets tenant ID to a default value if none is given (env_tenant_id). on line 156 it should be using the tenant_id variable, not ENV_TENANT_ID. this way if one is passed it, it is passed to the env file.

Readme should get updated for single tenant deployment as an option as well.

serviceOptions 404 error

Describe the bug
After deploying the package to Azure, the api/serviceOptions endpoint returns a 404. If I run it from local files it works, but when using the package that is deployed to azure, it gives that error

image

To Reproduce
Steps to reproduce the behavior:

  1. Deploy application using Azure 1 click deploy from the /deploy page
  2. wait for webapi to deploy and build
  3. go to webapi/healthz endpoint and it returns "healthy"
  4. try to access webapi/serviceOptions endpoint and it returns a 404 error. leads to error messages on client side

Expected behavior
Expect 200 response as when it is run locally

Screenshots
image

Platform

  • Azure

Additional context
Add any other context about the problem here.

Enable Deploy to specify region of Static Web App

  • As a: Engineer deploying Chat Copilot
  • I want: To the Static Web App resource to be deployed into the same region as all the other resources.
  • So that: I can reduce latency to load the static web app.

The Bicep defaults to deploying the Static Web App to westus2 and neither the deploy-azure.sh or deploy-azure.ps1 pass this parameter in during deployment. Therefore, it will always deploy to westus2 regardless.

Possible solutions:

  1. Default the deployment location of the Static Web App to be the same as the location if not specified.
  2. Add a parameter to deploy-azure.ps1 and deploy-azure.sh to allow setting this value.
  3. Remove the parameter entirely and always deploy the Static Web App to the same location as the other resources.

I'm happy to submit a PR to resolve this if one of the options is preferrable. It is a minor issue, but I prefer all my resources in the same region if possible.

How can I disable Microsoft account authentication?

Hi Everyone,

Love what you've done with chat-copilot web app. I am going to use this internally for testing and would like to turn off the Microsoft Azure Directory authentication as using Microsoft accounts is overkill and unnecessary.

I see that the webapp/.env.example file has some configuration options that are used to define 2 users that can login without a Microsoft account. It looks like the unit tests leverage these to bypass the Microsoft login.

REACT_APP_TEST_USER_ACCOUNT1=
REACT_APP_TEST_USER_PASSWORD1=
REACT_APP_TEST_USER_ACCOUNT2=
REACT_APP_TEST_USER_PASSWORD2=

How can I enable these hardcoded accounts to be the only authorized users who can sign in while also disabling the Microsoft authentication altogether?

Thanks for your help in advance.

Planner Enhancements

Need to re-evaluate our ExternalInformationSkill to better support SequentialPlanner inputs and outputs

Tasks

Deploy webapi package that matches memories selection in ARM template

Currently the Deploy to Azure buttons use an ARM template that defaults the memories selection to "Volatile" but does allow the user to change this to Qdrant or ACS. The problem is that the webapi package that is deployed is configured to use volatile memories and so changing this in the ARM deployment results in a resource that is deployed but is not being used.

One option to fix this is to publish webapi artifacts with all configurations in the pipeline, and then use the memories selection in the ARM template to pick the correct one.

Persistent RLHF

Currently RLHF is only implemented on the front end for demonstration purposes, need to pass feedback to model somehow (few shot?) or save in chat message for persistence

It's disabled so not actually shown in webapp

document import not extracting knowledge

after importing a pdf document and asking it questions about the document it has no knowledge of the content in the pdf . Is this still under development ? I am using qdrant for embeddings and no errors appear in console.

Prompt View - Add Dependency context details

Much like we're able to show the full context when a stepwise planner returns some result, we should show at least the prompt template that was used in each semantic dependency of ChatSkill

See: #149

Tasks

Error: 401 Unauthorized with AzureAD Authorization on Backend

After adjusting the Authorization section of appsettings.json for Copilot Chat to use AzureAd I receive a 401 Unauthorized error with the following www-authenticate response header:
Bearer error="invalid_token", error_description="The signature is invalid"

[Custom Plugins] Validate OpenAPI spec on entry

In the Custom Plugin flow on the webapp, we need to form validation to verify the Open API spec once it's parsed from the manifest file.

Image

I'm thinking we expose an API from the webapi that calls the OpenAPI parser to validate the form and then call that from the webapp

Tasks

Update webapi routes

  • Change routes to better align with Microsoft's API guidelines, per the suggestions in microsoft/semantic-kernel#1090. This will be a breaking change.
  • Routes that access a particular chat session should include the chatId in the route so that we can leverage the "RequireChatParticipant" authorization policy.

Error: Invalid request: The request is not valid, HTTP status: 404. Details: The API deployment for this resource does not exist. If you created the deployment within the last 5 minutes, please wait a moment and try again.

Describe the bug
A clear and concise description of what the bug is.
I am trying to run the project with my AzureOpenAI credentials. However, it leads the the error

Error: Invalid request: The request is not valid, HTTP status: 404. Details: The API deployment for this resource does not exist. If you created the deployment within the last 5 minutes, please wait a moment and try again.

I have already created the deployment on AzureOpenAI, it is up and running.

To Reproduce
Steps to reproduce the behavior:

  1. start up the server and frontend with dotnet run and yarn start

Expected behavior
A clear and concise description of what you expected to happen.
The chatbot should return a response.

Screenshots
If applicable, add screenshots to help explain your problem.
This is the error trace

Microsoft.AspNetCore.Server.Kestrel[0]
      Overriding address(es) 'http://localhost:37240'. Binding to endpoints defined via IConfiguration and/or UseKestrel() instead.
info: Microsoft.Hosting.Lifetime[14]
      Now listening on: https://localhost:40443
info: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
      Hosting environment: Development
info: Microsoft.Hosting.Lifetime[0]
      Content root path: /Users/ekdnam/Projects/copilot-chat-app/webapi
info: SemanticKernel.Service.Program[0]
      Health probe: https://localhost:40443/healthz
info: Microsoft.AspNetCore.Hosting.Diagnostics[1]
      Request starting HTTP/1.1 GET https://localhost:40443/messageRelayHub - -
info: SemanticKernel.Service.Auth.PassThroughAuthenticationHandler[0]
      Allowing request to pass through
info: Microsoft.AspNetCore.Hosting.Diagnostics[1]
      Request starting HTTP/1.1 GET https://localhost:40443/healthz - -
info: SemanticKernel.Service.Auth.PassThroughAuthenticationHandler[0]
      Allowing request to pass through
info: Microsoft.AspNetCore.Hosting.Diagnostics[2]
      Request finished HTTP/1.1 GET https://localhost:40443/healthz - - - 200 - text/plain 13.6845ms
info: Microsoft.AspNetCore.Hosting.Diagnostics[1]
      Request starting HTTP/1.1 GET https://localhost:40443/messageRelayHub - -
info: SemanticKernel.Service.Auth.PassThroughAuthenticationHandler[0]
      Allowing request to pass through
info: Microsoft.AspNetCore.Hosting.Diagnostics[2]
      Request finished HTTP/1.1 GET https://localhost:40443/messageRelayHub - - - 101 - - 714.8757ms
info: Microsoft.AspNetCore.Hosting.Diagnostics[1]
      Request starting HTTP/1.1 OPTIONS https://localhost:40443/chatSession/getAllChats/4cd0f668-8aa0-46f8-99f5-bbd098cd0494.b5a078fe-4334-4ee6-9122-352bf41674ec - -
info: Microsoft.AspNetCore.Hosting.Diagnostics[2]
      Request finished HTTP/1.1 OPTIONS https://localhost:40443/chatSession/getAllChats/4cd0f668-8aa0-46f8-99f5-bbd098cd0494.b5a078fe-4334-4ee6-9122-352bf41674ec - - - 204 - - 1.7864ms
info: Microsoft.AspNetCore.Hosting.Diagnostics[1]
      Request starting HTTP/1.1 GET https://localhost:40443/chatSession/getAllChats/4cd0f668-8aa0-46f8-99f5-bbd098cd0494.b5a078fe-4334-4ee6-9122-352bf41674ec application/json -
info: SemanticKernel.Service.Auth.PassThroughAuthenticationHandler[0]
      Allowing request to pass through
info: Microsoft.AspNetCore.Hosting.Diagnostics[2]
      Request finished HTTP/1.1 GET https://localhost:40443/chatSession/getAllChats/4cd0f668-8aa0-46f8-99f5-bbd098cd0494.b5a078fe-4334-4ee6-9122-352bf41674ec application/json - - 200 - application/json;+charset=utf-8 39.2631ms
info: Microsoft.AspNetCore.Hosting.Diagnostics[1]
      Request starting HTTP/1.1 OPTIONS https://localhost:40443/chatSession/create - -
info: Microsoft.AspNetCore.Hosting.Diagnostics[2]
      Request finished HTTP/1.1 OPTIONS https://localhost:40443/chatSession/create - - - 204 - - 0.6206ms
info: Microsoft.AspNetCore.Hosting.Diagnostics[1]
      Request starting HTTP/1.1 POST https://localhost:40443/chatSession/create application/json 127
info: SemanticKernel.Service.Auth.PassThroughAuthenticationHandler[0]
      Allowing request to pass through
info: Microsoft.AspNetCore.Hosting.Diagnostics[2]
      Request finished HTTP/1.1 POST https://localhost:40443/chatSession/create application/json 127 - 201 - application/json;+charset=utf-8 38.1543ms
info: Microsoft.AspNetCore.Hosting.Diagnostics[1]
      Request starting HTTP/1.1 OPTIONS https://localhost:40443/chatSession/getChatMessages/73d94922-f2be-43a8-b3ed-769fc4f96add?startIdx=0&count=1 - -
info: Microsoft.AspNetCore.Hosting.Diagnostics[2]
      Request finished HTTP/1.1 OPTIONS https://localhost:40443/chatSession/getChatMessages/73d94922-f2be-43a8-b3ed-769fc4f96add?startIdx=0&count=1 - - - 204 - - 0.2834ms
info: Microsoft.AspNetCore.Hosting.Diagnostics[1]
      Request starting HTTP/1.1 GET https://localhost:40443/chatSession/getChatMessages/73d94922-f2be-43a8-b3ed-769fc4f96add?startIdx=0&count=1 application/json -
info: SemanticKernel.Service.Auth.PassThroughAuthenticationHandler[0]
      Allowing request to pass through
info: Microsoft.AspNetCore.Hosting.Diagnostics[2]
      Request finished HTTP/1.1 GET https://localhost:40443/chatSession/getChatMessages/73d94922-f2be-43a8-b3ed-769fc4f96add?startIdx=0&count=1 application/json - - 200 - application/json;+charset=utf-8 19.2040ms
info: Microsoft.AspNetCore.Hosting.Diagnostics[1]
      Request starting HTTP/1.1 OPTIONS https://localhost:40443/speechToken - -
info: Microsoft.AspNetCore.Hosting.Diagnostics[2]
      Request finished HTTP/1.1 OPTIONS https://localhost:40443/speechToken - - - 204 - - 0.1704ms
info: Microsoft.AspNetCore.Hosting.Diagnostics[1]
      Request starting HTTP/1.1 OPTIONS https://localhost:40443/speechToken - -
info: Microsoft.AspNetCore.Hosting.Diagnostics[2]
      Request finished HTTP/1.1 OPTIONS https://localhost:40443/speechToken - - - 204 - - 0.0550ms
info: Microsoft.AspNetCore.Hosting.Diagnostics[1]
      Request starting HTTP/1.1 GET https://localhost:40443/speechToken application/json -
info: SemanticKernel.Service.Auth.PassThroughAuthenticationHandler[0]
      Allowing request to pass through
info: Microsoft.AspNetCore.Hosting.Diagnostics[2]
      Request finished HTTP/1.1 GET https://localhost:40443/speechToken application/json - - 200 - application/json;+charset=utf-8 5.7146ms
info: Microsoft.AspNetCore.Hosting.Diagnostics[1]
      Request starting HTTP/1.1 GET https://localhost:40443/speechToken application/json -
info: SemanticKernel.Service.Auth.PassThroughAuthenticationHandler[0]
      Allowing request to pass through
info: Microsoft.AspNetCore.Hosting.Diagnostics[2]
      Request finished HTTP/1.1 GET https://localhost:40443/speechToken application/json - - 200 - application/json;+charset=utf-8 0.2466ms
info: Microsoft.AspNetCore.Hosting.Diagnostics[1]
      Request starting HTTP/1.1 OPTIONS https://localhost:40443/chat - -
info: Microsoft.AspNetCore.Hosting.Diagnostics[2]
      Request finished HTTP/1.1 OPTIONS https://localhost:40443/chat - - - 204 - - 0.4357ms
info: Microsoft.AspNetCore.Hosting.Diagnostics[1]
      Request starting HTTP/1.1 POST https://localhost:40443/chat application/json 270
info: SemanticKernel.Service.Auth.PassThroughAuthenticationHandler[0]
      Allowing request to pass through
fail: Microsoft.SemanticKernel.IKernel[0]
      Something went wrong while rendering the semantic function or while executing the text completion. Function: ChatSkill.funcf7c0625a835e4d588e88223f37c30a42. Error: Invalid request: The request is not valid, HTTP status: 404. Details: The API deployment for this resource does not exist. If you created the deployment within the last 5 minutes, please wait a moment and try again.
      Status: 404 (Not Found)
      ErrorCode: DeploymentNotFound
      
      Content:
      {"error":{"code":"DeploymentNotFound", "message":"The API deployment for this resource does not exist. If you created the deployment within the last 5 minutes, please wait a moment and try again."}}
      
      Headers:
      OpenAI-Processing-Ms: REDACTED
      x-ms-client-request-id: 71fb1aa3-6d1b-411c-89bc-34de587346be
      apim-request-id: REDACTED
      Strict-Transport-Security: REDACTED
      X-Content-Type-Options: REDACTED
      x-ms-region: REDACTED
      Date: Mon, 07 Aug 2023 05:07:51 GMT
      Content-Length: 198
      Content-Type: application/json
      
      Microsoft.SemanticKernel.AI.AIException: Invalid request: The request is not valid, HTTP status: 404
       ---> Azure.RequestFailedException: The API deployment for this resource does not exist. If you created the deployment within the last 5 minutes, please wait a moment and try again.
      Status: 404 (Not Found)
      ErrorCode: DeploymentNotFound
      
      Content:
      {"error":{"code":"DeploymentNotFound", "message":"The API deployment for this resource does not exist. If you created the deployment within the last 5 minutes, please wait a moment and try again."}}
      
      Headers:
      OpenAI-Processing-Ms: REDACTED
      x-ms-client-request-id: 71fb1aa3-6d1b-411c-89bc-34de587346be
      apim-request-id: REDACTED
      Strict-Transport-Security: REDACTED
      X-Content-Type-Options: REDACTED
      x-ms-region: REDACTED
      Date: Mon, 07 Aug 2023 05:07:51 GMT
      Content-Length: 198
      Content-Type: application/json
      
         at Azure.Core.HttpPipelineExtensions.ProcessMessageAsync(HttpPipeline pipeline, HttpMessage message, RequestContext requestContext, CancellationToken cancellationToken)
         at Azure.AI.OpenAI.OpenAIClient.GetChatCompletionsAsync(String deploymentOrModelName, ChatCompletionsOptions chatCompletionsOptions, CancellationToken cancellationToken)
         at Microsoft.SemanticKernel.Connectors.AI.OpenAI.AzureSdk.ClientBase.RunRequestAsync[T](Func`1 request)
         --- End of inner exception stack trace ---
         at Microsoft.SemanticKernel.Connectors.AI.OpenAI.AzureSdk.ClientBase.RunRequestAsync[T](Func`1 request)
         at Microsoft.SemanticKernel.Connectors.AI.OpenAI.AzureSdk.ClientBase.InternalGetChatResultsAsync(ChatHistory chat, ChatRequestSettings chatSettings, CancellationToken cancellationToken)
         at Microsoft.SemanticKernel.Connectors.AI.OpenAI.AzureSdk.ClientBase.InternalGetChatResultsAsTextAsync(String text, CompleteRequestSettings textSettings, CancellationToken cancellationToken)
         at Microsoft.SemanticKernel.SkillDefinition.SKFunction.<>c__DisplayClass19_0.<<FromSemanticConfig>g__LocalFunc|1>d.MoveNext()
fail: Microsoft.SemanticKernel.IKernel[0]
      Invalid request: The request is not valid, HTTP status: 404: Microsoft.SemanticKernel.AI.AIException: Invalid request: The request is not valid, HTTP status: 404
       ---> Azure.RequestFailedException: The API deployment for this resource does not exist. If you created the deployment within the last 5 minutes, please wait a moment and try again.
      Status: 404 (Not Found)
      ErrorCode: DeploymentNotFound
      
      Content:
      {"error":{"code":"DeploymentNotFound", "message":"The API deployment for this resource does not exist. If you created the deployment within the last 5 minutes, please wait a moment and try again."}}
      
      Headers:
      OpenAI-Processing-Ms: REDACTED
      x-ms-client-request-id: 71fb1aa3-6d1b-411c-89bc-34de587346be
      apim-request-id: REDACTED
      Strict-Transport-Security: REDACTED
      X-Content-Type-Options: REDACTED
      x-ms-region: REDACTED
      Date: Mon, 07 Aug 2023 05:07:51 GMT
      Content-Length: 198
      Content-Type: application/json
      
         at Azure.Core.HttpPipelineExtensions.ProcessMessageAsync(HttpPipeline pipeline, HttpMessage message, RequestContext requestContext, CancellationToken cancellationToken)
         at Azure.AI.OpenAI.OpenAIClient.GetChatCompletionsAsync(String deploymentOrModelName, ChatCompletionsOptions chatCompletionsOptions, CancellationToken cancellationToken)
         at Microsoft.SemanticKernel.Connectors.AI.OpenAI.AzureSdk.ClientBase.RunRequestAsync[T](Func`1 request)
         --- End of inner exception stack trace ---
         at Microsoft.SemanticKernel.Connectors.AI.OpenAI.AzureSdk.ClientBase.RunRequestAsync[T](Func`1 request)
         at Microsoft.SemanticKernel.Connectors.AI.OpenAI.AzureSdk.ClientBase.InternalGetChatResultsAsync(ChatHistory chat, ChatRequestSettings chatSettings, CancellationToken cancellationToken)
         at Microsoft.SemanticKernel.Connectors.AI.OpenAI.AzureSdk.ClientBase.InternalGetChatResultsAsTextAsync(String text, CompleteRequestSettings textSettings, CancellationToken cancellationToken)
         at Microsoft.SemanticKernel.SkillDefinition.SKFunction.<>c__DisplayClass19_0.<<FromSemanticConfig>g__LocalFunc|1>d.MoveNext()
fail: Microsoft.SemanticKernel.IKernel[0]
      Function call fail during pipeline step 0: ChatSkill.Chat. Error: Invalid request: The request is not valid, HTTP status: 404
Hello, world!
info: Microsoft.AspNetCore.Hosting.Diagnostics[2]
      Request finished HTTP/1.1 POST https://localhost:40443/chat application/json 270 - 400 - text/plain;+charset=utf-8 2070.9510ms

Platform

  • OS: Mac
  • IDE: VS Code
  • Language:C#
  • Source: main branch of the repo

Additional context
Add any other context about the problem here.

Failed: memory not established

In the documents tab I upload a PDF file and shows in the list.
But on the Chat tab, there is a message from the bot with the file name
To Reproduce
Steps to reproduce the behavior:

  1. Go to 'Documents'
  2. Click on 'Upload'
  3. Upload PDF file
  4. Go to 'Chat'
  5. Ask "write a summary of the file"
  6. Bot answers: I apologize, but I don't have access to the content of the file you mentioned. Is there anything else I can help you with?

Expected behavior
A clear and concise description of what you expected to happen.
The file should be in the list and the chat should suggest what to do with it.
I should be able to ask about the file. No?

Screenshots
If applicable, add screenshots to help explain your problem.

image

Platform

  • OS: Windows
  • IDE: N/A

Help fixing it please
Thank you

Handle TODOs for upload/download bot

Tasks

Plugins enabled are not saved when you refresh page

Describe the bug
Plugins are not saved when you refresh the page

To Reproduce
Steps to reproduce the behavior:

  1. in the copilot front end click on plugins, and add any plugin
  2. refresh the page, and notice the plugin in question is no longer activated

BrowserAuthError when launching chat-copilot

Describe the bug
Often when launching chat-copilot a red screen with errors is shown. This appears to be an issue related to authentication and pop-up windows.

Running in Private mode seems to fix the issue.

image

image

Expected behavior
The app should launch and authenticate without error.

ActionPlanner stabilization

Action Planner intermittently returns a 400 error

In scenario test:
If a plugin has been enabled, the action planner is invoked to perform the evaluation. This leads to a weird json exception and crash. To workaround this im performing the evaluation after disabling the plugin.

Expose token settings for document embeddings

Exposing DocumentLineSplitMaxTokens and DocumentParagraphSplitMaxLines these paramteres for override in the API and App provides customer with an avenue to tune these on a per document basis.

  • Ben

Use PostgresSQL as MemoryStore

Current Memory store options are:

  • volatile
  • qdrant
  • azure cognitive search
  • chroma

While deploying to Azure, the only PaaS available directly on Azure is Azure Cognitive Search.
However this is limited to 50 indexes, that might limit the usage when adding more users to the chat...

I'ld like to add CosmosDB as vector database (using PostgreSQL connector).

Web API as Function App ?

Hi, I wondering to know why the web api has not been developed in Function App solution?
Is there a specific requirement?

Custom Plugin in Chat-Copilot Fetching Outdated Data Instead of Up-to-Date Results

Describe the bug
When enabling my custom plugin through Chat-Copilot and running it, the plugin doesn't provide up-to-date results. Specifically, I've created a custom plugin named "Grocery App Plugin," allowing users to add, list, and remove items. While using Swagger to add items to the list, I can retrieve the complete list of items. However, when running the same plugin through Chat-Copilot, it seems to fetch outdated data, appearing as if the planner is providing historical details. I'm utilizing the "Action" Planner /"Sequential" Planner with the gpt-35-turbo model.

To Reproduce
Steps to reproduce the behavior:
1.Enable custom plugin -"Grocery App Plugin"
2.List the grocery items using "Grocery App Plugin."
3.Attempt to add an item using the plugin or Swagger
4.Run the plugin to list the items.
5.Compare the listed items with the actual up-to-date list.

Expected behavior
I expected the plugin to fetch and display the most recent data when using Chat-Copilot, similar to the behavior when interacting with Swagger directly. This would ensure that users receive accurate and current information from the plugin.

Screenshots
Please find the screenshots of the outdated results from Chat-Copilot and the expected up-to-date results from Swagger.

ChatCopilot-CustomPlugin-ErrorScreenshot
FastAPI-Swagger UI-Data Response

Platform

Additional context
I noticed that this issue is specific to Chat-Copilot's interaction with my custom plugin. Swagger integration seems to work correctly and provides real-time updates. This context could potentially help in identifying whether the problem lies within my plugin's implementation or Chat-Copilot's integration with both "Action"/ "Sequential" Planner along with the gpt-35-turbo model.

Getting exception when retrieving records from volatile memory

Describe the bug
Hi Im getting folwing error in Chat Copilot app with volatile memory on line 81 in webapi\CopilotChat\Skills\ChatSkills\DocumentMemorySkill.cs file.
inner exception is:

To Reproduce
Steps to reproduce the behavior:

  1. Register a plugin.
  2. Ask a question that plugin solves
  3. Ask another question.'

Expected behavior
Retrieve similar records from volatile memory.

Screenshots
image

Platform

  • OS: [Windows]
  • IDE: [Visual Studio 2022]
  • Language: [C#]
  • Source: [e.g. NuGet package version 0.1.0, pip package version 0.1.0, main branch of repository]

Additional context
InnerException {"The API deployment for this resource does not exist. If you created the deployment within the last 5 minutes, please wait a moment and try again.\r\nStatus: 404 (Not Found)\r\nErrorCode: DeploymentNotFound\r\n\r\nContent:\r\n{"error":{"code":"DeploymentNotFound", "message":"The API deployment for this resource does not exist. If you created the deployment within the last 5 minutes, please wait a moment and try again."}}\r\n\r\nHeaders:\r\nOpenAI-Processing-Ms: REDACTED\r\nx-ms-client-request-id: 1652580f-151c-46c0-a75b-bc71e7b8a4b5\r\napim-request-id: REDACTED\r\nStrict-Transport-Security: REDACTED\r\nX-Content-Type-Options: REDACTED\r\nx-ms-region: REDACTED\r\nDate: Tue, 08 Aug 2023 09:19:46 GMT\r\nContent-Length: 198\r\nContent-Type: application/json\r\n"} System.Exception {Azure.RequestFailedException}

Stack trace:
at Microsoft.SemanticKernel.Connectors.AI.OpenAI.AzureSdk.ClientBase.d__251.MoveNext() at Microsoft.SemanticKernel.Connectors.AI.OpenAI.AzureSdk.ClientBase.<InternalGetEmbeddingsAsync>d__14.MoveNext() at Microsoft.SemanticKernel.AI.Embeddings.EmbeddingGenerationExtensions.<GenerateEmbeddingAsync>d__02.MoveNext()
at Microsoft.SemanticKernel.Memory.SemanticTextMemory.d__7.MoveNext()
at Microsoft.SemanticKernel.Memory.SemanticTextMemory.d__7.System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult(Int16 token)
at SemanticKernel.Service.CopilotChat.Skills.ChatSkills.DocumentMemorySkill.d__4.MoveNext() in C:\Work\chat-copilot-main\webapi\CopilotChat\Skills\ChatSkills\DocumentMemorySkill.cs:line 81

Configuration file not accepting aiservice

While running the ./Configure.sh on my terminal with values for each element. The output keeps printing even when I enter the value for --aiservice
Please specify an AI service (AzureOpenAI or OpenAI) for --aiservice.

To Reproduce
For MacOS
Download co-pilot chat repo
Run ./Install-brew.sh
Run ./Configure.sh --aiservice {AzureOpenAI} --apikey {XXXXXXXXXXXXXXX} --endpoint {https://xxxx.openai.azure.com/} --clientid {XXXX}
Output: Please specify an AI service (AzureOpenAI or OpenAI) for --aiservice.

Expected behavior
It should either accept the config or throw an error. It always says "Please specify an AI service (AzureOpenAI or OpenAI) for --aiservice." Even when specified

Platform

  • OS: [Mac]
  • IDE: [VS Code]

Additional context
The app still launches but gives invalid URL error. Might be a different bug. But this is what my server says:

Rename everything from Skills -> Plugins

Since MS aligned on Plugins, we need to rename everything with "Skill" in it to "Plugin"

No dependency on core team but here's an item to track the work on their side: microsoft/semantic-kernel#2119

Tasks

Disable Application Insights Telemetry logs

Describe the bug
Application Insights Telemetry create quite verbose logs and it does not filter "Authorization: Bearer" headers. I tried to disable it but I still see it in my logs:

To Reproduce
Steps to reproduce the behavior:

  1. Setup and run Copilot using Linux/macOS instruction https://github.com/microsoft/chat-copilot#linuxmacos
  2. Write and submit any prompt in UI http://localhost:3000/
  3. See Debug Console in VS Code

Expected behavior
No logs from Application Insights Telemetry

Screenshots
My appsettings.json
image

My launch.json:
image

Platform

  • OS: Mac
  • IDE: VS Code
  • Language: C#
  • Source: main branch of repository

Fix typing TODOs

Code mixes strings and Guid without being explicit about the serialization format

Tasks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.