Skip to content

Commit

Permalink
fix ci error and some format issue
Browse files Browse the repository at this point in the history
  • Loading branch information
zedy committed Feb 7, 2024
1 parent cf07644 commit 5186832
Show file tree
Hide file tree
Showing 18 changed files with 37 additions and 943 deletions.
4 changes: 3 additions & 1 deletion .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ ORCHESTRATION_STRATEGY=openai_functions
#Speech-to-text feature
AZURE_SPEECH_SERVICE_KEY=
AZURE_SPEECH_SERVICE_REGION=
# Auth type related param. When your AZURE_AUTH_TYPE = rbac, please make sure setting USE_KEY_VAULT= false; When your USE_KEY_VAULT= true, please setting your key vault endpoint.
# Auth type environment variables.
# When AZURE_AUTH_TYPE=rbac, please make sure variable USE_KEY_VAULT=false
# When USE_KEY_VAULT=true, please make sure to set AZURE_KEY_VAULT_ENDPOINT
AZURE_AUTH_TYPE=keys
USE_KEY_VAULT=true
AZURE_KEY_VAULT_ENDPOINT=
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore

# generated frontend files
code/app/static/
code/static/

# User-specific files
*.rsuser
Expand Down
7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ az deployment group create --resource-group $RESOURCE_GROUP_NAME --template-file

The Azure Developer CLI (`azd`) is a developer-centric command-line interface (CLI) tool for creating Azure applications.

You need to install it before running and deploying with the Azure Developer CLI.
You need to install it before running and deploying with the Azure Developer CLI. (If you use the devcontainer, everything is already installed)

### Windows

Expand All @@ -225,16 +225,13 @@ azd init -t chat-with-your-data-solution-accelerator
Enter an environment name.

**Notes:** the default auth type uses keys, if you want to switch to rbac, please run `azd env set AUTH_TYPE rbac`.
```
azd env set AUTH_TYPE rbac
```

Then, run `azd up` to provision all the resources to Azure and deploy the code to those resources.
```
azd up
```

Select your desired `subscription` and `location`. Then choose a resource group or create a new resource group. Wait a moment for the resource deployment to complete, click the Website endpoint and you will see the web app page.
Select your desired `subscription` and `location`. Wait a moment for the resource deployment to complete, click the website endpoint and you will see the web app page.

You can also run the sample directly locally (See below).

Expand Down
5 changes: 5 additions & 0 deletions azure.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ services:
run: cd ./frontend;npm install;npm run build;
interactive: true
continueOnError: false
posix:
shell: sh
run: cd ./frontend;npm install;npm run build;
interactive: true
continueOnError: false

adminweb:
project: ./code/backend
Expand Down
5 changes: 2 additions & 3 deletions code/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import logging
import requests
from openai import AzureOpenAI

# Fixing MIME types for static files under Windows
import mimetypes
from flask import Flask, Response, request, jsonify
from dotenv import load_dotenv
Expand Down Expand Up @@ -47,7 +45,8 @@ def static_file(path):
AZURE_OPENAI_KEY = "" if AZURE_AUTH_TYPE == 'rbac' else os.environ.get("AZURE_OPENAI_KEY")
AZURE_SPEECH_KEY = None if AZURE_AUTH_TYPE == 'rbac' else os.environ.get("AZURE_SPEECH_SERVICE_KEY")

@app.route('/api/config', methods=['GET'])

@app.route("/api/config", methods=["GET"])
def get_config():
# Retrieve the environment variables or other configuration data
azure_speech_region = os.getenv('AZURE_SPEECH_SERVICE_REGION')
Expand Down
890 changes: 0 additions & 890 deletions code/static/assets/index-5e1f6cf7.js

This file was deleted.

1 change: 0 additions & 1 deletion code/static/assets/index-5e1f6cf7.js.map

This file was deleted.

1 change: 0 additions & 1 deletion code/static/assets/index-8b288b52.css

This file was deleted.

3 changes: 0 additions & 3 deletions code/static/assets/mic-outline-75e9b1db.svg

This file was deleted.

15 changes: 0 additions & 15 deletions code/static/index.html

This file was deleted.

27 changes: 14 additions & 13 deletions infra/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ param azureOpenAIEmbeddingModel string = 'text-embedding-ada-002'
@description('Azure OpenAI Embedding Model Name')
param azureOpenAIEmbeddingModelName string = 'text-embedding-ada-002'

@description('Azure Cognitive Search Resource')
param azureCognitiveSearchName string = '${environmentName}-search-${resourceToken}'
@description('Azure AI Search Resource')
param azureAISearchName string = '${environmentName}-search-${resourceToken}'

@description('The SKU of the search service you want to create. E.g. free or standard')
@allowed([
Expand All @@ -122,16 +122,16 @@ param azureCognitiveSearchName string = '${environmentName}-search-${resourceTok
'standard2'
'standard3'
])
param azureCognitiveSearchSku string = 'standard'
param azureSearchSku string = 'standard'

@description('Azure Cognitive Search Index')
@description('Azure AI Search Index')
param azureSearchIndex string = '${environmentName}-index-${resourceToken}'

@description('Azure Cognitive Search Conversation Log Index')
@description('Azure AI Search Conversation Log Index')
param azureSearchConversationLogIndex string = 'conversations'

@description('Name of Storage Account')
param storageAccountName string = '${environmentName}str'
param storageAccountName string = '${environmentName}str${resourceToken}'

@description('Name of Function App for Batch document processing')
param functionName string = '${environmentName}-backend-${resourceToken}'
Expand All @@ -143,7 +143,7 @@ param formRecognizerName string = '${environmentName}-formrecog-${resourceToken}
param contentSafetyName string = '${environmentName}-contentsafety-${resourceToken}'

@description('Azure Speech Service Name')
param speechServiceName string = '${environmentName}-speechservice'
param speechServiceName string = '${environmentName}-speechservice-${resourceToken}'

param newGuidString string = newGuid()
param searchTag string = 'chatwithyourdata-sa'
Expand Down Expand Up @@ -277,16 +277,16 @@ module storekeys './app/storekeys.bicep' = if (useKeyVault) {
}

module search './core/search/search-services.bicep' = {
name: azureCognitiveSearchName
name: azureAISearchName
scope: rg
params:{
name: azureCognitiveSearchName
name: azureAISearchName
location: location
tags: {
deployment : searchTag
}
sku: {
name: azureCognitiveSearchSku
name: azureSearchSku
}
authOptions: {
aadOrApiKey: {
Expand Down Expand Up @@ -335,7 +335,8 @@ module web './app/web.bicep' = {
keyVaultEndpoint: useKeyVault ? keyvault.outputs.endpoint : ''
authType: authType
appSettings: {
AZURE_SEARCH_SERVICE: 'https://${azureCognitiveSearchName}.search.windows.net'
AZURE_SEARCH_USE_SEMANTIC_SEARCH: azureSearchUseSemanticSearch
AZURE_SEARCH_SERVICE: 'https://${azureAISearchName}.search.windows.net'
AZURE_SEARCH_INDEX: azureSearchIndex
AZURE_SEARCH_CONVERSATIONS_LOG_INDEX: azureSearchConversationLogIndex
AZURE_SEARCH_SEMANTIC_SEARCH_CONFIG: azureSearchSemanticSearchConfig
Expand Down Expand Up @@ -393,7 +394,7 @@ module adminweb './app/adminweb.bicep' = {
keyVaultEndpoint: useKeyVault ? keyvault.outputs.endpoint : ''
authType: authType
appSettings: {
AZURE_SEARCH_SERVICE: 'https://${azureCognitiveSearchName}.search.windows.net'
AZURE_SEARCH_SERVICE: 'https://${azureAISearchName}.search.windows.net'
AZURE_SEARCH_INDEX: azureSearchIndex
AZURE_SEARCH_USE_SEMANTIC_SEARCH: azureSearchUseSemanticSearch
AZURE_SEARCH_SEMANTIC_SEARCH_CONFIG: azureSearchSemanticSearchConfig
Expand Down Expand Up @@ -474,7 +475,7 @@ module function './app/function.bicep' = {
AZURE_BLOB_ACCOUNT_NAME: storageAccountName
AZURE_BLOB_CONTAINER_NAME: blobContainerName
AZURE_FORM_RECOGNIZER_ENDPOINT: 'https://${location}.api.cognitive.microsoft.com/'
AZURE_SEARCH_SERVICE: 'https://${azureCognitiveSearchName}.search.windows.net'
AZURE_SEARCH_SERVICE: 'https://${azureAISearchName}.search.windows.net'
DOCUMENT_PROCESSING_QUEUE_NAME: queueName
AZURE_OPENAI_API_VERSION: azureOpenAIApiVersion
AZURE_SEARCH_INDEX: azureSearchIndex
Expand Down
2 changes: 1 addition & 1 deletion tests/test_AzureBlobStorage.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from code.utilities.helpers.AzureBlobStorageHelper import AzureBlobStorageClient
from code.backend.batch.utilities.helpers.AzureBlobStorageHelper import AzureBlobStorageClient


@pytest.fixture
Expand Down
2 changes: 1 addition & 1 deletion tests/test_ContentSafetyChecker.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from code.utilities.tools.ContentSafetyChecker import ContentSafetyChecker
from code.backend.batch.utilities.tools.ContentSafetyChecker import ContentSafetyChecker


@pytest.mark.azure("This test requires Azure Content Safety configured")
Expand Down
4 changes: 2 additions & 2 deletions tests/test_DocumentChunking.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pytest
from code.utilities.common.SourceDocument import SourceDocument
from code.utilities.helpers.DocumentChunkingHelper import (
from code.backend.batch.utilities.common.SourceDocument import SourceDocument
from code.backend.batch.utilities.helpers.DocumentChunkingHelper import (
DocumentChunking,
ChunkingSettings,
ChunkingStrategy,
Expand Down
2 changes: 1 addition & 1 deletion tests/test_DocumentLoading.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from code.utilities.helpers.DocumentLoadingHelper import (
from code.backend.batch.utilities.helpers.DocumentLoadingHelper import (
DocumentLoading,
LoadingSettings,
)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_DocumentProcessor.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pytest
from code.utilities.helpers.DocumentProcessorHelper import DocumentProcessor
from code.utilities.helpers.ConfigHelper import ConfigHelper
from code.backend.batch.utilities.helpers.DocumentProcessorHelper import DocumentProcessor
from code.backend.batch.utilities.helpers.ConfigHelper import ConfigHelper

document_url = (
"https://csciblob.blob.core.windows.net/rag-sol-acc/cognitive-services.pdf"
Expand Down
2 changes: 1 addition & 1 deletion tests/test_Orchestrator.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from code.utilities.helpers.OrchestratorHelper import (
from code.backend.batch.utilities.helpers.OrchestratorHelper import (
Orchestrator,
OrchestrationSettings,
)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_OutputParserTool.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

from typing import List

from code.utilities.parser.OutputParserTool import OutputParserTool
from code.utilities.common.SourceDocument import SourceDocument
from code.backend.batch.utilities.parser.OutputParserTool import OutputParserTool
from code.backend.batch.utilities.common.SourceDocument import SourceDocument


def test_returns_parsed_messages():
Expand Down

0 comments on commit 5186832

Please sign in to comment.