Git Product home page Git Product logo

azure-samples / contoso-chat Goto Github PK

View Code? Open in Web Editor NEW
397.0 24.0 2.3K 21.81 MB

This sample has the full End2End process of creating RAG application with Prompt Flow and AI Studio. It includes GPT 3.5 Turbo LLM application code, evaluations, deployment automation with AZD CLI, GitHub actions for evaluation and deployment and intent mapping for multiple LLM task mapping.

License: MIT License

Python 2.35% Jupyter Notebook 48.74% Dockerfile 0.39% Bicep 45.83% Shell 2.08% PowerShell 0.61%
ai-azd-templates azd-templates azure-ai-search azure-ai-services azure-ai-studio azure-cosmosdb azure-openai-service copilot-tutorial llmops contoso-chat

contoso-chat's Introduction

name description languages products page_type urlFragment
Contoso Chat Retail with Azure AI Studio and Promptflow
A retail copilot that answers customer queries with responses grounded in retailer's product and customer data.
python
bicep
azdeveloper
prompty
azure-openai
azure-cognitive-search
azure
azure-cosmos-db
sample
contoso-chat

Contoso Chat Retail with Azure AI Studio and Promptflow

This sample creates a customer support chat agent for an online retailer called Contoso Outdoors. The solution uses a retrieval-augmented generation pattern to ground responses in the company's product and customer data. Customers can ask questions about the retailer's product catalog, and also get recommendations based on their prior purchases.

Open in GitHub Codespaces Open in Dev Containers


About This Sample

In this sample we build, evaluate and deploy a customer support chat AI for Contoso Outdoors, a fictitious retailer who sells hiking and camping equipment. The implementation uses a Retrieval Augmented Generation (RAG) architecture to implement a retail copilot solution that responds to customer queries with answers grounded in the company's product catalog and customer purchase history.

The sample uses Azure AI Search to create and manage search indexes for product catalog data, Azure Cosmos DB to store and manage customer purchase history data, and Azure OpenAI to deploy and manage the core models required for our RAG-based architecture.

By exploring and deploying this sample, you will learn to:

Table of Contents

  1. Features
  2. Getting Started
  3. Azure Deployment
  4. Local Development
  5. Guidance
  6. Troubleshooting
  7. Resources
  8. Contributing
  9. Trademarks

Features

The project comes with:

  • Sample model configurations, chat and evaluation prompts for a RAG-based copilot app.
  • Prompty assets to simplify prompt creation & iteration for this copilot scenario.
  • Sample product and customer data for the retail copilot scenario.
  • Sample application code for copilot chat and evaluation workflows.
  • Sample azd-template configuration for managing the application on Azure.
  • Managed Identity configuration as a best practice for managing sensitive credentials.

This is also a signature sample for demonstrating new capabilities in the Azure AI platform. Expect regular updates to showcase cutting-edge features and best practices for generative AI development.

Architecture Diagram

The Contoso Chat application implements a retrieval augmented generation pattern to ground the model responses in your data. The architecture diagram below illustrates the key components and services used for implementation and highlights the use of Azure Managed Identity to reduce developer complexity in managing sensitive credentials.

Architecture Diagram

Demo Video

๐ŸŒŸ | Watch for a video update showing how easy it is to go from code to cloud using this template and the Azure Developer CLI for deploying your copilot application.

Versions

This has been the signature sample used to showcase end-to-end development of a copilot application code-first on the Azure AI platform. It has been actively used for training developer audiences and industry partners at key events including Microsoft AI Tour and Microsoft Build. Use the links below to reference specific versions of the sample corresponding to a related workshop or event session.

Version Description
v0 : #cc2e808 Microsoft AI Tour 2023-24 (dag-flow, jnja template) - Skillable Lab
v1 : msbuild-lab322 Microsoft Build 2024 (dag-flow, jnja template) - Skillable Lab
v2 : main Latest version (flex-flow, prompty asset)- Azure AI Template

Getting Started

Pre-Requisites

You will also need:

Setup Environment

You have three options for getting started with this template:

  • GitHub Codespaces - Cloud-hosted dev container (pre-built environment)
  • VS Code Dev Containers - Locally-hosted dev container (pre-built environment)
  • Manual Setup - Local environment setup (for advanced users)

We recommend using GitHub Codespaces for the fastest start with least effort. However, we have provided instructions for all three options below.

1. GitHub Codespaces

  1. Click the button to launch this repository in GitHub Codespaces.

    Open in GitHub Codespaces

  2. This opens a new browser tab with setup taking a few minutes to complete. Once ready, you should see a Visual Studio Code editor in your browser tab, with a terminal open.

  3. Sign into your Azure account from the VS Code terminal

    azd auth login --use-device-code

2. VS Code Dev Containers

This is a related option that opens the project in your local VS Code using the Dev Containers extension instead. This is a useful alternative if your GitHub Codespaces quota is low, or you need to work offline.

  1. Start Docker Desktop (install it if not already installed)

  2. Open the project by clickjing the button below:

    Open in Dev Containers

  3. Once ready, the tab will refresh to show a Visual Studio Code editor with a terminal open.

  4. Sign into your Azure account from the VS Code terminal

    azd auth login

3. Manual Setup (Local)

  • Verify you have Python3 installed on your machine.

  • Install dependencies with pip install -r requirements.txt

  • Install Azure Developer CLI

    • Windows: winget install microsoft.azd
    • Linux: curl -fsSL https://aka.ms/install-azd.sh | bash
    • MacOS: brew tap azure/azd && brew install azd
  • Sign into your Azure account from the VS Code terminal

    azd auth login

Azure Deployment

  1. Use the same terminal where you previously authenticated with Azure.

  2. Provision and deploy your application to Azure. You will need to specify a valid subscription, deployment location, and environment name.

    azd up
  3. This step will take some time to complete.

    • Visit the Azure Portal to monitor progress.
    • Look for a new resource group matching the environment name
    • Click Deployments to track the status of the provisioning process
  4. Once provisioning completes, monitor progress for app deployment.

    • Visit the Azure AI Studio
    • Look for an AI Project associated with the above resource group
    • Click Deployments to track the status of the application deployment
  5. Once deployment completes, test the deployed endpoint from Azure AI Studio

    • Click the newly-created chat-deployment-xx endpoint listed
    • In the details page, click the Test tab for a built-in testing sandbox
    • In the Input box, enter a new query in this format and submit it:
      {"question": "Tell me about hiking shoes", "customerId": "2", "chat_history": []}
      
    • If successful, the response will be printed in the area below this prompt.

You can find your deployed retail copilot's Endpoint and Primary Key information on the deployment details page in the last step. Use them to configure your preferred front-end application (e.g., web app) to support a customer support chat UI capability that interacts with the deployed copilot in real time.

Local Development

Exploring the Prompty Asset

This sample contains an example chat.prompty asset that you can explore, to understand this new capability. The file has the following components:

  1. A frontmatter section that defines the following attributes:
    • name of the application
    • description of the application functionality
    • authors of the application (one per line)
    • model description (with these parameters)
      • api type of endpoint (can be chat or completion)
      • configuration parameters including
        • type of connection (azure_openai or openai)
        • environment variables (e.g., azure_deployment for chat model)
      • parameters (max_tokens, temperature, response_format)
    • inputs - each with type and optional default value
    • outputs - specifying a type (e.g., string)
    • sample - an example of the inputs (e.g., for testing)
  2. A system context (defining the agent persona and behavior)
    • #Safety section enforcing responsible AI requirements
    • #Documentation section with template for filling product documentation
    • #Previous Orders section with template for filling relevant history
    • #Customer Context section with template for filling customer details
    • question section to embed user query
    • Instructions section to reference related product recommendations

This specific prompty takes 3 inputs: a customer object, a documentation object (that could be chat history) and a question string that represents the user query. You can now load, execute, and trace individual prompty assets for a more granular prompt engineering solution.

Testing the Application Flow

This sample uses a flex-flow feature that lets you "create LLM apps using a Python class or function as the entry point" - making it easier to test and run them using a code-first experience.

  • This sample implements a Function based flow
  • The entry point is the get_response functionin chat_request.py

You can now test the flow in different ways:

  • Run it directly, like any Python script
  • Convert it to a flow, then use pf flow test --flow ...
  • Start a UI to chat with the flow using pf flow test --flow ... --ui

๐ŸŒŸ | Watch this space for more testing guidance.

Guidance

Region Availability

This template uses gpt-35-turbo for chat completion, gpt-4 for chat evaluation and text-embedding-ada-002 for vectorization. These models may not be available in all Azure regions. Check for up-to-date region availability and select a region accordingly.

This template uses the Semantic Ranker feature of Azure AI Search which may be available only in certain regions. Check for up-to-date region availability and select a region accordingly.

  • We recommend using sweden-central for the OpenAI Models
  • We recommend using eastus for the Azure AI Search Resource

Note

The default azd deploy takes a single location for deploying all resources within the resource group for that application. We set the default Azure AI Search location to eastus (in infra/ configuration), allowing you to now use the default location setting to optimize for model availability and capacity in region.

Costs

Pricing for services may vary by region and usage and exact costs cannot be estimated. You can estimate the cost of this project's architecture with Azure's pricing calculator with these services:

  • Azure OpenAI - Standard tier, GPT-4, GPT-35-turbo and Ada models. See Pricing
  • Azure AI Search - Basic tier, Semantic Ranker enabled See Pricing
  • Azure Cosmos DB for NoSQL - Serverless, Free Tier See Pricing

Security

This template uses Managed Identity for authentication with key Azure services including Azure OpenAI, Azure AI Search, and Azure Cosmos DB. Applications can use managed identities to obtain Microsoft Entra tokens without having to manage any credentials. This also removes the need for developers to manage these credentials themselves and reduces their complexity.

Additionally, we have added a GitHub Action tool that scans the infrastructure-as-code files and generates a report containing any detected issues. To ensure best practices we recommend anyone creating solutions based on our templates ensure that the Github secret scanning setting is enabled in your repo.

Resources

Troubleshooting

Have questions or issues to report? Please open a new issue after first verifying that the same question or issue has not already been reported. In the latter case, please add any additional comments you may have, to the existing issue.

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.

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.

contoso-chat's People

Contributors

alexravenna avatar amynic avatar anderl80 avatar anfibiacreativa avatar cassiebreviu avatar jongio avatar luigiw avatar microsoft-github-operations[bot] avatar microsoft-github-policy-service[bot] avatar microsoftopensource avatar nitya avatar pamelafox avatar revodavid avatar sethjuarez avatar tonybaloney 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

contoso-chat's Issues

Acceptance criteria checklist (DoD)

The following checklist must be complete before a template is published.

Repository Management

Source code structure and conventions

  • GitHub Actions (This refers to .github/workflows/azure-dev.yml or custom workflow to run on a GitHub runner) is in place
  • DevContainer (/.devcontainer folder where applicable) configuration is in place
  • Infrastructure as code is in place (/infra folder where applicable, manifest files or code generators in the case of Aspire and similar )
  • Azure services configuration (/azure.yml file) is in place
  • Minimum coverage tests are in place

Functional requirements

  • azd up successfully provisions and deploys a functional app
  • GitHub Actions run tasks without errors
  • DevContainer has been tested locally and runs
  • Codespaces run [locally and in browser]
  • All tests pass

In the absence of e2e tests,

  • The application has been manually tested to work as per the requirement

Security requirements

When a service selected doesn't support Managed Identity, the corresponding issue must have been reported and the security considerations section in the readme, should clearly explain the alternatives.

  • Azure Key Vault is a preferred alternative

The following items are not strictly enforced but may prevent the template from being added to the gallery.

Project code follows standard structure, per language. Please check one.

  • Yes, follows standards
  • No, doesn't follow standards

Code follows recommended style guide

  • Yes, follows style guide
  • No, doesn't follow style guide

Azure Developer CLI Template Guidelines

Azure Developer CLI Template Guidelines

These requirements are for samples that are using azd for deployment.

Code

Infra Folder

  • Bicep Format - Bicep files should be formatted with bicep format. Can possibly be automated with pre-commit or GitHub actions.

  • Core Modules - main.bicep should reference modules from core, copied from azure-dev.

    cp -r ../azure-dev/templates/common/infra/bicep/core/* infra/core/.

  • Dashboard - Resources should include a dashboard so that azd monitor works, either by referencing the monitoring.bicep module or creating a dashboard separately. See main.bicep

  • Monitoring - Application code should include either OpenCensus or OpenTelemetry so that the monitor is populated. See todo/app.py.

  • Managed Identity - Application must use Managed Identity instead of keys wherever possible.

Elsewhere

  • AZD Telemetry - azure.yaml should include metadata for telemetry including version number. See azure.yaml

  • Service Source - In azure.yaml, the project property for each service should point at a subfolder, not at root (.). Typically the subfolder is labeled src but that may vary. See azure.yaml

  • azd Pipeline Config - .github/workflows should include azure-dev.yaml to support azd pipeline config.

  • Devcontainer - .devcontainer should contain a devcontainer.json and Dockerfile/docker-compose.yaml in order to create a full local dev environment. Start with azure-dev versions and modify as needed. See docker-compose.yaml for example that includes a local database service.

  • security-devops-action - The application must run microsoft/security-devops-action. Example

  • ** Hook Scripts** - all hook scripts (pre-/post- provisioning and deployment scripts) shall include both sh and pwsh versions.

README.md

  • Short Description - a must description should be included. Example

  • Prerequisites - a Prerequisites section should be included. Example

  • Architecture - an architecture diagram and description must be included. Example

  • 'Open In __' buttons - must use same "Open in " buttons as the TODO samples. Example

  • Cost Estimation - a Cost Estimation section should be included. Example

Publicizing

Promptflow huggingface api swapping encounter template error issues for mixtral 7b

Hi I am using the prompt flow workshop branches, and when i was trying to integrate a hugging face serveless api into the promptflow, i encounter the issues specified below:

i added connections to the pfClient, and swapped the model in the flow.dag.yaml, when running the flow.dag.yaml file the error below occurs:
Screenshot 2024-06-12 at 12 30 35

First i added the connection in /connection/create-connections.ipynb

Screenshot 2024-06-12 at 12 36 27

from promptflow._sdk.entities._connection import ServerlessConnection
HF_KEY = 


HF_endpoints = {"meta_llama3_instruct_8B":"https://api-inference.huggingface.co/models/meta-llama/Meta-Llama-3-8B-Instruct","meta_llama3_instruct_70B":"https://api-inference.huggingface.co/models/meta-llama/Meta-Llama-3-70B-Instruct",
                "meta_llama3_8B":"https://api-inference.huggingface.co/models/meta-llama/Meta-Llama-3-8B","meta_llama3_70B":"https://api-inference.huggingface.co/models/meta-llama/Meta-Llama-3-70B",
                "gpt2":"https://api-inference.huggingface.co/models/openai-community/gpt2",
                "Phi_3_mini_4k_instruct":"https://api-inference.huggingface.co/models/microsoft/Phi-3-mini-4k-instruct","Phi_3_mini_128k_instruct":"https://api-inference.huggingface.co/models/microsoft/Phi-3-mini-128k-instruct",
                "google_gemma":"https://api-inference.huggingface.co/models/google/gemma-1.1-7b-it",
                "Mixtral": "https://api-inference.huggingface.co/models/mistralai/Mixtral-8x7B-Instruct-v0.1", "Mixtral7B":"https://api-inference.huggingface.co/models/mistralai/Mistral-7B-v0.1",
                "bge-small":"https://api-inference.huggingface.co/models/BAAI/bge-small-en","bge-large":"https://api-inference.huggingface.co/models/BAAI/bge-large-en-v1.5"}#{name:api_base}

for name, end_point in HF_endpoints.items():
    connection =ServerlessConnection(name=name,api_key=HF_KEY,api_base=end_point)
    print(f"Creating connection {connection.name}...")
    result = pf.connections.create_or_update(connection)
    print(result)

Then i run the Yaml file below
Yaml file:

environment:
  python_requirements_txt: requirements.txt
inputs:
  chat_history:
    type: list
    default: []
    is_chat_input: false
    is_chat_history: true
  question:
    type: string
    default: What can you tell me about your jackets?
    is_chat_input: true
    is_chat_history: false
  customerId:
    type: string
    default: "2"
    is_chat_input: false
    is_chat_history: false
outputs:
  answer:
    type: string
    reference: ${llm_response.output}
    is_chat_output: true
  context:
    type: string
    reference: ${retrieve_documentation.output}
nodes:
- name: question_embedding
  type: python
  source:
    type: package
    tool: promptflow.tools.embedding.embedding
  inputs:
    connection: aoai-connection
    input: ${inputs.question}
    deployment_name: text-embedding-ada-002
  aggregation: false
- name: retrieve_documentation
  type: python
  source:
    type: code
    path: retrieve_documentation.py
  inputs:
    question: ${inputs.question}
    index_name: contoso-products
    embedding: ${question_embedding.output}
    search: contoso-search
- name: customer_lookup
  type: python
  source:
    type: code
    path: customer_lookup.py
  inputs:
    customerId: ${inputs.customerId}
    conn: contoso-cosmos
- name: customer_prompt
  type: prompt
  source:
    type: code
    path: customer_prompt.jinja2
  inputs:
    documentation: ${retrieve_documentation.output}
    customer: ${customer_lookup.output}
    history: ${inputs.chat_history}
- name: llm_response
  type: llm
  source:
    type: code
    path: llm_response.jinja2
  inputs:
    deployment_name: gpt-35-turbo
    prompt_text: ${customer_prompt.output}
    question: ${inputs.question}
  connection: Mixtral7B
  api: chat

2024-06-12 12:30:48 +0100 74066 execution WARNING [llm_response in line 0 (index starts from 0)] stderr> Exception occurs: UnprocessableEntityError: Error code: 422 - {'error': 'Template error: template not found', 'error_type': 'template_error'}
2024-06-12 12:30:48 +0100 74066 execution WARNING [llm_response in line 0 (index starts from 0)] stderr> UnprocessableEntityError #4, but no Retry-After header, Back off 18 seconds for retry.

404 when 'Run All' local PromptFlow

I fiiled .env file with correct key and endpoint values in Azure Portal.
But when I run all local PromptFlow, it fails at 'text embedding' step.
I think that is OAI endpoint problem.

I'm in MS AI Tour Seoul 2024 now
Thank you, staffs

Batch run fails

In step "7. Evaluating prompt flow results", the cell with the contents pf_azure_client.stream(base_run) fails with an error. The error message in the Notebook is:

(Run status is 'NotStarted', continue streaming...)
(Run status is 'NotStarted', continue streaming...)
(Run status is 'NotStarted', continue streaming...)
(Run status is 'NotStarted', continue streaming...)
(Run status is 'NotStarted', continue streaming...)
(Run status is 'NotStarted', continue streaming...)
(Run status is 'NotStarted', continue streaming...)
(Run status is 'NotStarted', continue streaming...)
The run '2024_02_02_235111chat_base_run' is in status 'NotStarted' for 5 minutes, streaming is stopped.Please make sure you are using the latest runtime.
======= Run Summary =======
Run name: "2024_02_02_235111chat_base_run"
Run status: "NotStarted"
Start time: "None"
Duration: "None"
Run url: [REDACTED]

Checking the Run URL in AI Studio, the following error appears in promptflow-automatic.log:

Error       Failed to provision Automatic runtime, id: 4bdd38a060a1f0887395eafff8895f61bbc62444bc318e0f, error code: ValidationError/ValidationError, message: [docker.io/sethjuarez/contoso-store:v20240124.1] is not a valid name for an ACR image with tag specified.

azd up: Failed deployment of Failure-Anomalies-Alert-Rule-Deployment-xxx

This issue is for a: (mark with an x)

- [X] bug report -> please search issues before submitting

Minimal steps to reproduce

Launch CodeSpaces
Log into a personal Azure subscription with azd auth
azd up

Any log messages given by the failure

Failure reported for Deployment Failure-Anomalies-Alert-Rule-Deployment-95c29a3f in Azure Portal:

The subscription is not registered to use namespace 'Microsoft.AlertsManagement'. See https://aka.ms/rps-not-found for how to register subscriptions. (Code: MissingSubscriptionRegistration)

Expected/desired behavior

No deployment failures

Mention any other details that might be useful

Doesn't seem to cause any actual problems.

Error `Environment '{}' is not registered` when deploying Prompt Flow in Azure AI Studio and ML Studio

I tried deploying to 1 instance and to 3 and get the same error every time. Also tried selecting a different instance types. Also tried deploying in ML Studio instead of AI Studio.

Environment promptflow_a80*************************ab is not registered

There's a link in the log pointing here.

But I haven't figured out how to "register" the environment.
I can see the environment it refers to in ML Studio -> contoso-chat-aiproj -> Environments. It says "build failed". If I click the "Rebuild" button there, it rebuilds without error. But when I try to deploy the Prompt Flow, I always get the same error.

Here's the error message from ml.azure.com (I redacted part of my environment name in the two spots its shown):

Execution failed. User process 'python' exited with status code 1. Please check log file 'user_logs/std_log.txt' for error details. Error: Traceback (most recent call last):
  File "prepare.py", line 26, in <module>
    build_local_environment(args.name, args.version, args.platform)
  File "prepare.py", line 15, in build_local_environment
    environment.build_local(workspace, platform, useDocker=True, pushImageToWorkspaceAcr=True)
  File "/azureml-envs/image-build/lib/python3.8/site-packages/azureml/core/environment.py", line 1549, in build_local
    raise UserErrorException("Environment '{}' is not registered".format(self.name))
azureml.exceptions._azureml_exception.UserErrorException: UserErrorException:
	Message: Environment 'promptflow_a80*************************ab' is not registered
	InnerException None
	ErrorResponse 
{
    "error": {
        "code": "UserError",
        "message": "Environment 'promptflow_a80*************************ab' is not registered"
    }
}

Also these two warnings (redacted by Azure, not me):

AzureMLCompute job failed
ExecutionFailed: [REDACTED]
	exit_codes: 1
	Appinsights Reachable: Some(true)

Serverless job failed.

Here's what I see in the ML Studio notifications:
image

Also, I've been assuming that when I deploy the Prompt Flow, I do not have to use 3 instances? I've tried with 1 and with 3 and I get the same error with the same exact "not registered" environment in both cases.

Thank you!

Fill in the 'About' section for SEO

to improve SEO update from "No description, website, or topics provided." to something more meaningful.

Nicely written sample, you might want to make it easier for people to find it.

Bug in `create-azure-search.ipynb` building the endpoint

The ยด.envยด file suggests to only give the name of the created AI Search service - which is also needed by other code parts. Then, building the endpoint URL in the mentioned notebook fails. Suggest to change cell 3 in this notebook to (like it is already done in the other cells):

def delete_index(search_service: str, search_index: str, search_api_key: str):
    print(f"Deleting index {search_index} in {search_service}...")
    response = requests.delete(
        f"https://{search_service}.search.windows.net/indexes/{search_index}",
        headers={"api-key": search_api_key},
    )
    print(response.status_code)
    return response.status_code

Add pre-builds to aitour-fy25 branch

This issue is for a: (mark with an x)

- [X ] feature request

Minimal steps to reproduce

Launch a Codespace on the aitour-fy25 branch. It will take several minutes to build the codespace.

Expected/desired behavior

Launching the Codespace takes less than a minute

Mention any other details that might be useful

Enabling prebuilds on the branch should help

Deployment chat-deployment-1718994551 not found in endpoint

Trying to deploy service chat but keep getting the following error:

RESPONSE 404: 404 Not Found
ERROR CODE: UserError

{
"error": {
"code": "UserError",
"message": "Deployment chat-deployment-1718994551 not found in endpoint mloe-eqs2edvbximzo, workspace ai-project-eqs2edvbximzo",
"details": [],

  {
    "type": "MessageParameters",
    "info": {
      "value": {
        "deploymentName": "chat-deployment-1718994551",
        "endpointName": "mloe-eqs2edvbximzo",
        "workspaceName": "ai-project-eqs2edvbximzo"
      }
    }
  }

However, I checked the azure portal and I can see the deployment succeeded.

image

No module named 'promptflow.azure'

When running the "evaluate-chat-prompt-flow.ipynb" notebook in codespaces I get the following error..
Has something changed in this cell? I forked the latest version of the repo...
image

forked repo codespaces container can't build

The codespaces dev container can't provision properly when forking from this repo.
Logging here as problem seems to be specific to this repo.

How to Reproduce

  • Fork this repo
  • Create Codespaces on main

Image

You may also try creating codespaces on https://github.com/raffertyuy/fork-contoso-chat to reproduce.

Test attempts

Models gpt-3.5-turbo, gpt-4, and text-embedding-ada-002 not available?

I saw them yesterday, I'm sure. But now I don't see them. I don't know if it's an issue with the Sweden Central region or something else.
image

EDIT: After getting no hint of the problem anywhere else, I decided, like a cornered wild animal, to frantically click on every button I could find on ai.azure.com. I came across the "Explore" tab, where I found the "Model Catalog". There, I searched for gpt-35-turbo and found this:

Screenshot 2024-01-12 at 9 53 15 PM

I shall now continue clicking haphazardly until I can figure out whether its my subscription, or the region, that is preventing me from using this resource. Unless anyone has any tips. Thanks!

flow.dag.yaml Visual Editor Cannot Find question_embedding tool

I'm running this locally in VS Code using a venv. When I try to run the flow through the visual editor, it fails with AttributeError: 'EntryPoints' object has no attribute 'get'

In the visual editor, I see that the question_embedding node shows an error: "Can't find tool promptflow.tools.embedding.embedding
The package may not be installed in your Python environment."

I can see an embeddings.py file in my venv folder:
image

Here's a screen shot of the error in the PF visual editor in VS Code
image

InvalidRunStatusError When Running "evaluate-chat-prompt-flow.ipynb" notebook

I get the following error: InvalidRunStatusError: The input for batch run is incorrect. Input from key 'run.outputs' is an empty list, which means we cannot generate a single line input for the flow run. Please rectify the input and try again.

when I run this cell pf_azure_client.stream(eval_run_variant)

Can anyone tell me what I am missing?

image

Connection contoso-cosmos not found

Hi
I am trying to deploy the prompt flow to Azure AI Studio but when I run a test it indicates that the contoso-cosmos connection was not found, even though the connection is created, I attach the screen shots. Any idea how it can be solved?

Captura de pantalla prompt flow

Captura de pantalla Conexion cosmos

$RANDOM does not exist in `sh`

I tried setting up the project using azd up and I noticed that the endpointName var is not set correctly. This is because azd hooks only run in sh or pwsh and $RANDOM does not exist in sh.

Code reference

endpointName="contoso-chat-$RANDOM"

As a workaround, I've added my own random_number generator which does similar.

random_number=$(od -An -N2 -i /dev/urandom | awk '{print $1}')

Error during deployment

Get the below error when using push_and_deploy_pf.ipynb to deploy on the 'pf_azure_client.flows.create_or_update' step. Also notice the logs message is truncated so don't see full extent of what happened. Thoughts?

ResourceNotFoundError: (UserError) Please make sure that you are passing valid secret names and that the keyvault https://ainorthcentus/
Code: UserError
Message: Please make sure that you are passing valid secret names and that the keyvault https://ainorthcentus/

Provision script does not create Prompt Flow connections

Section 4.5 of README.md suggests that the prompt flow connections should have been created by ./provision.sh, but the output of pf connection list is empty.

The solution is as suggested, to open connections/create-connections.ipynb and run the notebook, which creates the required connections.

The README is missing the step to create a custom connection for Cosmos DB

Required to successfully run evaluate-chat-prompt-flow.ipynb

Creating Custom Connection (contoso-cosmos)

  1. Visit https://ml.azure.com instead
  2. Under Recent Workspaces, click project (contoso-chat-aiproj)
  3. Select Prompt flow (sidebar), then Connections (tab)
  4. Click Create and select Custom from dropdown
  5. Name: contoso-cosmos
  6. Provider: Custom (default)
  7. Key-value pairs: Add 4 entries (get env var values from .env)
  8. key: key, value: "COSMOS_KEY", check "is secret"
    1. key: endpoint, value: "COSMOS_ENDPOINT"
    2. key: containerId, value: customers
    3. key: databaseId, value: contoso-outdoor
    4. Click Save to complete step.

[Auto] AI Gallery Standard Validation FAILED

AI Gallery Standard Validation: FAILED

Repository Management:

  • README.md File.
  • LICENSE.md File.
  • SECURITY.md File.
  • CODE_OF_CONDUCT.md File.
  • CONTRIBUTING.md File.
  • ISSUE_TEMPLATE.md File.
  • Topics on repo contains ['azd-templates', 'ai-azd-templates'].

Source code structure and conventions:

  • azure-dev.yaml File.
  • azure.yaml File.
  • ./infra Folder.
  • .devcontainer Folder.

Functional Requirements:

  • azd up.
  • azd down.

Security Requirements:

  • microsoft/security-devops-action is integrated to the CI/CD pipeline.

  • โš ๏ธ Security scan. [How to fix?]

    Details
    • โŒ error: AZR-000280 - By default, public network access is enabled for a Cognitive Service account. Service Endpoints and Private Link can be leveraged to restrict access to PaaS endpoints. When access is restricted, access by malicious actor is from an unauthorized virtual network is mitigated.
      Configure service endpoints and private links where appropriate.

    • โŒ error: AZR-000282 - To send requests to Cognitive Services endpoints, each request must include an authentication header. Cognitive Services endpoints supports authentication with keys or tokens. Using an Azure AD token instead of a cryptographic key has some additional security benefits.
      With Azure AD authentication, the identity is validated against Azure AD identity provider. Using Azure AD identities centralizes identity management and auditing.
      Once you decide to use Azure AD authentication, you can disable authentication using keys.

    • โŒ warning: AZR-000283 - By default, a public endpoint is enabled for Cognitive Services accounts. The public endpoint is used for all access except for requests that use a Private Endpoint. Access through the public endpoint can be disabled or restricted to authorized virtual networks.
      Data exfiltration is an attack where an malicious actor does an unauthorized data transfer. Private Endpoints help prevent data exfiltration by an internal or external malicious actor. They do this by providing clear separation between public and private endpoints. As a result, broad access to public endpoints which could be operated by a malicious actor are not required.

    • โŒ error: AZR-000053 - API Management must authenticate to access Azure resources such as Key Vault. Use Key Vault to store certificates and secrets used within API Management.

    • โŒ error: AZR-000055 - API Management provides support for weak or deprecated ciphers. These older versions are provided for compatibility with clients and backends but are not consider secure. These many of these ciphers are enabled by default and need to be set to 'False'.
      The following ciphers are considered weak or deprecated:

      • TripleDes168
      • TLS_RSA_WITH_AES_128_CBC_SHA
      • TLS_RSA_WITH_AES_256_CBC_SHA
      • TLS_RSA_WITH_AES_128_CBC_SHA256
      • TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA
      • TLS_RSA_WITH_AES_256_CBC_SHA256
      • TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA
      • TLS_RSA_WITH_AES_128_GCM_SHA256.
    • โŒ error: AZR-000355 - By default, Key Vault accept connections from clients on any network. To limit access to selected networks, you must first change the default action.
      After changing the default action from Allow to Deny, configure one or more rules to allow traffic. Traffic can be allowed from:

      • Azure services on the trusted service list.
      • IP address or CIDR range.
      • Private endpoint connections.
      • Azure virtual network subnets with a Service Endpoint.

      If any of the following options are enabled you must also enable Allow trusted Microsoft services to bypass this firewall:

      • enabledForDeployment - Azure Virtual Machines for deployment.
      • enabledForDiskEncryption - Azure Disk Encryption for volume encryption.
      • enabledForTemplateDeployment - Azure Resource Manager for template deployment.
    • โŒ error: TA-000023 - To ensure that only applications from allowed networks, machines, or subnets can access your cluster, restrict access to your Kubernetes Service Management API server. It is recommended to limit access to authorized IP ranges to ensure that only applications from allowed networks can access the cluster.

    • โŒ error: AZR-000022 - To capture security-based audit logs from AKS clusters, the following diagnostic log categories should be enabled:

      • kube-audit or kube-audit-admin, or both.
        • kube-audit - Contains all audit log data for every audit event, including get, list, create, update, delete, patch, and post.
        • kube-audit-admin - Is a subset of the kube-audit log category.
          kube-audit-admin reduces the number of logs significantly by excluding the get and list audit events from the log.
      • guard - Contains logs for Azure Active Directory (AAD) authorization integration.
        For managed Azure AD, this includes token in and user info out. For Azure RBAC, this includes access reviews in and out.
    • โŒ error: AZR-000029 - AKS-managed integration provides an easy way to use Azure AD authorization for AKS. Previous Azure AD integration with AKS required app registration and management within Azure AD.

    • โŒ error: AZR-000030 - In Kubernetes, the API server is the control plane of the cluster. Access to the API server is required by various cluster functions as well as all administrator activities.
      All activities performed against the cluster require authorization. To improve cluster security, the API server can be restricted to a limited set of IP address ranges.
      Restricting authorized IP addresses for the API server has the following limitations:

      • Requires AKS clusters configured with a Standard Load Balancer SKU.
      • This feature is not compatible with clusters that use Public IP per Node.
      • This feature is not compatible with AKS private clusters.

      When configuring this feature, you must specify the IP address ranges that will be authorized. To allow only the outbound public IP of the Standard SKU load balancer, use 0.0.0.0/32.
      You should add these ranges to the allow list:

      • Include output IP addresses for cluster nodes
      • Any range where administration will connect to the API server, including CI/CD systems, monitoring, and management systems.
    • โŒ error: AZR-000032 - Azure Kubernetes Service (AKS) supports Role-based Access Control (RBAC). RBAC is supported using Kubernetes RBAC and optionally Azure RBAC.

      • Using Kubernetes RBAC, you can grant users, groups, and service accounts access to cluster resources.
      • Additionally AKS supports granting Azure AD identities access to cluster resources using Azure RBAC.

      Using authorization provided by Azure RBAC simplifies and centralizes authorization of Azure AD principals. Access to Kubernetes resource can be managed using Azure Resource Manager (ARM).
      When Azure RBAC is enabled:

      • Azure AD principals will be validated exclusively by Azure RBAC.
      • Kubernetes users and service accounts are exclusively validated by Kubernetes RBAC.
    • โŒ error: AZR-000361 - Using managed identities have the following benefits:

      • Your app connects to resources with the managed identity. You don't need to manage credentials in your container app.
      • You can use role-based access control to grant specific permissions to a managed identity.
      • System-assigned identities are automatically created and managed. They're deleted when your container app is deleted.
      • You can add and delete user-assigned identities and assign them to multiple resources. They're independent of your container app's life cycle.
      • You can use managed identity to authenticate with a private Azure Container Registry without a username and password to pull containers for your Container App.
      • You can use managed identity to create connections for Dapr-enabled applications via Dapr components.
    • โŒ error: AZR-000363 - Container apps environments allows you to expose your container app to the Internet.
      Container apps environments deployed as external resources are available for public requests. External environments are deployed with a virtual IP on an external, public facing IP address.
      Disable public network access to improve security by exposing the Container Apps environment through an internal load balancer.
      This removes the need for a public IP address and prevents internet access to all Container Apps within the environment.
      To provide secure access, instead consider using an Application Gateway or Azure Front Door premium in front of your Container Apps on your private VNET.

    • โŒ error: TA-000023 - To ensure that only applications from allowed networks, machines, or subnets can access your cluster, restrict access to your Kubernetes Service Management API server. It is recommended to limit access to authorized IP ranges to ensure that only applications from allowed networks can access the cluster.

    • โŒ error: AZR-000022 - To capture security-based audit logs from AKS clusters, the following diagnostic log categories should be enabled:

      • kube-audit or kube-audit-admin, or both.
        • kube-audit - Contains all audit log data for every audit event, including get, list, create, update, delete, patch, and post.
        • kube-audit-admin - Is a subset of the kube-audit log category.
          kube-audit-admin reduces the number of logs significantly by excluding the get and list audit events from the log.
      • guard - Contains logs for Azure Active Directory (AAD) authorization integration.
        For managed Azure AD, this includes token in and user info out. For Azure RBAC, this includes access reviews in and out.
    • โŒ error: AZR-000029 - AKS-managed integration provides an easy way to use Azure AD authorization for AKS. Previous Azure AD integration with AKS required app registration and management within Azure AD.

    • โŒ error: AZR-000030 - In Kubernetes, the API server is the control plane of the cluster. Access to the API server is required by various cluster functions as well as all administrator activities.
      All activities performed against the cluster require authorization. To improve cluster security, the API server can be restricted to a limited set of IP address ranges.
      Restricting authorized IP addresses for the API server has the following limitations:

      • Requires AKS clusters configured with a Standard Load Balancer SKU.
      • This feature is not compatible with clusters that use Public IP per Node.
      • This feature is not compatible with AKS private clusters.

      When configuring this feature, you must specify the IP address ranges that will be authorized. To allow only the outbound public IP of the Standard SKU load balancer, use 0.0.0.0/32.
      You should add these ranges to the allow list:

      • Include output IP addresses for cluster nodes
      • Any range where administration will connect to the API server, including CI/CD systems, monitoring, and management systems.
    • โŒ error: AZR-000032 - Azure Kubernetes Service (AKS) supports Role-based Access Control (RBAC). RBAC is supported using Kubernetes RBAC and optionally Azure RBAC.

      • Using Kubernetes RBAC, you can grant users, groups, and service accounts access to cluster resources.
      • Additionally AKS supports granting Azure AD identities access to cluster resources using Azure RBAC.

      Using authorization provided by Azure RBAC simplifies and centralizes authorization of Azure AD principals. Access to Kubernetes resource can be managed using Azure Resource Manager (ARM).
      When Azure RBAC is enabled:

      • Azure AD principals will be validated exclusively by Azure RBAC.
      • Kubernetes users and service accounts are exclusively validated by Kubernetes RBAC.
    • โŒ error: TA-000001 - Enable auditing of diagnostic logs on the app. This enables you to recreate activity trails for investigation purposes if a security incident occurs or your network is compromised.

    • โŒ error: AZR-000361 - Using managed identities have the following benefits:

      • Your app connects to resources with the managed identity. You don't need to manage credentials in your container app.
      • You can use role-based access control to grant specific permissions to a managed identity.
      • System-assigned identities are automatically created and managed. They're deleted when your container app is deleted.
      • You can add and delete user-assigned identities and assign them to multiple resources. They're independent of your container app's life cycle.
      • You can use managed identity to authenticate with a private Azure Container Registry without a username and password to pull containers for your Container App.
      • You can use managed identity to create connections for Dapr-enabled applications via Dapr components.
    • โŒ error: TA-000001 - Enable auditing of diagnostic logs on the app. This enables you to recreate activity trails for investigation purposes if a security incident occurs or your network is compromised.

    • โŒ error: AZR-000291 - Every request to an Azure App Configuration resource must be authenticated. App Configuration supports authenticating requests using either Entra ID (previously Azure AD) identities or access keys. Using Entra ID identities:

      • Centralizes identity management and auditing.
      • Allows granting of permissions using role-based access control (RBAC).
      • Provides support for advanced security features such as conditional access and multi-factor authentication (MFA) when applicable.

      To require clients to use Entra ID to authenticate requests, you can disable the usage of access keys for an Azure App Configuration resource.
      When you disable access key authentication for an Azure App Configuration resource, any existing access keys for that resource are deleted. Any subsequent requests to the resource using the previously existing access keys will be rejected. Only requests that are authenticated using Entra ID will succeed.

    • โŒ error: AZR-000202 - By default, storage accounts accept connections from clients on any network. To limit access to selected networks, you must first change the default action.
      After changing the default action from Allow to Deny, configure one or more rules to allow traffic. Traffic can be allowed from:

      • Azure services on the trusted service list.
      • IP address or CIDR range.
      • Private endpoint connections.
      • Azure virtual network subnets with a Service Endpoint.
    • โŒ error: AZR-000198 - Blob containers in Azure Storage Accounts can be configured for private or anonymous public access. By default, containers are private and only accessible with a credential or access token. When a container is configured with an access type other than private, anonymous access is permitted.
      Anonymous access to blobs or containers can be restricted by setting allowBlobPublicAccess to false. This enhanced security setting for a storage account overrides the individual settings for blob containers. When you disallow public access for a storage account, blobs are no longer accessible anonymously.

    • โŒ error: AZR-000095 - Cosmos DB provides two authorization options for interacting with the database:

      • Azure Active Directory identity (Azure AD).
        Can be used to authorize account and resource management operations.
      • Keys and resource tokens.
        Can be used to authorize resource management and data operations.
        Resource management operations include management of databases, indexes, and containers. By default, keys are permitted to perform resource management operations. You can restrict these operations to Azure Resource Manager (ARM) calls only.
    • โŒ error: AZR-000186 - Enable Microsoft Defender for Azure SQL logical server.

    • โŒ error: AZR-000187 - Auditing for Azure SQL Database tracks database events and writes them to an audit log. Audit logs help you find suspicious events, unusual activity, and trends.

    • โŒ error: AZR-000188 - Azure SQL Database offer two authentication models, Azure Active Directory (AAD) and SQL authentication. AAD authentication supports centralized identity management in addition to modern password protections. Some of the benefits of AAD authentication over SQL authentication including:

      • Support for Azure Multi-Factor Authentication (MFA).
      • Conditional-based access with Conditional Access.

      It is also possible to disable SQL authentication entirely and only use AAD authentication.

    • โŒ error: AZR-000316 - Azure Bicep and Azure Resource Manager (ARM) templates can be used to deploy resources to Azure. When deploying Azure resources, sensitive values such as passwords, certificates, and keys should be passed as secure parameters. Secure parameters use the secureString or secureObject type.
      Parameters that do not use secure types are recorded in logs and deployment history. These values can be retrieved by anyone with access to the deployment history.

    • โŒ error: AZR-000316 - Azure Bicep and Azure Resource Manager (ARM) templates can be used to deploy resources to Azure. When deploying Azure resources, sensitive values such as passwords, certificates, and keys should be passed as secure parameters. Secure parameters use the secureString or secureObject type.
      Parameters that do not use secure types are recorded in logs and deployment history. These values can be retrieved by anyone with access to the deployment history.

    • โŒ error: AZR-000316 - Azure Bicep and Azure Resource Manager (ARM) templates can be used to deploy resources to Azure. When deploying Azure resources, sensitive values such as passwords, certificates, and keys should be passed as secure parameters. Secure parameters use the secureString or secureObject type.
      Parameters that do not use secure types are recorded in logs and deployment history. These values can be retrieved by anyone with access to the deployment history.

    • โŒ error: AZR-000316 - Azure Bicep and Azure Resource Manager (ARM) templates can be used to deploy resources to Azure. When deploying Azure resources, sensitive values such as passwords, certificates, and keys should be passed as secure parameters. Secure parameters use the secureString or secureObject type.
      Parameters that do not use secure types are recorded in logs and deployment history. These values can be retrieved by anyone with access to the deployment history.

    • โŒ warning: AZR-000406 - Disabling public network access improves security by ensuring that the Machine Learning Workspaces aren't exposed on the public internet. You can control exposure of your workspaces by creating private endpoints instead. By default, a public endpoint is enabled for Machine Learning workspaces. The public endpoint is used for all access except for requests that use a Private Endpoint. Access through the public endpoint can be disabled or restricted to authorized virtual networks.
      Data exfiltration is an attack where an malicious actor does an unauthorized data transfer. Private Endpoints help control exposure of a workspace to data exfiltration by an internal or external malicious actor. They do this by providing clear separation between public and private endpoints. As a result, broad access to public endpoints which could be operated by a malicious actor are not required.

    • โŒ warning: AZR-000407 - Manange access to Azure ML workspace and associated resources, Azure Container Registry, KeyVault, Storage, and App Insights using user-assigned managed identity. By default, system-assigned managed identity is used by Azure ML workspace to access the associated resources. User-assigned managed identity allows you to create the identity as an Azure resource and maintain the life cycle of that identity.

    • โŒ warning: AZR-000406 - Disabling public network access improves security by ensuring that the Machine Learning Workspaces aren't exposed on the public internet. You can control exposure of your workspaces by creating private endpoints instead. By default, a public endpoint is enabled for Machine Learning workspaces. The public endpoint is used for all access except for requests that use a Private Endpoint. Access through the public endpoint can be disabled or restricted to authorized virtual networks.
      Data exfiltration is an attack where an malicious actor does an unauthorized data transfer. Private Endpoints help control exposure of a workspace to data exfiltration by an internal or external malicious actor. They do this by providing clear separation between public and private endpoints. As a result, broad access to public endpoints which could be operated by a malicious actor are not required.

    • โŒ warning: AZR-000407 - Manange access to Azure ML workspace and associated resources, Azure Container Registry, KeyVault, Storage, and App Insights using user-assigned managed identity. By default, system-assigned managed identity is used by Azure ML workspace to access the associated resources. User-assigned managed identity allows you to create the identity as an Azure resource and maintain the life cycle of that identity.

    • โŒ warning: AZR-000388 - Azure RBAC is the recommended authorization system for the Azure Key Vault data plane.
      Azure RBAC allows users to manage key, secrets, and certificates permissions. It provides one place to manage all permissions across all Key Vaults.
      Azure RBAC for Key Vault also allows users to have separate permissions on individual keys, secrets, and certificates.
      The Azure RBAC permission model is not enabled by default.

    • โŒ warning: AZR-000031 - AKS clusters support Role-based Access Control (RBAC) authorization. RBAC allows users, groups, and service accounts to be granted access to resources on an as needed basis. Actions performed by each identity can be logged for auditing with Kubernetes audit policies.
      When a cluster is deployed, local accounts are enabled by default even when RBAC is enabled. These local accounts such as clusterAdmin and clusterUser are shared accounts that are not tied to an identity.
      If local account credentials are used, Kubernetes auditing logs the local account instead of named accounts. Who performed an action cannot be determined from the audit logs, creating an audit log gap for privileged actions.
      In an AKS cluster with local account disabled administrator will be unable to get the clusterAdmin credential. For example, using az aks get-credentials -g '' -n '' --admin will fail.

    • โŒ warning: AZR-000370 - To collect and provide data plane protections of Microsoft Defender for Containers some additional daemon set and deployments needs to be deployed to the AKS clusters.
      These components are installed when the Defender profile is enabled on the cluster.
      The Defender profile deployed to each node provides the runtime protections and collects signals from nodes.

    • โŒ warning: AZR-000031 - AKS clusters support Role-based Access Control (RBAC) authorization. RBAC allows users, groups, and service accounts to be granted access to resources on an as needed basis. Actions performed by each identity can be logged for auditing with Kubernetes audit policies.
      When a cluster is deployed, local accounts are enabled by default even when RBAC is enabled. These local accounts such as clusterAdmin and clusterUser are shared accounts that are not tied to an identity.
      If local account credentials are used, Kubernetes auditing logs the local account instead of named accounts. Who performed an action cannot be determined from the audit logs, creating an audit log gap for privileged actions.
      In an AKS cluster with local account disabled administrator will be unable to get the clusterAdmin credential. For example, using az aks get-credentials -g '' -n '' --admin will fail.

    • โŒ warning: AZR-000370 - To collect and provide data plane protections of Microsoft Defender for Containers some additional daemon set and deployments needs to be deployed to the AKS clusters.
      These components are installed when the Defender profile is enabled on the cluster.
      The Defender profile deployed to each node provides the runtime protections and collects signals from nodes.

    • โŒ warning: AZR-000390 - Azure Database for PostgreSQL supports authentication with PostgreSQL logins and Azure AD authentication.
      By default, authentication with PostgreSQL logins is enabled. PostgreSQL logins are unable to provide sufficient protection for identities. Azure AD authentication provides strong protection controls including conditional access, identity governance, and privileged identity management.
      Once you decide to use Azure AD authentication, you can disable authentication with PostgreSQL logins.
      Azure AD-only authentication is only supported for the flexible server deployment model.

How to fix?

The full Definition of Done of the AI-Gallery template and fix approached can be found HERE.

InsufficientQuota Error

Hi,

I haven't been able to provision the required resources for this project. I was approved to use OpenAI, but I wasn't able to increase the quota tokens even though I've submitted 2 requests to do so.

Below are the 2 requests I sent and the most recent error code I've received. The original error was for gpt-35-turbo, the current error is for GPT4.

@mroopram โžœ /workspaces/contoso-chat-mr (cc2e808) $ ./provision.sh
Running provisioning using this subscription:
{
  "name": "Azure subscription 1",
  "subscriptionId": "a36d451c-ca02-4072-b151-d92c51e3a9ed"
}
If that is not the correct subscription, please run 'az account set --subscription "<SUBSCRIPTION-NAME>"'
Creating resource group contchat-rg in swedencentral...
Provisioning resources in resource group contchat-rg...
ERROR: {"code": "InvalidTemplateDeployment", "message": "The template deployment 'contchat' is not valid according to the validation procedure. The tracking id is '70e2f569-cf28-4458-909e-7caaaaf19381'. See inner errors for details."}

Inner Errors: 
{"code": "InsufficientQuota", "message": "This operation require 10 new capacity in quota Tokens Per Minute (thousands) - GPT-4, which is bigger than the current available capacity 1. The current quota usage is 0 and the quota limit is 1 for quota Tokens Per Minute (thousands) - GPT-4."}
ERROR: Failed to provision resources. Please check the error message above.

QuotaRequest2
QuotaRequest1

Some default options are $expensive$ for a low-throughput example program

  1. Default for Cosmos DB is Provisioned throughput. Serverless should be much cheaper for this sample program.
  2. Default for Prompt Flow deployment is 3 instances. Would 1 work? What about different instance types?

Question
If I create a new Cosmos DB using Serverless, can I swap it out with my current provisioned DB? Can I just create a new connection for it in Azure and update .env in the Codespace.
Or I could start over with the updated repo and edit the bicep file section for Cosmos DB, but that seems like a lot more work.

Deployment template validation failed: 'The provided value for the template parameter 'environmentName' is not valid. Length of the value should be greater than or equal to '1'

fresh install running ./provision.sh

ERROR: {"code": "InvalidTemplate", "message": "Deployment template validation failed: 'The provided value for the template parameter 'environmentName' is not valid. Length of the value should be greater than or equal to '1'. Please see https://aka.ms/arm-syntax-parameters for usage details.'.", "additionalInfo": [{"type": "TemplateViolation", "info": {"lineNumber": 14, "linePosition": 20, "path": "properties.template.parameters.environmentName.minLength"}}]}
ERROR: Failed to provision resources. Please check the error message above.

I also had to change provision.sh to overcome Issue 79: #79

Fail to load page after `azd up`

Describe the issue:
After running azd up, click the links output in the console log, and the page fails to load with the following error:
image

  • Workspace service page:
    image
  • Deployment service page:
    image
  • Scoring service page:
    image
  • Swagger service page:
    image

Repro Steps:

  1. Run azd auth login
  2. Run azd up

Environment:

  • Azd version: azd version 1.9.5 (commit cd2b7af9995d358aab33c782614f801ac1997dde)
  • OS: Codespaces, Dev Containers and Windows.

Expected behavior:
After azd up, the page can be loaded successfully.

@jongio, @cassiebreviu and @nitya for notification.

Notebook for testing History from an Endpoint deployment

I was wondering there was example code in one of these Jupyter notebooks in this repo or another repo for how to test a prompt flow endpoint after deploying it? A Sample notebook that would include history from with multiple follow up questions.

Thanks in advance!

What happened with ./provision.sh?

Apparently the file ./provision.sh has been moved or replaced. How can I create azure resources now?

P.D. I was planning a pull request including a provision.ps1 so you don't need WSL to create azure resources. Would that make sense now?

Error in connection type

Get this error when running evaluate-chat-prompt-flow.ipynb, which points to the connection definition in AI Studio. Could a sample be provided to compare?

...
Reason: NotSupported ConnectionType 0 for connection contoso-cosmos. 
Error message: (UserError) NotSupported ConnectionType 0 for connection contoso-cosmos.
Code: UserError

Test Template

  • Testing works following the Readme, Codespaces is the priority
  • Make sure azd works in Codespaces (flag to fix if not)
  • We have verification step in README after the resources are deployed, there is a description of what the customer needs to do next
  • Ensure managed identity is implemented and working
  • If local doesn't work, we need a note in the README (make this explicit)

Nice to have (but document if not working)

  • runs local

Must have two testers approval, minimum.

ERROR: failed running post hooks: 'postprovision' hook failed with exit code: '1', Path: 'infra\hooks\postprovision.sh'. : exit code: 1

When I run "azd up", I see that all services have been created successfully. However, I receive an error message afterwards. I have searched for a solution, but have not been successful. Can anyone provide me with any recommendations?
please help me.

(-) Skipped: Didn't find new changes.
<3>WSL (10) ERROR: CreateProcessParseCommon:711: Failed to translate D:\Workspace\contoso-chat
<3>WSL (10) ERROR: CreateProcessParseCommon:757: getpwuid(0) failed 2
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate d:\Workspace\contoso-chat.venv\Scripts
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Program Files\Microsoft SDKs\Azure\CLI2\wbin
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Program Files\Java\jdk1.8.0_351\bin
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Program Files\Common Files\Oracle\Java\javapath
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Program Files (x86)\Common Files\Oracle\Java\javapath
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\WINDOWS\system32
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\WINDOWS
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\WINDOWS\System32\Wbem
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\WINDOWS\System32\WindowsPowerShell\v1.0
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\WINDOWS\System32\OpenSSH
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate D:\download\apache-maven-3.8.7-bin\apache-maven-3.8.7\bin
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Program Files\PostgreSQL\13\bin
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Program Files\Git\cmd
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Users\dbhoang\AppData\Roaming\nvm
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Program Files\nodejs
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Program Files\PuTTY
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Program Files\Java\scripts
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Program Files\MySQL\MySQL Server 8.0\bin
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Users\dbhoang\Documents\cdk
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Program Files\RedHat\java-1.8.0-openjdk-1.8.0.372-1\bin
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Program Files\RedHat\java-1.8.0-openjdk-1.8.0.372-1\jre\bin
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Program Files\Git\usr\bin
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Users\dbhoang\AppData\Local\Programs\Python\Python39
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Users\dbhoang\AppData\Local\Programs\Python\Python39\Scripts
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Users\dbhoang\AppData\Local\Programs\Python\Python311
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Users\dbhoang\AppData\Local\Programs\Python\Python311\Scripts
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Program Files\Amazon\AWSCLIV2
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Users\dbhoang\Downloads\sqlite3
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Users\dbhoang\Downloads\sqlite
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Program Files\Docker\Docker\resources\bin
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Program Files\dotnet
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Users\dbhoang\AppData\Local\anaconda3
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Program Files\MongoDB\mongosh-2.2.2-win32-x64\bin
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate D:\file\Release-24.02.0-0.zip\poppler-24.02.0\Library\bin
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Gradle\gradle-7.0.2\bin
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Program Files (x86)\Microsoft SQL Server\160\Tools\Binn
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Program Files\Microsoft SQL Server\160\Tools\Binn
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Program Files\Microsoft SQL Server\160\DTS\Binn
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Program Files (x86)\Microsoft SQL Server\160\DTS\Binn
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Users\dbhoang\scoop\shims
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Users\dbhoang\AppData\Local\Programs\Python\Python39\Scripts
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Users\dbhoang\AppData\Local\Programs\Python\Python39
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Program Files\MySQL\MySQL Shell 8.0\bin
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Users\dbhoang\AppData\Local\Microsoft\WindowsApps
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Users\dbhoang\AppData\Roaming\npm
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Users\dbhoang\AppData\Roaming\nvm
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Program Files\nodejs
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Users\dbhoang\AppData\Local\Programs\Microsoft VS Code\bin
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Program Files\RedHat\Podman
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Users\dbhoang\AppData\Local\Programs\mongosh
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Users\dbhoang\AppData\Local\Programs\Ollama
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Program Files\JetBrains\IntelliJ IDEA 2024.1\bin
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Users\dbhoang\AppData\Local\Programs\Azure Dev CLI
Processing fstab with mount -a failed.
Failed to mount C:, see dmesg for more details.
Failed to mount D:, see dmesg for more details.

<3>WSL (10) ERROR: CreateProcessEntryCommon:334: getpwuid(0) failed 2
<3>WSL (10) ERROR: CreateProcessEntryCommon:505: execvpe /bin/bash failed 2
<3>WSL (10) ERROR: CreateProcessEntryCommon:508: Create process not expected to return

ERROR: failed running post hooks: 'postprovision' hook failed with exit code: '1', Path: 'infra\hooks\postprovision.sh'. : exit code: 1

ERROR: error executing step command 'provision': failed running post hooks: 'postprovision' hook failed with exit code: '1', Path: 'infra\hooks\postprovision.sh'. : exit code: 1

Error when running cell 36 in evaluate-chat-prompt-flow.ipynb

The error I get is: "InvalidRunStatusError: The input for batch run is incorrect. Input from key 'run.outputs' is an empty list, which means we cannot generate a single line input for the flow run. Please rectify the input and try again"

Log shows its running successfully until it starts the aml run step...
image

Soft delete of Key Vault prevents redeployment

If you run the provision.sh script once, delete the created resource group, and then attempt to run it a second time you will get an error message like this:

[{"code":"ConflictError","message":"A vault with the same name already exists in deleted state. You need to either recover or purge existing key vault. Follow this link https://go.microsoft.com/fwlink/?linkid=2149745 for more information on soft delete."}]}}

To redeploy, you will first need to purge the deleted keyvault with a command like:

az keyvault purge --name kv-contosooipsaukqmp24o --location swedencentral

or search for "Key Vaults" in the Azure Portal and then click on "Manage Deleted Vaults" to purge it.

Endpoint test fails due to missing API key

After completing deployment I can see the endpoint on AI Studio. Following the instructions in the README I proceed to test it with the following input:

{"question": "Tell me about hiking shoes", "customerId": "2", "chat_history": []}

The above produces an error, however, triggered during the instantiation of the AzureOpenAIModelConfiguration object. As seen in the logs:

"Execution failure in 'get_response': (InvalidConnectionError) AzureOpenAIModel parameters are incomplete. Please ensure azure_endpoint, api_version, and api_key are provided."

Although we do explicitly provide the version and endpoint here, we don't do the same for the API key. In fact, inspecting my local azd env, the value of AZURE_OPENAI_API_KEY is not set. This feels like something that should be part of the postprovision script. Diving deeper, I noticed that a relevant looking key (is it the same one?) used to be set among others here prior to the May 2024 updates. Why was this dropped?

I'm currently using the following package versions:

prompt_toolkit==3.0.45
promptflow==1.10.0
promptflow-azure==1.10.0
promptflow-core==1.10.0
promptflow-devkit==1.10.0
promptflow-evals==0.3.0
promptflow-tools==1.4.0
promptflow-tracing==1.10.0

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.