Skip to content

Fixes from Codespace deployment #12

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

Merged
merged 4 commits into from
May 14, 2024
Merged
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ Since the local app uses OpenAI models, you should first deploy it for the optim
2. Run the FastAPI backend:

```shell
fastapi dev src/api/main.py
python3 -m uvicorn fastapi_app:create_app --factory --reload
```

Or you can run "Backend" in the VS Code Run & Debug menu.
Expand Down
15 changes: 1 addition & 14 deletions infra/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,12 @@ param principalId string = ''

@minLength(1)
@description('Location for the OpenAI resource')
// Look for gpt-35-turbo 0125 on the availability table:
// https://learn.microsoft.com/en-us/azure/ai-services/openai/concepts/models#standard-deployment-model-availability
@allowed([
'australiaeast'
'brazilsouth'
'canadaeast'
'eastus'
'eastus2'
'francecentral'
'japaneast'
'northcentralus'
'norwayeast'
'southafricanorth'
'southcentralus'
'southindia'
'swedencentral'
'switzerlandnorth'
'uksouth'
'westeurope'
'westus'
])
@metadata({
azd: {
Expand Down
2 changes: 1 addition & 1 deletion src/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash
set -e
python3 -m gunicorn fastapi_app:create_app()
python3 -m gunicorn "fastapi_app:create_app()"
2 changes: 1 addition & 1 deletion src/fastapi_app/postgres_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ async def create_postgres_engine_from_env(azure_credential=None) -> AsyncEngine:
host=os.environ["POSTGRES_HOST"],
username=os.environ["POSTGRES_USERNAME"],
database=os.environ["POSTGRES_DATABASE"],
password=os.environ["POSTGRES_PASSWORD"],
password=os.environ.get("POSTGRES_PASSWORD"),
sslmode=os.environ.get("POSTGRES_SSL"),
azure_credential=azure_credential,
)
Expand Down
4 changes: 2 additions & 2 deletions src/fastapi_app/query_rewriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def extract_search_arguments(chat_completion: ChatCompletion):
if function.name == "search_database":
arg = json.loads(function.arguments)
search_query = arg.get("search_query")
if "price_filter" in arg:
if "price_filter" in arg and arg["price_filter"]:
price_filter = arg["price_filter"]
filters.append(
{
Expand All @@ -77,7 +77,7 @@ def extract_search_arguments(chat_completion: ChatCompletion):
"value": price_filter["value"],
}
)
if "brand_filter" in arg:
if "brand_filter" in arg and arg["brand_filter"]:
brand_filter = arg["brand_filter"]
filters.append(
{
Expand Down
Loading