Skip to content

Commit

Permalink
feat: update airport dataset and add search endpoint (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuan325 authored and duwenxin99 committed Oct 24, 2023
1 parent 1d5bf47 commit 1c56f4b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
21 changes: 18 additions & 3 deletions extension_service/app/app_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def test_get_airport(app):
def test_get_amenity(app):
with TestClient(app) as client:
response = client.get(
"/amenities",
"/airports",
params={
"id": 1,
},
Expand All @@ -77,10 +77,25 @@ def test_get_amenity(app):
assert output[0]


def test_get_airport(app):
def test_airports_semantic_lookup(app):
with TestClient(app) as client:
response = client.get(
"/airports",
"/airports/semantic_lookup",
params={
"query": "What is the airport in san francisco.",
"top_k": 5,
},
)
assert response.status_code == 200
output = response.json()
assert len(output) == 5
assert output[0]


def test_get_amenity(app):
with TestClient(app) as client:
response = client.get(
"/amenities",
params={
"id": 1,
},
Expand Down
6 changes: 0 additions & 6 deletions extension_service/app/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,6 @@ async def amenities_search(query: str, top_k: int, request: Request):
query_embedding = embed_service.embed_query(query)

results = await ds.amenities_search(query_embedding, 0.7, top_k)


@routes.get("/airports")
async def get_airport(id: int, request: Request):
ds: datastore.Client = request.app.state.datastore
results = await ds.get_airport(id)
return results


Expand Down

0 comments on commit 1c56f4b

Please sign in to comment.