Skip to content

Commit

Permalink
Merge pull request #99 from Azure/bot-gpt-model-update
Browse files Browse the repository at this point in the history
  • Loading branch information
codebytes authored May 3, 2024
2 parents 92126f9 + dab9f92 commit 9be48c9
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 7 deletions.
2 changes: 2 additions & 0 deletions gen-ai/Assistants/bot-in-a-box/foo.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
curl asdkncihjewbvnjs --fail
curl -h
4 changes: 2 additions & 2 deletions gen-ai/Assistants/bot-in-a-box/infra/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ param tags object

param openaiName string = ''

@allowed(['gpt-4', 'gpt-4-32k'])
@allowed(['gpt-4', 'gpt-4-32k', 'gpt-35-turbo', 'gpt-35-turbo-16k'])
param gptModel string
@allowed(['0613', '1106-Preview'])
@allowed(['0301', '0613', '1106', '0125', 'turbo-2024-04-09', '1106-Preview', '0125-Preview'])
param gptVersion string

param msiName string = ''
Expand Down
20 changes: 18 additions & 2 deletions gen-ai/Assistants/bot-in-a-box/scripts/createAssistant.ps1
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
$ErrorActionPreference="Stop"


Write-Host "Loading azd .env file from current environment"
foreach ($line in (& azd env get-values)) {
if ($line -match "([^=]+)=(.*)") {
Expand All @@ -22,11 +25,15 @@ else
echo "not empty"
}

$TOOLS="{}"
$TOOLS=""
Get-ChildItem "./src/Tools" -Filter *.json |
Foreach-Object {
$content = Get-Content $_.FullName
$TOOLS = "$TOOLS,$content"
if ($TOOLS -eq "") {
$TOOLS = $content
} else {
$TOOLS = "$TOOLS,$content"
}
}

echo "{
Expand All @@ -40,8 +47,17 @@ echo "{
`"metadata`":{}
}" | Out-File tmp.json
curl "${env:AOAI_API_ENDPOINT}openai/assistants$ASSISTANT_ID`?api-version=2024-02-15-preview" -H "api-key: $AOAI_API_KEY" -H 'content-type: application/json' -d '@tmp.json'

rm tmp.json

$ASSISTANT_ID=((curl "${env:AOAI_API_ENDPOINT}openai/assistants`?api-version=2024-02-15-preview" -H "api-key: $AOAI_API_KEY" | ConvertFrom-Json).data | Where-Object name -eq $AOAI_ASSISTANT_NAME).id
if ( $ASSISTANT_ID -eq $null )
{
throw "Failed to create assistant"
}
else
{
echo "Assistant created/updated successfully"
}

az webapp config appsettings set -g $env:AZURE_RESOURCE_GROUP_NAME -n $env:APP_NAME --settings AOAI_ASSISTANT_ID=$ASSISTANT_ID APP_URL=$env:APP_HOSTNAME
5 changes: 4 additions & 1 deletion gen-ai/Assistants/bot-in-a-box/scripts/createAssistant.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
set -e

echo "Loading azd .env file from current environment..."

while IFS='=' read -r key value; do
Expand Down Expand Up @@ -32,7 +34,8 @@ echo '{
curl "$AOAI_API_ENDPOINT/openai/assistants$ASSISTANT_ID?api-version=2024-02-15-preview" \
-H "api-key: $AOAI_API_KEY" \
-H 'content-type: application/json' \
-d @tmp.json
-d @tmp.json \
--fail-with-body
rm tmp.json

ASSISTANT_ID=$(curl "$AOAI_API_ENDPOINT/openai/assistants?api-version=2024-02-15-preview" \
Expand Down
5 changes: 3 additions & 2 deletions gen-ai/semantic-kernel-bot-in-a-box/infra/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ param tags object

param openaiName string = ''

@allowed(['gpt-4', 'gpt-4-32k'])

@allowed(['gpt-4', 'gpt-4-32k', 'gpt-35-turbo', 'gpt-35-turbo-16k'])
param gptModel string
@allowed(['0613', '1106-Preview'])
@allowed(['0301', '0613', '1106', '0125', 'turbo-2024-04-09', '1106-Preview', '0125-Preview'])
param gptVersion string

param msiName string = ''
Expand Down

0 comments on commit 9be48c9

Please sign in to comment.