Skip to content

Commit d68572c

Browse files
committed
More seed data updates
1 parent 9c55a43 commit d68572c

File tree

5 files changed

+17
-13
lines changed

5 files changed

+17
-13
lines changed

evals/generate_ground_truth.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from sqlalchemy import create_engine, select
1313
from sqlalchemy.orm import Session
1414

15-
from fastapi_app.postgres_models import Restaurant
15+
from fastapi_app.postgres_models import Item
1616

1717
logger = logging.getLogger("ragapp")
1818

src/backend/fastapi_app/postgres_models.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
from __future__ import annotations
22

33
from pgvector.sqlalchemy import Vector
4-
from sqlalchemy import Index, VARCHAR
4+
from sqlalchemy import VARCHAR, Index
55
from sqlalchemy.dialects import postgresql
6-
76
from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column
87

98

@@ -43,10 +42,11 @@ def to_dict(self, include_embedding: bool = False):
4342
return model_dict
4443

4544
def to_str_for_rag(self):
46-
return f"Name:{self.name} Description:{self.description} Location:{self.location} Cuisine:{self.cuisine} Rating:{self.rating} Price Level:{self.price_level} Review Count:{self.review_count} Hours:{self.hours} Tags:{self.tags} Menu Summary:{self.menu_summary} Top Reviews:{self.top_reviews} Vibe:{self.vibe}"
47-
45+
return f"Name:{self.name} Description:{self.description} Location:{self.location} Cuisine:{self.cuisine} Rating:{self.rating} Price Level:{self.price_level} Review Count:{self.review_count} Hours:{self.hours} Tags:{self.tags} Menu Summary:{self.menu_summary} Top Reviews:{self.top_reviews} Vibe:{self.vibe}" # noqa: E501
46+
4847
def to_str_for_embedding(self):
49-
return f"Name: {self.name} Description: {self.description} Cuisine: {self.cuisine} Tags: {self.tags} Menu Summary: {self.menu_summary} Top Reviews: {self.top_reviews} Vibe: {self.vibe}"
48+
return f"Name: {self.name} Description: {self.description} Cuisine: {self.cuisine} Tags: {self.tags} Menu Summary: {self.menu_summary} Top Reviews: {self.top_reviews} Vibe: {self.vibe}" # noqa: E501
49+
5050

5151
"""
5252
**Define HNSW index to support vector similarity search**

src/backend/fastapi_app/prompts/answer.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ Do not generate answers that don't use the sources below.
66
Each restaurant has an ID in brackets followed by colon and the restaurant details.
77
Always include the restaurant ID for each restaurant you reference in the response.
88
Use square brackets to reference the restaurant, for example [52].
9-
Don't combine references, cite each restaurant separately, for example [27][51].
9+
Don't combine references, cite each restaurant separately, for example [27][51].

src/backend/fastapi_app/query_rewriter.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ def build_search_function() -> list[ChatCompletionToolParam]:
2222
},
2323
"price_level_filter": {
2424
"type": "object",
25-
"description": "Filter search results to a certain price level (from 1 $ to 4 $$$$, with 4 being most costly)",
25+
"description": "Filter search results to a certain price level (from 1 $ to 4 $$$$, with 4 being most costly)", # noqa: E501
2626
"properties": {
2727
"comparison_operator": {
2828
"type": "string",
29-
"description": "Operator to compare the column value, either '>', '<', '>=', '<=', '='", # noqa
29+
"description": "Operator to compare the column value, either '>', '<', '>=', '<=', '='", # noqa: E501
3030
},
3131
"value": {
3232
"type": "number",
@@ -36,11 +36,11 @@ def build_search_function() -> list[ChatCompletionToolParam]:
3636
},
3737
"rating_filter": {
3838
"type": "object",
39-
"description": "Filter search results based on ratings of restaurant (from 1 to 5 stars, with 5 the best)",
39+
"description": "Filter search results based on ratings of restaurant (from 1 to 5 stars, with 5 the best)", # noqa: E501
4040
"properties": {
4141
"comparison_operator": {
4242
"type": "string",
43-
"description": "Operator to compare the column value, either '>', '<', '>=', '<=', '='",
43+
"description": "Operator to compare the column value, either '>', '<', '>=', '<=', '='", # noqa: E501
4444
},
4545
"value": {
4646
"type": "string",
@@ -69,7 +69,11 @@ def extract_search_arguments(original_user_query: str, chat_completion: ChatComp
6969
arg = json.loads(function.arguments)
7070
# Even though its required, search_query is not always specified
7171
search_query = arg.get("search_query", original_user_query)
72-
if "price_level_filter" in arg and arg["price_level_filter"] and isinstance(arg["price_level_filter"], dict):
72+
if (
73+
"price_level_filter" in arg
74+
and arg["price_level_filter"]
75+
and isinstance(arg["price_level_filter"], dict)
76+
):
7377
price_level_filter = arg["price_level_filter"]
7478
filters.append(
7579
{

src/backend/fastapi_app/seed_data.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90799,4 +90799,4 @@
9079990799
-0.057345152
9080090800
]
9080190801
}
90802-
]
90802+
]

0 commit comments

Comments
 (0)