11from __future__ import annotations
22
33from pgvector .sqlalchemy import Vector
4- from sqlalchemy import VARCHAR , Index
5- from sqlalchemy .dialects import postgresql
4+ from sqlalchemy import Index
65from sqlalchemy .orm import DeclarativeBase , Mapped , mapped_column
76
87
@@ -13,19 +12,14 @@ class Base(DeclarativeBase):
1312
1413class Item (Base ):
1514 __tablename__ = "items"
16- id : Mapped [int ] = mapped_column (primary_key = True , autoincrement = True )
15+ id : Mapped [str ] = mapped_column (primary_key = True )
1716 name : Mapped [str ] = mapped_column ()
18- location : Mapped [str ] = mapped_column ()
1917 cuisine : Mapped [str ] = mapped_column ()
2018 rating : Mapped [int ] = mapped_column ()
2119 price_level : Mapped [int ] = mapped_column ()
2220 review_count : Mapped [int ] = mapped_column ()
23- hours : Mapped [str ] = mapped_column ()
24- tags : Mapped [list [str ]] = mapped_column (postgresql .ARRAY (VARCHAR )) # Array of strings
2521 description : Mapped [str ] = mapped_column ()
2622 menu_summary : Mapped [str ] = mapped_column ()
27- top_reviews : Mapped [str ] = mapped_column ()
28- vibe : Mapped [str ] = mapped_column ()
2923
3024 # Embeddings for different models:
3125 embedding_3l : Mapped [Vector ] = mapped_column (Vector (1024 ), nullable = True ) # text-embedding-3-large
@@ -42,10 +36,10 @@ def to_dict(self, include_embedding: bool = False):
4236 return model_dict
4337
4438 def to_str_for_rag (self ):
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
39+ return f"Name:{ self .name } Description:{ self .description } Cuisine:{ self .cuisine } Rating:{ self .rating } Price Level:{ self .price_level } Review Count:{ self .review_count } Menu Summary:{ self .menu_summary } " # noqa: E501
4640
4741 def to_str_for_embedding (self ):
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
42+ return f"Name: { self .name } Description: { self .description } Cuisine: { self .cuisine } Menu Summary: { self .menu_summary } " # noqa: E501
4943
5044
5145"""
0 commit comments