Skip to content

Commit

Permalink
update amenity_dataset and conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuan325 committed Oct 23, 2023
1 parent 674ddd4 commit c876920
Show file tree
Hide file tree
Showing 5 changed files with 153 additions and 7 deletions.
142 changes: 142 additions & 0 deletions data/amenity_dataset.csv

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion extension_service/app/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@
# limitations under the License.


from fastapi import APIRouter
from fastapi import APIRouter, Request
from langchain.embeddings.base import Embeddings

import datastore

routes = APIRouter()

Expand Down
6 changes: 3 additions & 3 deletions extension_service/datastore/datastore.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,13 @@ async def export_data(
pass

@abstractmethod
async def get_amenity(self, id: int) -> List[Dict[str, Any]]:
async def get_amenity(self, id: int) -> list[Dict[str, Any]]:
raise NotImplementedError("Subclass should implement this!")

@abstractmethod
async def amenities_search(
self, query_embedding: List[float], similarity_threshold: float, top_k: int
) -> List[Dict[str, Any]]:
self, query_embedding: list[float], similarity_threshold: float, top_k: int
) -> list[Dict[str, Any]]:
raise NotImplementedError("Subclass should implement this!")

@abstractmethod
Expand Down
6 changes: 3 additions & 3 deletions extension_service/datastore/providers/postgres.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ async def export_data(

return airports, amenities

async def get_amenity(self, id: int) -> List[Dict[str, Any]]:
async def get_amenity(self, id: int) -> list[Dict[str, Any]]:
results = await self.__pool.fetch(
"""
SELECT name, description, location, terminal, category, hour
Expand All @@ -154,8 +154,8 @@ async def get_amenity(self, id: int) -> List[Dict[str, Any]]:
return results

async def amenities_search(
self, query_embedding: List[float], similarity_threshold: float, top_k: int
) -> List[Dict[str, Any]]:
self, query_embedding: list[float], similarity_threshold: float, top_k: int
) -> list[Dict[str, Any]]:
results = await self.__pool.fetch(
"""
SELECT name, description, location, terminal, category, hour
Expand Down
1 change: 1 addition & 0 deletions extension_service/run_database_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,6 @@ async def main():
for a in amenities:
writer.writerow(a.model_dump())


if __name__ == "__main__":
asyncio.run(main())

0 comments on commit c876920

Please sign in to comment.