Skip to content

Commit 97cd7aa

Browse files
authored
Merge pull request #12 from Azure-Samples/codespace-fixes
Fixes from Codespace deployment
2 parents 2489c6c + 4226309 commit 97cd7aa

File tree

5 files changed

+6
-19
lines changed

5 files changed

+6
-19
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ Since the local app uses OpenAI models, you should first deploy it for the optim
142142
2. Run the FastAPI backend:
143143
144144
```shell
145-
fastapi dev src/api/main.py
145+
python3 -m uvicorn fastapi_app:create_app --factory --reload
146146
```
147147
148148
Or you can run "Backend" in the VS Code Run & Debug menu.

infra/main.bicep

+1-14
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,12 @@ param principalId string = ''
1717

1818
@minLength(1)
1919
@description('Location for the OpenAI resource')
20+
// Look for gpt-35-turbo 0125 on the availability table:
2021
// https://learn.microsoft.com/en-us/azure/ai-services/openai/concepts/models#standard-deployment-model-availability
2122
@allowed([
22-
'australiaeast'
23-
'brazilsouth'
2423
'canadaeast'
25-
'eastus'
26-
'eastus2'
27-
'francecentral'
28-
'japaneast'
2924
'northcentralus'
30-
'norwayeast'
31-
'southafricanorth'
3225
'southcentralus'
33-
'southindia'
34-
'swedencentral'
35-
'switzerlandnorth'
36-
'uksouth'
37-
'westeurope'
38-
'westus'
3926
])
4027
@metadata({
4128
azd: {

src/entrypoint.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/bin/bash
22
set -e
3-
python3 -m gunicorn fastapi_app:create_app()
3+
python3 -m gunicorn "fastapi_app:create_app()"

src/fastapi_app/postgres_engine.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ async def create_postgres_engine_from_env(azure_credential=None) -> AsyncEngine:
4040
host=os.environ["POSTGRES_HOST"],
4141
username=os.environ["POSTGRES_USERNAME"],
4242
database=os.environ["POSTGRES_DATABASE"],
43-
password=os.environ["POSTGRES_PASSWORD"],
43+
password=os.environ.get("POSTGRES_PASSWORD"),
4444
sslmode=os.environ.get("POSTGRES_SSL"),
4545
azure_credential=azure_credential,
4646
)

src/fastapi_app/query_rewriter.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def extract_search_arguments(chat_completion: ChatCompletion):
6868
if function.name == "search_database":
6969
arg = json.loads(function.arguments)
7070
search_query = arg.get("search_query")
71-
if "price_filter" in arg:
71+
if "price_filter" in arg and arg["price_filter"]:
7272
price_filter = arg["price_filter"]
7373
filters.append(
7474
{
@@ -77,7 +77,7 @@ def extract_search_arguments(chat_completion: ChatCompletion):
7777
"value": price_filter["value"],
7878
}
7979
)
80-
if "brand_filter" in arg:
80+
if "brand_filter" in arg and arg["brand_filter"]:
8181
brand_filter = arg["brand_filter"]
8282
filters.append(
8383
{

0 commit comments

Comments
 (0)