Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update the semantic kernel #44

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
OPENAI_API_TYPE="azure"
OPENAI_API_VERSION="2024-10-01-preview"
# Environment variables obtained from Azure OpenAI
AZURE_OPENAI_CHAT_MODEL_NAME="gpt-35-turbo"
AZURE_OPENAI_CHAT_DEPLOYMENT_NAME=""
AZURE_OPENAI_EMBEDDINGS_MODEL_NAME="text-embedding-ada-002"
AZURE_OPENAI_EMBEDDINGS_DEPLOYMENT_NAME=""
AZURE_OPENAI_DEPLOYMENT_NAME=""
AZURE_OPENAI_ENDPOINT=""
AZURE_OPENAI_ENDPOINT="https://<YOUR-OPENAI-DEPLOYMENT-NAME>.openai.azure.com/"
AZURE_OPENAI_API_KEY=""
# Environment variable obtained from Azure Cosmos DB for MongoDB vCore
AZCOSMOS_CONNSTR=""
AZURE_COSMOS_CONNECTION_STRING="<YOUR-COSMOS-DB-CONNECTION-STRING>"
AZURE_COSMOS_USERNAME="<YOUR-COSMOS-DB-USERNAME>"
AZURE_COSMOS_PASSWORD="<YOUR-COSMOS-DB-PASSWORD>"
# Environment variables you set to be used by the code
AZCOSMOS_DATABASE_NAME=""
AZCOSMOS_CONTAINER_NAME=""
AZURE_COSMOS_DATABASE_NAME="<COSMOS-DB-NEW-UNIQUE-DATABASE-NAME>"
AZURE_COSMOS_COLLECTION_NAME="<COSMOS-DB-NEW-UNIQUE-COLLECTION-NAME>"
AZURE_COSMOS_INDEX_NAME="VectorSearchIndex"
1 change: 0 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"**/__pycache__": true,
"**/.ruff_cache": true,
"**/.mypy_cache": true,
"**/.venv": true,
},
"search.exclude": {
"**/.venv": true,
Expand Down
27 changes: 19 additions & 8 deletions infra/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,18 @@ param location string
@description('Id of the user or app to assign application roles')
param principalId string = ''

@description('SKU to use for App Service Plan')
param appServiceSku string

var mongoClusterName = '${uniqueString(resourceGroup.id)}-mvcore'
var mongoAdminUser = 'admin${uniqueString(resourceGroup.id)}'
@secure()
@description('Mongo Server administrator password')
param mongoAdminPassword string

@description('SKU to use for Cosmos DB for MongoDB vCore Plan')
param mongoServiceSku string

param openAIDeploymentName string = '${name}-openai'
param chatGptDeploymentName string = 'chat-gpt'
param chatGptDeploymentCapacity int = 30
Expand Down Expand Up @@ -109,7 +115,7 @@ module appServicePlan 'core/host/appserviceplan.bicep' = {
location: location
tags: tags
sku: {
name: 'B1'
name: appServiceSku
}
reserved: true
}
Expand All @@ -126,19 +132,19 @@ module mongoCluster 'core/database/cosmos/mongo/cosmos-mongo-cluster.bicep' = {
administratorLoginPassword: mongoAdminPassword
storage: 32
nodeCount: 1
sku: 'M25'
sku: mongoServiceSku
allowAzureIPsFirewall: true
}
}

module keyVaultSecrets './core/security/keyvault-secret.bicep' = {
dependsOn: [ mongoCluster ]
name: 'keyvault-secret-mongo-connstr'
name: 'keyvault-secret-mongo-password'
scope: resourceGroup
params: {
name: 'mongoConnectionStr'
name: 'mongoAdminPassword'
keyVaultName: keyVault.outputs.name
secretValue: replace(replace(mongoCluster.outputs.connectionStringKey, '<user>', mongoAdminUser), '<password>', mongoAdminPassword)
secretValue: mongoAdminPassword
}
}

Expand All @@ -157,15 +163,20 @@ module web 'core/host/appservice.bicep' = {
scmDoBuildDuringDeployment: true
ftpsState: 'Disabled'
managedIdentity: true
use32BitWorkerProcess: appServiceSku == 'F1'
alwaysOn: appServiceSku != 'F1'
appSettings: {
AZURE_OPENAI_DEPLOYMENT_NAME: openAIDeploymentName
AZURE_OPENAI_ENDPOINT: openAi.outputs.endpoint
AZURE_OPENAI_CHAT_DEPLOYMENT_NAME: chatGptDeploymentName
AZURE_OPENAI_EMBEDDINGS_DEPLOYMENT_NAME: embeddingDeploymentName
AZURE_OPENAI_API_KEY: '@Microsoft.KeyVault(VaultName=${keyVault.outputs.name};SecretName=cognitiveServiceKey)'
AZCOSMOS_CONNSTR: '@Microsoft.KeyVault(VaultName=${keyVault.outputs.name};SecretName=mongoConnectionStr)'
AZCOSMOS_DATABASE_NAME: 'sk_database'
AZCOSMOS_CONTAINER_NAME: 'sk_collection'
AZURE_COSMOS_PASSWORD: '@Microsoft.KeyVault(VaultName=${keyVault.outputs.name};SecretName=mongoAdminPassword)'
AZURE_COSMOS_CONNECTION_STRING: mongoCluster.outputs.connectionStringKey
AZURE_COSMOS_USERNAME: mongoAdminUser
AZURE_COSMOS_DATABASE_NAME: 'sk_database'
AZURE_COSMOS_COLLECTION_NAME: 'sk_collection'
AZURE_COSMOS_INDEX_NAME: 'sk_index'
}
}
}
Expand Down
6 changes: 6 additions & 0 deletions infra/main.parameters.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
},
"mongoAdminPassword": {
"value": "$(secretOrRandomPassword ${AZURE_KEY_VAULT_NAME} mongoAdminPassword)"
},
"appServiceSku": {
"value": "${AZURE_APP_SERVICE_SKU=B1}"
},
"mongoServiceSku":{
"value": "${AZURE_MONGO_SERVICE_SKU=M25}"
}
}
}
Loading
Loading