Code Monkey home page Code Monkey logo

sample-app-aoai-chatgpt's Introduction

[Preview] Sample Chat App with AOAI

This repo contains sample code for a simple chat webapp that integrates with Azure OpenAI. Note: some portions of the app use preview APIs.

Prerequisites

  • An existing Azure OpenAI resource and model deployment of a chat model (e.g. gpt-35-turbo-16k, gpt-4)
  • To use Azure OpenAI on your data, one of the following data sources:
    • Azure AI Search Index
    • Azure CosmosDB Mongo vCore vector index
    • Elasticsearch index (preview)
    • Pinecone index (private preview)
    • Azure SQL Server (private preview)
    • Mongo DB (preview)

Configure the app

Create a .env file for local development

Follow instructions below in the app configuration section to create a .env file for local development of your app. This file can be used as a reference to populate the app settings for your Azure App Service deployed webapp.

Create a JSON file for populating Azure App Service app settings

After creating your .env file, run one of the following commands in your preferred shell to create a JSON representation of your environment which is recognized by Azure App Service.

Powershell

Get-Content .env | ForEach-Object {   
     if ($_ -match "(?<name>[A-Z_]+)=(?<value>.*)") {   
         [PSCustomObject]@{   
             name = $matches["name"]   
             value = $matches["value"]   
             slotSetting = $false  
         }  
    }  
} | ConvertTo-Json | Out-File -FilePath env.json

Bash

cat .env | jq -R '. | capture("(?<name>[A-Z_]+)=(?<value>.*)")' | jq -s '.[].slotSetting=false' > env.json

Deploy the app

Deploy with Azure Developer CLI

Please see README_azd.md for detailed instructions.

One click Azure deployment

Deploy to Azure

Click on the Deploy to Azure button and configure your settings in the Azure Portal as described in the Environment variables section.

Please see the section below for important information about adding authentication to your app.

Deploy from your local machine

  1. Follow the steps below in the app configuration section to construct your .env file with the appropriate variables for your use case.

  2. Start the app with start.cmd. This will build the frontend, install backend dependencies, and then start the app. Or, just run the backend in debug mode using the VSCode debug configuration in .vscode/launch.json.

  3. You can see the local running app at http://127.0.0.1:50505.

Deploy with the Azure CLI

Create the Azure App Service

NOTE: If you've made code changes, be sure to build the app code with start.cmd or start.sh before you deploy, otherwise your changes will not be picked up. If you've updated any files in the frontend folder, make sure you see updates to the files in the static folder before you deploy.

You can use the Azure CLI to deploy the app from your local machine. Make sure you have version 2.48.1 or later.

If this is your first time deploying the app, you can use az webapp up. Run the following command from the root folder of the repo, updating the placeholder values to your desired app name, resource group, location, and subscription. You can also change the SKU if desired.

az webapp up --runtime PYTHON:3.11 --sku B1 --name <new-app-name> --resource-group <resource-group-name> --location <azure-region> --subscription <subscription-name>

Note: if using the Azure CLI version 2.62 or greater, you may also want to add the flag --track-status False to prevent the command from failing due to startup errors. Startup errors can be solved by following the instructions in the next section about updating app configuration.

Update app configuration

After creating your Azure App Service, follow these steps to update the configuration to allow your application to properly start up.

  1. Set the app startup command
az webapp config set --startup-file "python3 -m gunicorn app:app" --name <new-app-name>
  1. Set WEBSITE_WEBDEPLOY_USE_SCM=false to allow local code deployment.
az webapp config appsettings set -g <resource-group-name> -n <existing-app-name> --settings WEBSITE_WEBDEPLOY_USE_SCM=false
  1. Set all of your app settings in your local .env file at once by creating a JSON representation of the .env file, and then run the following command.
az webapp config appsettings set -g <resource-group-name> -n <existing-app-name> --settings "@env.json"

Update an existing app

Check the runtime stack for your app by viewing the app service resource in the Azure Portal. If it shows "Python - 3.10", use PYTHON:3.10 in the runtime argument below. If it shows "Python - 3.11", use PYTHON:3.11 in the runtime argument below.

Check the SKU in the same way. Use the abbreviated SKU name in the argument below, e.g. for "Basic (B1)" the SKU is B1.

Then, use these commands to deploy your local code to the existing app:

  1. az webapp up --runtime <runtime-stack> --sku <sku> --name <existing-app-name> --resource-group <resource-group-name>
  2. az webapp config set --startup-file "python3 -m gunicorn app:app" --name <existing-app-name>

Make sure that the app name and resource group match exactly for the app that was previously deployed.

Deployment will take several minutes. When it completes, you should be able to navigate to your app at {app-name}.azurewebsites.net.

Authentication

Add an identity provider

After deployment, you will need to add an identity provider to provide authentication support in your app. See this tutorial for more information.

If you don't add an identity provider, the chat functionality of your app will be blocked to prevent unauthorized access to your resources and data.

To remove this restriction, you can add AUTH_ENABLED=False to the environment variables. This will disable authentication and allow anyone to access the chat functionality of your app. This is not recommended for production apps.

To add further access controls, update the logic in getUserInfoList in frontend/src/pages/chat/Chat.tsx.

Using Microsoft Entra ID

To enable Microsoft Entra ID for intra-service authentication:

  1. Enable managed identity on Azure OpenAI
  2. Configure AI search to allow access from Azure OpenAI
    1. Enable Role Based Access control on the used AI search instance (see documentation)
    2. Assign Search Index Data Reader and Search Service Contributor to the identity of the Azure OpenAI instance
  3. Do not configure AZURE_SEARCH_KEY and AZURE_OPENAI_KEY to use Entra ID authentication.
  4. Configure the webapp identity
    1. Enable managed identity in the app service that hosts the webapp
    2. Go to the Azure OpenAI instance and assign the role Cognitive Services OpenAI User to the identity of the webapp

Note: RBAC assignments can take a few minutes before becoming effective.

App Configuration

App Settings

Basic Chat Experience

  1. Copy .env.sample to a new file called .env and configure the settings as described in the table below.

    App Setting Required? Default Value Note
    AZURE_OPENAI_RESOURCE Only if AZURE_OPENAI_ENDPOINT is not set The name of your Azure OpenAI resource (only one of AZURE_OPENAI_RESOURCE/AZURE_OPENAI_ENDPOINT is required)
    AZURE_OPENAI_ENDPOINT Only if AZURE_OPENAI_RESOURCE is not set The endpoint of your Azure OpenAI resource (only one of AZURE_OPENAI_RESOURCE/AZURE_OPENAI_ENDPOINT is required)
    AZURE_OPENAI_MODEL Yes The name of your model deployment
    AZURE_OPENAI_KEY Optional if using Microsoft Entra ID -- see our documentation on the required resource setup for identity-based authentication. One of the API keys of your Azure OpenAI resource
    AZURE_OPENAI_TEMPERATURE No 0 What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. A value of 0 is recommended when using your data.
    AZURE_OPENAI_TOP_P No 1.0 An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. We recommend setting this to 1.0 when using your data.
    AZURE_OPENAI_MAX_TOKENS No 1000 The maximum number of tokens allowed for the generated answer.
    AZURE_OPENAI_STOP_SEQUENCE No Up to 4 sequences where the API will stop generating further tokens. Represent these as a string joined with "
    AZURE_OPENAI_SYSTEM_MESSAGE No You are an AI assistant that helps people find information. A brief description of the role and tone the model should use
    AZURE_OPENAI_STREAM No True Whether or not to use streaming for the response. Note: Setting this to true prevents the use of prompt flow.
    AZURE_OPENAI_EMBEDDING_NAME Only if using vector search using an Azure OpenAI embedding model The name of your embedding model deployment if using vector search.

    See the documentation for more information on these parameters.

Chat with your data

More information about Azure OpenAI on your data

Chat with your data using Azure Cognitive Search

  1. Update the AZURE_OPENAI_* environment variables as described in the basic chat experience above.

  2. To connect to your data, you need to specify an Azure Cognitive Search index to use. You can create this index yourself or use the Azure AI Studio to create the index for you.

  3. Configure data source settings as described in the table below.

    App Setting Required? Default Value Note
    DATASOURCE_TYPE Yes Must be set to AzureCognitiveSearch
    AZURE_SEARCH_SERVICE Yes The name of your Azure AI Search resource
    AZURE_SEARCH_INDEX Yes The name of your Azure AI Search Index
    AZURE_SEARCH_KEY Optional if using Microsoft Entra ID -- see our documentation on the required resource setup for identity-based authentication. An admin key for your Azure AI Search resource.
    AZURE_SEARCH_USE_SEMANTIC_SEARCH No False Whether or not to use semantic search
    AZURE_SEARCH_QUERY_TYPE No simple Query type: simple, semantic, vector, vectorSimpleHybrid, or vectorSemanticHybrid. Takes precedence over AZURE_SEARCH_USE_SEMANTIC_SEARCH
    AZURE_SEARCH_SEMANTIC_SEARCH_CONFIG No The name of the semantic search configuration to use if using semantic search.
    AZURE_SEARCH_TOP_K No 5 The number of documents to retrieve when querying your search index.
    AZURE_SEARCH_ENABLE_IN_DOMAIN No True Limits responses to only queries relating to your data.
    AZURE_SEARCH_STRICTNESS No 3 Integer from 1 to 5 specifying the strictness for the model limiting responses to your data.
    AZURE_SEARCH_CONTENT_COLUMNS No List of fields in your search index that contains the text content of your documents to use when formulating a bot response. Represent these as a string joined with "
    AZURE_SEARCH_FILENAME_COLUMN No Field from your search index that gives a unique identifier of the source of your data to display in the UI.
    AZURE_SEARCH_TITLE_COLUMN No Field from your search index that gives a relevant title or header for your data content to display in the UI.
    AZURE_SEARCH_URL_COLUMN No Field from your search index that contains a URL for the document, e.g. an Azure Blob Storage URI. This value is not currently used.
    AZURE_SEARCH_VECTOR_COLUMNS No List of fields in your search index that contain vector embeddings of your documents to use when formulating a bot response. Represent these as a string joined with "
    AZURE_SEARCH_PERMITTED_GROUPS_COLUMN No Field from your Azure AI Search index that contains AAD group IDs that determine document-level access control.

    When using your own data with a vector index, ensure these settings are configured on your app:

    • AZURE_SEARCH_QUERY_TYPE: can be vector, vectorSimpleHybrid, or vectorSemanticHybrid,
    • AZURE_OPENAI_EMBEDDING_NAME: the name of your Ada (text-embedding-ada-002) model deployment on your Azure OpenAI resource.
    • AZURE_SEARCH_VECTOR_COLUMNS: the vector columns in your index to use when searching. Join them with | like contentVector|titleVector.

Chat with your data using Azure Cosmos DB

  1. Update the AZURE_OPENAI_* environment variables as described in the basic chat experience above.

  2. To connect to your data, you need to specify an Azure Cosmos DB database configuration. Learn more about creating an Azure Cosmos DB resource.

  3. Configure data source settings as described in the table below.

    App Setting Required? Default Value Note
    DATASOURCE_TYPE Yes Must be set to AzureCosmosDB
    AZURE_COSMOSDB_MONGO_VCORE_CONNECTION_STRING Yes The connection string used to connect to your Azure Cosmos DB instance
    AZURE_COSMOSDB_MONGO_VCORE_INDEX Yes The name of your Azure Cosmos DB vector index
    AZURE_COSMOSDB_MONGO_VCORE_DATABASE Yes The name of your Azure Cosmos DB database
    AZURE_COSMOSDB_MONGO_VCORE_CONTAINER Yes The name of your Azure Cosmos DB container
    AZURE_COSMOSDB_MONGO_VCORE_TOP_K No 5 The number of documents to retrieve when querying your search index.
    AZURE_COSMOSDB_MONGO_VCORE_ENABLE_IN_DOMAIN No True Limits responses to only queries relating to your data.
    AZURE_COSMOSDB_MONGO_VCORE_STRICTNESS No 3 Integer from 1 to 5 specifying the strictness for the model limiting responses to your data.
    AZURE_COSMOSDB_MONGO_VCORE_CONTENT_COLUMNS No List of fields in your search index that contains the text content of your documents to use when formulating a bot response. Represent these as a string joined with "
    AZURE_COSMOSDB_MONGO_VCORE_FILENAME_COLUMN No Field from your search index that gives a unique identifier of the source of your data to display in the UI.
    AZURE_COSMOSDB_MONGO_VCORE_TITLE_COLUMN No Field from your search index that gives a relevant title or header for your data content to display in the UI.
    AZURE_COSMOSDB_MONGO_VCORE_URL_COLUMN No Field from your search index that contains a URL for the document, e.g. an Azure Blob Storage URI. This value is not currently used.
    AZURE_COSMOSDB_MONGO_VCORE_VECTOR_COLUMNS No List of fields in your search index that contain vector embeddings of your documents to use when formulating a bot response. Represent these as a string joined with "

    Azure Cosmos DB uses vector search by default, so ensure these settings are configured on your app:

    • AZURE_OPENAI_EMBEDDING_NAME: the name of your Ada (text-embedding-ada-002) model deployment on your Azure OpenAI resource.
    • AZURE_COSMOSDB_MONGO_VCORE_VECTOR_COLUMNS: the vector columns in your index to use when searching. Join them with | like contentVector|titleVector.

Chat with your data using Elasticsearch (Preview)

  1. Update the AZURE_OPENAI_* environment variables as described in the basic chat experience above.

  2. To connect to your data, you need to specify an Elasticsearch cluster configuration. Learn more about Elasticsearch.

  3. Configure data source settings as described in the table below.

    App Setting Required? Default Value Note
    DATASOURCE_TYPE Yes Must be set to Elasticsearch
    ELASTICSEARCH_ENDPOINT Yes The base URL of your Elasticsearch cluster API
    ELASTICSEARCH_ENCODED_API_KEY Yes The encoded API key for your user identity on your Elasticsearch cluster
    ELASTICSEARCH_INDEX Yes The name of your Elasticsearch index
    ELASTICSEARCH_QUERY_TYPE No simple Can be one of simple or vector
    ELASTICSEARCH_EMBEDDING_MODEL_ID Only if using vector search with an Elasticsearch embedding model The name of the embedding model deployed to your Elasticsearch cluster which was used to produce embeddings for your index
    ELASTICSEARCH_TOP_K No 5 The number of documents to retrieve when querying your search index.
    ELASTICSEARCH_ENABLE_IN_DOMAIN No True Limits responses to only queries relating to your data.
    ELASTICSEARCH_STRICTNESS No 3 Integer from 1 to 5 specifying the strictness for the model limiting responses to your data.
    ELASTICSEARCH_CONTENT_COLUMNS No List of fields in your search index that contains the text content of your documents to use when formulating a bot response. Represent these as a string joined with "
    ELASTICSEARCH_FILENAME_COLUMN No Field from your search index that gives a unique identifier of the source of your data to display in the UI.
    ELASTICSEARCH_TITLE_COLUMN No Field from your search index that gives a relevant title or header for your data content to display in the UI.
    ELASTICSEARCH_URL_COLUMN No Field from your search index that contains a URL for the document, e.g. an Azure Blob Storage URI. This value is not currently used.
    ELASTICSEARCH_VECTOR_COLUMNS No List of fields in your search index that contain vector embeddings of your documents to use when formulating a bot response. Represent these as a string joined with "

    To use vector search with Elasticsearch, there are two options:

    1. To use Azure OpenAI embeddings, ensure that your index contains Azure OpenAI embeddings, and that the following variables are set:
    • AZURE_OPENAI_EMBEDDING_NAME: the name of your Ada (text-embedding-ada-002) model deployment on your Azure OpenAI resource, which was also used to create the embeddings in your index.
    • ELASTICSEARCH_VECTOR_COLUMNS: the vector columns in your index to use when searching. Join them with | like contentVector|titleVector.
    1. Use Elasticsearch embeddings, ensure that your index contains embeddings produced from a trained model on your Elasticsearch cluster, and that the following variables are set:
    • ELASTICSEARCH_EMBEDDING_MODEL_ID: the ID of the trained model used to produce embeddings on your index.
    • ELASTICSEARCH_VECTOR_COLUMNS: the vector columns in your index to use when searching. Join them with | like contentVector|titleVector.

Chat with your data using Pinecone (Private Preview)

  1. Update the AZURE_OPENAI_* environment variables as described in the basic chat experience above.

  2. To connect to your data, you need to specify an Pinecone vector database configuration. Learn more about Pinecone.

  3. Configure data source settings as described in the table below.

    App Setting Required? Default Value Note
    DATASOURCE_TYPE Yes Must be set to Pinecone
    PINECONE_ENVIRONMENT Yes The name of your Pinecone environment
    PINECONE_INDEX_NAME Yes The name of your Pinecone index
    PINECONE_API_KEY Yes The API key used to connect to your Pinecone instance
    PINECONE_TOP_K No 5 The number of documents to retrieve when querying your search index.
    PINECONE_ENABLE_IN_DOMAIN No True Limits responses to only queries relating to your data.
    PINECONE_STRICTNESS No 3 Integer from 1 to 5 specifying the strictness for the model limiting responses to your data.
    PINECONE_CONTENT_COLUMNS No List of fields in your search index that contains the text content of your documents to use when formulating a bot response. Represent these as a string joined with "
    PINECONE_FILENAME_COLUMN No Field from your search index that gives a unique identifier of the source of your data to display in the UI.
    PINECONE_TITLE_COLUMN No Field from your search index that gives a relevant title or header for your data content to display in the UI.
    PINECONE_URL_COLUMN No Field from your search index that contains a URL for the document, e.g. an Azure Blob Storage URI. This value is not currently used.
    PINECONE_VECTOR_COLUMNS No List of fields in your search index that contain vector embeddings of your documents to use when formulating a bot response. Represent these as a string joined with "

    Pinecone uses vector search by default, so ensure these settings are configured on your app:

    • AZURE_OPENAI_EMBEDDING_NAME: the name of your Ada (text-embedding-ada-002) model deployment on your Azure OpenAI resource.
    • PINECONE_VECTOR_COLUMNS: the vector columns in your index to use when searching. Join them with | like contentVector|titleVector.

Chat with your data using Mongo DB (Private Preview)

  1. Update the AZURE_OPENAI_* environment variables as described in the basic chat experience above.

  2. To connect to your data, you need to specify an Mongo DB database configuration. Learn more about MongoDB.

  3. Configure data source settings as described in the table below.

    App Setting Required? Default Value Note
    DATASOURCE_TYPE Yes Must be set to MongoDB
    MONGODB_CONNECTION_STRING Yes The connection string used to connect to your Mongo DB instance
    MONGODB_VECTOR_INDEX Yes The name of your Mongo DB vector index
    MONGODB_DATABASE_NAME Yes The name of your Mongo DB database
    MONGODB_CONTAINER_NAME Yes The name of your Mongo DB container
    MONGODB_TOP_K No 5 The number of documents to retrieve when querying your search index.
    MONGODB_ENABLE_IN_DOMAIN No True Limits responses to only queries relating to your data.
    MONGODB_STRICTNESS No 3 Integer from 1 to 5 specifying the strictness for the model limiting responses to your data.
    MONGODB_CONTENT_COLUMNS No List of fields in your search index that contains the text content of your documents to use when formulating a bot response. Represent these as a string joined with "
    MONGODB_FILENAME_COLUMN No Field from your search index that gives a unique identifier of the source of your data to display in the UI.
    MONGODB_TITLE_COLUMN No Field from your search index that gives a relevant title or header for your data content to display in the UI.
    MONGODB_URL_COLUMN No Field from your search index that contains a URL for the document, e.g. an Azure Blob Storage URI. This value is not currently used.
    MONGODB_VECTOR_COLUMNS No List of fields in your search index that contain vector embeddings of your documents to use when formulating a bot response. Represent these as a string joined with "

    MongoDB uses vector search by default, so ensure these settings are configured on your app:

    • AZURE_OPENAI_EMBEDDING_NAME: the name of your Ada (text-embedding-ada-002) model deployment on your Azure OpenAI resource.
    • MONGODB_VECTOR_COLUMNS: the vector columns in your index to use when searching. Join them with | like contentVector|titleVector.

Chat with your data using Azure SQL Server (Private Preview)

  1. Update the AZURE_OPENAI_* environment variables as described in the basic chat experience above.

  2. To enable Azure SQL Server, you will need to set up Azure SQL Server resources. Refer to this instruction guide to create an Azure SQL database.

  3. Configure data source settings as described in the table below.

    App Setting Required? Default Value Note
    DATASOURCE_TYPE Yes Must be set to AzureSqlServer
    AZURE_SQL_SERVER_CONNECTION_STRING Yes The connection string to use to connect to your Azure SQL Server instance
    AZURE_SQL_SERVER_TABLE_SCHEMA Yes The table schema for your Azure SQL Server table. Must be surrounded by double quotes (").
    AZURE_SQL_SERVER_PORT Not publicly available at this time. The port to use to connect to your Azure SQL Server instance.
    AZURE_SQL_SERVER_DATABASE_NAME Not publicly available at this time.
    AZURE_SQL_SERVER_DATABASE_SERVER Not publicly available at this time.

Chat with your data using Promptflow

Configure your settings using the table below.

App Setting Required? Default Value Note
USE_PROMPTFLOW No False Use existing Promptflow deployed endpoint. If set to True then both PROMPTFLOW_ENDPOINT and PROMPTFLOW_API_KEY also need to be set.
PROMPTFLOW_ENDPOINT Only if USE_PROMPTFLOW is True URL of the deployed Promptflow endpoint e.g. https://pf-deployment-name.region.inference.ml.azure.com/score
PROMPTFLOW_API_KEY Only if USE_PROMPTFLOW is True Auth key for deployed Promptflow endpoint. Note: only Key-based authentication is supported.
PROMPTFLOW_RESPONSE_TIMEOUT No 120 Timeout value in seconds for the Promptflow endpoint to respond.
PROMPTFLOW_REQUEST_FIELD_NAME No query Default field name to construct Promptflow request. Note: chat_history is auto constucted based on the interaction, if your API expects other mandatory field you will need to change the request parameters under promptflow_request function.
PROMPTFLOW_RESPONSE_FIELD_NAME No reply Default field name to process the response from Promptflow request.
PROMPTFLOW_CITATIONS_FIELD_NAME No documents Default field name to process the citations output from Promptflow request.

Enable Chat History

  1. Update the AZURE_OPENAI_* environment variables as described in the basic chat experience above.

  2. Add any additional configuration (described in previous sections) needed for chatting with data, if required.

  3. To enable chat history, you will need to set up CosmosDB resources. The ARM template in the infrastructure folder can be used to deploy an app service and a CosmosDB with the database and container configured.

  4. Configure data source settings as described in the table below.

    App Setting Required? Default Value Note
    AZURE_COSMOSDB_ACCOUNT Only if using chat history The name of the Azure Cosmos DB account used for storing chat history
    AZURE_COSMOSDB_DATABASE Only if using chat history The name of the Azure Cosmos DB database used for storing chat history
    AZURE_COSMOSDB_CONVERSATIONS_CONTAINER Only if using chat history The name of the Azure Cosmos DB container used for storing chat history
    AZURE_COSMOSDB_ACCOUNT_KEY Only if using chat history The account key for the Azure Cosmos DB account used for storing chat history
    AZURE_COSMOSDB_ENABLE_FEEDBACK No False Whether or not to enable message feedback on chat history messages

Common Customization Scenarios (e.g. updating the default chat logo and headers)

The interface allows for easy adaptation of the UI by modifying certain elements, such as the title and logo, through the use of the following environment variables.

App Setting Required? Default Value Note
UI_TITLE No Contoso Chat title (left-top) and page title (HTML)
UI_LOGO No Logo (left-top). Defaults to Contoso logo. Configure the URL to your logo image to modify.
UI_CHAT_LOGO No Logo (chat window). Defaults to Contoso logo. Configure the URL to your logo image to modify.
UI_CHAT_TITLE No Start chatting Title (chat window)
UI_CHAT_DESCRIPTION No This chatbot is configured to answer your questions Description (chat window)
UI_FAVICON No Defaults to Contoso favicon. Configure the URL to your favicon to modify.
UI_SHOW_SHARE_BUTTON No True Share button (right-top)
UI_SHOW_CHAT_HISTORY_BUTTON No True Show chat history button (right-top)
SANITIZE_ANSWER No False Whether to sanitize the answer from Azure OpenAI. Set to True to remove any HTML tags from the response.

Any custom images assigned to variables UI_LOGO, UI_CHAT_LOGO or UI_FAVICON should be added to the public folder before building the project. The Vite build process will automatically copy theses files to the static folder on each build of the frontend. The corresponding environment variables should then be set using a relative path such as static/<my image filename> to ensure that the frontend code can find them.

Feel free to fork this repository and make your own modifications to the UX or backend logic. You can modify the source (frontend/src). For example, you may want to change aspects of the chat display, or expose some of the settings in app.py in the UI for users to try out different behaviors. After your code changes, you will need to rebuild the front-end via start.sh or start.cmd.

Scalability

You can configure the number of threads and workers in gunicorn.conf.py. After making a change, redeploy your app using the commands listed above.

See the Oryx documentation for more details on these settings.

Debugging your deployed app

First, add an environment variable on the app service resource called "DEBUG". Set this to "true".

Next, enable logging on the app service. Go to "App Service logs" under Monitoring, and change Application logging to File System. Save the change.

Now, you should be able to see logs from your app by viewing "Log stream" under Monitoring.

Changing Citation Display

The Citation panel is defined at the end of frontend/src/pages/chat/Chat.tsx. The citations returned from Azure OpenAI On Your Data will include content, title, filepath, and in some cases url. You can customize the Citation section to use and display these as you like. For example, the title element is a clickable hyperlink if url is not a blob URL.

    <h5 
        className={styles.citationPanelTitle} 
        tabIndex={0} 
        title={activeCitation.url && !activeCitation.url.includes("blob.core") ? activeCitation.url : activeCitation.title ?? ""} 
        onClick={() => onViewSource(activeCitation)}
    >{activeCitation.title}</h5>

    const onViewSource = (citation: Citation) => {
        if (citation.url && !citation.url.includes("blob.core")) {
            window.open(citation.url, "_blank");
        }
    };

Best Practices

We recommend keeping these best practices in mind:

  • Reset the chat session (clear chat) if the user changes any settings. Notify the user that their chat history will be lost.
  • Clearly communicate to the user what impact each setting will have on their experience.
  • When you rotate API keys for your AOAI or ACS resource, be sure to update the app settings for each of your deployed apps to use the new key.
  • Pull in changes from main frequently to ensure you have the latest bug fixes and improvements, especially when using Azure OpenAI on your data.

A note on Azure OpenAI API versions: The application code in this repo will implement the request and response contracts for the most recent preview API version supported for Azure OpenAI. To keep your application up-to-date as the Azure OpenAI API evolves with time, be sure to merge the latest API version update into your own application code and redeploy using the methods described in this document.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

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.

When contributing to this repository, please help keep the codebase clean and maintainable by running the formatter and linter with npm run format this will run npx eslint --fix and npx prettier --write on the frontebnd codebase.

If you are using VSCode, you can add the following settings to your settings.json to format and lint on save:

{
    "editor.codeActionsOnSave": {
        "source.fixAll.eslint": "explicit"
    },
    "editor.formatOnSave": true,
    "prettier.requireConfig": true,
}

Trademarks

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.

sample-app-aoai-chatgpt's People

Contributors

a11057002 avatar abhahn avatar anushree1808 avatar ashatabak786 avatar bdschaap avatar blubern avatar davidm00 avatar dependabot[bot] avatar doliana avatar imicknl avatar iseabock avatar jessicawrr avatar johanneskaiser894 avatar kazuonuki avatar lordlinus avatar markjbrown avatar mhurst-microsoft avatar microsoftopensource avatar nrobert avatar pamelafox avatar ruoccofabrizio avatar samleegithub avatar sarah-widder avatar satarupaguha11 avatar slreznit avatar sophiegarden avatar toothache avatar vkrd avatar vsunnyzhao avatar wangyuantao 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

sample-app-aoai-chatgpt's Issues

Base URL is wrong

I get the following error:

Error
Error communicating with OpenAI: HTTPSConnectionPool(host='MYACCOUNT.openai.azure.com', port=443): Max retries exceeded with url: //openai/deployments/MYDEPLOYMENT/chat/completions?api-version=2023-03-15-preview (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7f00b540b670>: Failed to resolve 'MYACCOUNT.openai.azure.com' ([Errno -2] Name or service not known)"))

in the code the following is wrong I think:
chatgpt_url = f"https://{AZURE_OPENAI_RESOURCE}.openai.azure.com/openai/deployments/{AZURE_OPENAI_MODEL}"

the Base URL in my cognitive service is the following and does not match the url mentioned before:
"https://westeurope.api.cognitive.microsoft.com/"

please enable hit highlighting!

After creating index and uploading documents to it , when I am using it with chat app it was giving :"please enable hit highlighting!"

Adding new pages with different search indexers

Hi

I'm customising this as a deployment that we're looking to use against our documentations.

In our search services we have multiple indexers against different sources.

It wouldn't be difficult to add more variables and update the flask app.py, but I'm not familiar with react (I assume it's react?), or tsx.

Is there any way to add new pages that are accessible which would load new chat pages referencing different search indexers?

I would also like to add new pages to add things about Responsible AI, disclaimers and the likes as well.

Is this possible? Thanks

Different citations/references ways

When deploying locally, I got the following citations/references at the end of answer:

For more detailed information about the [ABC] and its components, you can refer to the documentation provided in the retrieved documents 1 .
Please let me know if you have any more questions!
1 reference:

But when deploying online, for the same question, I got the following citations/references at the end of answer:

For more details and visual references, you can refer to the ABC document and the accompanying images.
Please let me know if there's anything else I can help with!

No reference show up for online deployment, and the ABC document link (https://onlineurl/#doc2) actually does not exist, it should be listed as reference like locally.

Not all answers online have this problem, some of them have this problem and some of them have the same behaviour like locally. How to make it always show references, not show these no exist #doc1, #doc2 links

data.temperature must be valid exactly by one definition (0 matches found)

We deployed the sample bot using one click, "Deploy to Azure," and it was terrific for the last few days. We added new data sources, and the preview works fine, but once deployed to the resource, we now get the error.

data.temperature must be valid exactly by one definition (0 matches found) but the /conversation request returns a 200.

Assuming there are constant updates to this preview, what recently changed to make this happen?

We deployed the GPT-4 model and blob storage as a data source.

image

The API deployment for this resource does not exist.

I am getting below error while send chat query

openai.error.InvalidRequestError: 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 added below variables in .env with correct values
AZURE_OPENAI_RESOURCE= AZURE_OPENAI_MODEL= AZURE_OPENAI_KEY=

Using data source results in ignored system message

The system message seems to be completely ignored as soon as a data input is given, meaning the persona of the bot goes back to default.

Simple system messages such as "you reply in only one word" work fine until a dataset is attached, at which point the default response goes back to 'Hello! I'm here to help you with any questions you may have. Please feel free to ask anything.' no matter what the system message.

data_preparation.py should support Word/PPT file format (docx pptx)

Currently, On Your Data UI feature is not support local language analyzer. So users need to prepare for indexes using data_preparation.py. However, it looks not support Word/PPT format as FILE_FORMAT_DICT in data_utils.py doesn't have Word/PPT format.

I think supported data format should along with the page " https://learn.microsoft.com/en-us/azure/cognitive-services/openai/concepts/use-your-data#data-formats-and-file-types " even for data_preparation.py.

Localhost windows debug error: Failed to load module script

Blank page in homepage when running on windows localhost with console error:

Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/plain". Strict MIME type checking is enforced for module scripts per HTML spec.

Environment

Windows 10 22H2 19045.3086
Chrome 114.0.05735.199
npm 9.5.0
Python 3.11.3
Virtual Env (by vscode)
vscode insiders 1.80

Reproduce

cd frontend
npm install
npm build run
cd ..
py -m flask run --port=5000 --host=127.0.0.1 --reload --debug

Expected behaviour

ChatGPT opens with chat prompt

Actual behaviour

When debugging locally on a windows machine
After starting the flask server a blank page opens in the browser. dev tools reports error in console
Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/plain". Strict MIME type checking is enforced for module scripts per HTML spec.

Workaround

Update app.py with following before the flask import (line 6)

import mimetypes
mimetypes.add_type('application/javascript', '.js')
mimetypes.add_type('text/css', '.css')

Background

I was running a local clone of the repo vscode to update the style and branding before deploying to our Azure Web App for internal proof of concept.

Missing fonts

It looks like the web app is trying to use fonts that aren't generally available. I would suggest to look into picking a common fallback font, or using a web font.

image

Running the same container in AKS instead of WebApp

@sarah-widder
How about creating the same deployment in AKS, should a separate solution be created for that or can this repo be extended to include an AKS deployment as well? This should be not difficult to implement, given there's already a dockerfile ready with all the dependencies.
I'm not completely sure about the authentication layer though, need to look closer.

Logout icon and User details

Would be nice to have the 2 below addons:

  • a logout icon to force the sign-out of the session
  • the user icon with his profile (similar to what we can see on any of the azure or M365 pages) getting the Picture of the User that is stored in Azure AD

Creation index using blob containers

Hello. I'm trying to create an index using files stored in a blob container. However, when running the create script, a message is being displayed that the path to the blob cannot be found. On the other hand, when the files are stored in a local directory, such as "c:\data\test", the files are found and the index is successfully created. I wonder if the index creation scripts are prepared to find files that are in a blob?

Microsoft Word and PowerPoint support?

Documentation says this supports MS Word and PowerPoint. Tried uploading .doc file and search index built has 0 data.

Please validate?

./scripts/datautils.py looks like only the ff filetypes is supported.

FILE_FORMAT_DICT = {
        "md": "markdown",
        "txt": "text",
        "html": "html",
        "shtml": "html",
        "htm": "html",
        "py": "python",
        "pdf": "pdf"
    }

Also logged this issue

Chat history and user management

Hi,

Thanks for the great work.

I am wondering if there are any plans of moving the Azure Active Directory (AD) into the app, and building a per AD-user conversation archive just like we know it from the OpenAI ChatGPT interface.

At the moment the AD seems to be done by an API gateway, and further for data persistence across sessions also some database would need to be integrated. We are implementing this into our organization and are considering such functionality, or are you lot already working on it? Is it in your backlog?

Also, which of the Microsoft implementations should we bet on? This repository or the one over here? Is one being deprecated over time?

Thanks, and all the best,
Rasmus

Using Chat GPT-4 - Location: Canada EST

Hi

I'm trying to run the scripts to use the Chat GPT-4 that was released for our subscription being the local Canada EST, but we are not able to create it through the execution of the scripts because it presents the following message when creating the OpenAI service: Sku Standard not allowed .
In the documentation it mentions changing the parameters AZURE_FORMRECOGNIZER_SKU_NAME, AZURE_SEARCH_SKU_NAME and AZURE_OPENAI_SKU_NAME to Premium does not allow the creation, also informing that the SKU is not allowed.
The parameters were configured in this way:

azd env set AZURE_FORMRECOGNIZER_SKU_NAME v2 P1V2
azd env set AZURE_SEARCH_SKU_NAME Premium
azd env set AZURE_OPENAI_SKU_NAME v2 P1V2

The Playground allows you to create the OpenAI service for Canada EST.
Could you help me with this question?

BUG: Getting quota errors in webApp but not in the playground

Hello!
I'm getting this error in webApp everytime upon 2nd message (the 1'st one is fine):

Error
Requests to the Creates a completion for the chat message Operation under Azure OpenAI API version 2023-03-15-preview have exceeded token rate limit of your current OpenAI S0 pricing tier. Please retry after 7 seconds. Please go here: https://aka.ms/oai/quotaincrease if you would like to further increase the default rate limit.

But via Azure Studio OpenAI playground everything is working fine for the same deployment/model -- I can ask 10 question in a row, no issues. Why is that happening? Why "Completion" and not "prompt"?

I've tried with different models, ie 3.5-turbo, gpt-4, new and old, everywhere it is the same. Currently used model is 0301 3.5-turbo in west europe. My token limit is set to 7K.

P.S.
I'm actually running the image in the kubernetes cluster not in WebApp, but I guess it shouldn't make any difference in this case.

API is not getting my datasource citations

Hi,

I already raised two bugs on Azure support but no solutions yet.

We have implemented the same code as you have on the app.py file, tested on Postman and then moved to a C# code.

Since this week, no citations have been displayed which is weird because the app worked early this month without changes.

I'm using this API below.
https://[OPEN_AI].openai.azure.com/openai/deployments/gpt-4/extensions/chat/completions?api-version=2023-06-01-preview

The chat playground is working, but when I deploy it as an Azure Web App, there are no documents/answers (same question). And my API neither.

image

Issue in Frontend while testing on windows platform locally Due to Streaming

I encountered an error while attempting to set up a tool locally on a Windows platform. The error message "Failed to load resource: net::ERR_INVALID_CHUNKED_ENCODING" appeared in the console log when I used the "start.cmd" command to initiate the application locally.

Here's a screenshot of console log displaying the error:
image

I'm seeking assistance from the following users: @pamelafox @satarupaguha11 @sarah-widder @ruoccofabrizio.

If anyone has encountered this issue before or knows how to resolve it for windows platform locally, I would greatly appreciate your help and guidance.

Thank you!

Data Preparation failed with --form-rec-use-layout

Hi there,
I have a bunch of pdfs to be embedded by using data_preparation.py.
It can be converted successfully with the default setting:
python data_preparation.py --config config.json --njobs=4 --form-rec-resource <form-rec-resource-name> --form-rec-key <form-rec-key>
Since, in my pdfs, I have lots of tales inside, in your doc, it is recommended to pass in the argument --form-rec-use-layout.
However, the console comes with different errors for different pdfs:

File (./output/xxxx1.pdf) failed with  'pageFooter'
  7%|▋         | 19/261 [00:39<04:16,  1.06s/it]File (./output/xxxx2.pdf) failed with  'pageHeader'
 12%|█▏        | 32/261 [01:01<07:04,  1.85s/it]File (./output/xxxx3.pdf) failed with  'pageNumber'
 18%|█▊        | 48/261 [01:27<06:04,  1.71s/it]File (./output/xxxx4.pdf) failed with  'pageFooter'

Can anyone help to explain why this happens? Thanks.

Web app crash when asking problem outside of doc scope

I like this app sample, it is very helpful. But recently, I met some issues, when I ask some common questions out of the document scope, the app will be stuck for a long time, and then prompt error information. Then I must reload the web page to get it work again. I have tried stop generating and resubmit the question, but it will hang there no response.
My settings,
I use my own index and indexer within 3 small one-page pdf files for test (no file chunk):
AZURE_OPENAI_TEMPERATURE: 0.2
SEARCH_INDEX_IS_PRECHUNKED: false
AZURE_SEARCH_USE_SEMANTIC_SEARCH: true

When I check from web explorer tools, I found something as following:
Could you please help me to check it? Thank you very much.
/********************************
TypeError: Cannot read properties of undefined (reading '0') at https://XXX.azurewebsites.net/assets/index-97ad713f.js:108:69 at Array.forEach () at y (https://xxx.azurewebsites.net/assets/index-97ad713f.js:108:4)
message
:
"Cannot read properties of undefined (reading '0')"

obj
:
"{"error": "Expecting value: line 1 column 1 (char 0)"}"

Responds in english even though "own data" and questions are in danish

I've fed some pdf documents in danish into the search service and configured this sample project to use the index with chatgpt-35-turbo. I then ask questions in danish and to begin with it answers back in danish. Then at some point it starts answering in english!

There doesn't seem to any pattern to this. The english replys are still correct in the sense that they corresponds with the contents of the documents, although translated.

Any idea what's up with this?

Clearer Instructions on how to turn off authentication

Hello,

I am trying to change the authentication on the app, so anyone can access it, but it is confusing on how to do this. There is some documentation, but it does not tell you what exactly needs to be changed:

Add an identity provider
After deployment, you will need to add an identity provider to provide authentication support in your app. See this tutorial for more information.

If you don't add an identity provider, the chat functionality of your app will be blocked to prevent unauthorized access to your resources and data. To remove this restriction, or add further access controls, update the logic in getUserInfoList in frontend/src/pages/chat/Chat.tsx.

What logic in the Chat.tsx needs to be adjusted?

Conversation history not always give better results

If the first question was answered correctly, conversation history provides better results.
but if the first question was not answered properly, like it is something not in the data, the second answer behavior looks weird sometime:

  1. if the second question is in scope, and should be answered. but it affected by the first question, became could not answer question.
    Actual : it showed "I could not find any specific information about "" in the retrieved documents"
    Expected: answer the second question correctly (like there is no the first question)
  2. if the second question is not in scope, the second answer may include the first question keyword.
    Actual: like "I am sorry, but I could not find any information about (the first question keyword) from the retrieved documents."
    Expected: say "I could not find any information about (the second question keyword) from the retrieved documents"

This is not always happening. Sometime the behavior like above, sometime behavior is better. Not sure why.

Allow disabling identity provider requirement with an environment variable

Disabling identity provider authentication through an environment variable would be a great quality of life improvement.

Doing it manually in the code itself is easy, but also seems to require a bunch of additional steps to set up a new pipeline, hosting a new Docker image or manually getting the code onto an Azure Web App.

Unable to update front end UI

I am trying to update the front UI but Azure web app doesn’t receive any update, although it shows success in the deployment center.

I have tried with GitHub actions and codespace ( Az command) but still it’s the same. Did anyone face this issue?

thanks for sharing :)

Must provide an 'engine' or 'deployment_id' parameter

Provided all the .env values but receive the following error when sending a question in the chat.

AZURE_OPENAI_KEY="123"
AZURE_OPENAI_MODEL="abc"
AZURE_OPENAI_MODEL_NAME="gpt-35-turbo"
AZURE_OPENAI_RESOURCE="abc"

The WebUI starts as expected, but after clicking the send button the following error occurs:
openai.error.InvalidRequestError: Must provide an 'engine' or 'deployment_id' parameter to create a <class 'openai.api_resources.chat_completion.ChatCompletion'>

Vector Search

Hello here!

Any plans to release a new version to support Cognitive Search Vector Search? This would be a huge improvement.

Thanks again!

quota limit on cli deployment

I keep getting this :
The specified capacity '1' of account deployment is bigger than available capacity '0' for UsageName 'Tokens Per Minute (thousands) - GPT-35-Turbo'. (Code: InsufficientQuota)

How to overcome it ?

Error encountered while running project after sending 'Hi' message

I am trying to run this project, but I encountered an error after sending the "Hi" message.

Error

HTTPSConnectionPool(host='https', port=443): Max retries exceeded
with url: //dummy.openai.azure.com/.openai.azure.com/openai/deployments/dummy-gpt-35-turbo/extensions/chat/completions?api-version=2023-03-15-preview
(Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x0000017BFF2529B0>: Failed to resolve 'https' ([Errno 11001] getaddrinfo failed)"))

I have set the following parameters in my app.py

ACS Integration Settings

AZURE_SEARCH_SERVICE = ""
AZURE_SEARCH_INDEX = ""
AZURE_SEARCH_KEY =""

AOAI Integration Settings

AZURE_OPENAI_RESOURCE = ""
AZURE_OPENAI_MODEL = ""
AZURE_OPENAI_KEY = ""

Note

My Azure Open AI chatplayground working fine with my data

Creating an index using files with .docx and .pptx extensions

Hi
When trying to create the index (using the command: python data_preparation.py --config config.json --njobs=4) using .docx and .pptx files, the following message appears:
raise Exception("No chunks found. Please check the data path and chunk size.")
Are the scripts prepared to create index with these types of files?

authentication and user Info

authentication is great and simple to put in place using the authentication menu in the webapp.
but I can't find a simple way to get the identity of the connected user and display it in the interface and also send it to APIM

help will be appreciated :)

thanks in advance

Every 'deploy to azure' creates new App Registration

I'm using the Azure OpenAI Studio to deploy this app to a website. To update that website to the latest release, I suppose I need to use the 'update an existing web app', like the screenshot below.

image

Actual behaviour:

However when I do that, it creates a new App Registration. This is polluting my Azure AD / Entra ID. Also as I've setup a custom domain for my website, I need to modify this App Registration to add a callback url for the Azure AD authentication flow.

Expected behaviour:

The new release is deployed to my web application, and the existing app registration is re-used. I don't have to configure the custom domain as a callback url.

Error Expecting value: line 1 column 1 (char 0)

At the moment with the latest commit (de20819), the conversation always ends with a timeout I assume (after waiting for half a minute for an answer):

Error
Expecting value: line 1 column 1 (char 0)

I guess that error happens due to trying to parse something as json which is not json.
The error sometimes happens right after the first message, sometimes I have more time (messages).

Reproducible Crash

The example code works very well. However, we have found that simply chatting with the app for a small number of back and forths, say less than 10, that have any amount of text causes the web app to hang. Once it is hung you must restart the app in order to get the app to respond. If you ask a question, get a response and then clear each time it doesn't seem to have an issue. It seems to suggest that the app may not be handling token limits correctly?

Unclear how /extensions/chat/completions does the retrieval behind the scenes

I have failed to understand from the documentation how the "/deployments/{deployment-id}/extensions/chat/completions" endpoint interacts with Cognitive Search behind the scenes.
The background is I'm trying to understand what flexibility it offers and what it would take to implement the retrieval and integration of documents into the LLM's prompt manually if we want to change something.

What Cognitive Search endpoint does the extension call and with what parameters? Here's an example of an API request I sent myself to try reproducing the top 5 results within the tool citations

curl --location 'https://[deployment].search.windows.net/indexes/[index]/docs/search?api-version=2023-07-01-Preview' \
--header 'Content-Type: application/json' \
--header 'api-key: [key]' \
--data '{  
     "queryType": [I tried full, simple and semantic here, semantic with different settings for other required parameters]
     "search": "[question text]",  
     "top": 5
   }  '

I am getting the same documents back as in the Search Explorer for Cognitive Search in the Azure portal, but they are different from what comes back from the extensions/chat/completions request. The relevance scores are sometimes the same for the same chunks, but sometimes also different. Could you unveil why that happens?

Is it correct that no embeddings are used in the document retrieval as implemented in the Azure OpenAI playground and this sample app?

Is there more system text hidden away somewhere instructing the model to look at the sources and provide references in this [doc1] format? How would we go about modifying that if we are not happy with the citation accuracy?

what is max_tokens for gpt-35-turbo-16k?

offical doc mention max_tokens (AZURE_OPENAI_MAX_TOKENS) is 1500. gpt-35-turbo-16k

Actually if I increase it 10000, it still works with gpt-35-turbo-16k model and the answer is much better. But after running few questions, I got the following errors:

424, message='Failed Dependency', url=URL('https://aoai-gpt-35-turbo-use-prod-0613.eastus.inference.ml.azure.com/v1/engines/gpt-35-turbo-16k/chat/completions?api-version=2023-06-01-preview')
Call to LLM failed.

how to increase the max_token?

Error in cognitive search with gpt-35-turbo-16k model

Getting below error
Invalid AzureCognitiveSearch configuration detected: 403 Client Error: Forbidden for url: https://mysearch.search.windows.net/indexes/mykb?api-version=2021-04-30-Preview

when i checked in cogintive search explorer url shows like
https://mysearch.search.windows.net/indexes/mykb/docs?api-version=2021-04-30-Preview

onedeploy to azure webapp not working

as the FrontEnd use npm install / npm run build which not available in azure app python image , please consider release a public ACR / dockerhub image so customer can use to play with .

Also suggest to add a azure_startup.sh for setup the env in azure app .
start.cmd/start.sh looks only work in local (binded to localhost: 127.0.0.1).

image

Localization

Hello! I'm trying to modify the landing page to another language (pt-br). For example, we would like to change "Start Chatting" to "Faça a sua Pergunta", and other page details.
We are deploying the solution through Azure OpenAI Playground, clicking on "Deploy to Web App" button.
Any chance to modify the source files through FTP or VSCode, directly on Azure Web App?

Thanks in advance!

Support for Function Calling

Hi, and first of all, thanks for this great project!

I'd like to know if you already have implementing function calling on your roadmap? Even so I'm sure that it's not easy to think about a very general solution that makes sense for a shared project like this.

Best,

Ruben

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.