ensure that python works

This commit is contained in:
Nathan LeRoy
2026-03-17 13:49:20 -04:00
parent 1b4851aafc
commit b8c8a13eff
@@ -239,7 +239,7 @@ for i, menu_item in enumerate(menu_items):
vector=Document( vector=Document(
text=f"{menu_item[0]} {menu_item[1]}", text=f"{menu_item[0]} {menu_item[1]}",
model="sentence-transformers/all-MiniLM-L6-v2" model="sentence-transformers/all-MiniLM-L6-v2"
) ),
payload={ payload={
"item_name": menu_items[i][0], "item_name": menu_items[i][0],
"description": menu_items[i][1], "description": menu_items[i][1],
@@ -699,17 +699,16 @@ client
``` ```
## 6. Search the Menu Items ## 6. Search the Menu Items
Now we can search the menu item dataset! We'll use the same `BAAI/bge-small-en-v1.5` model to embed our query text, then find the best dishes matching that embedding. Now we can search the menu item dataset! We'll use the same `sentence-transformers/all-MiniLM-L6-v2` model in Cloud Inference to embed our query text, then find the best dishes matching that embedding.
```python ```python
# generate query embedding # generate query embedding
query_text = "vegetarian dishes" query_text = "vegetarian dishes"
query_vector = next(iter(model.embed(query_text)))
# search for similar menu items # search for similar menu items
results = client.query_points( results = client.query_points(
collection_name="items", collection_name="items",
query=query_vector, query=Document(text=query_text, model="sentence-transformers/all-MiniLM-L6-v2"),
with_payload=True, with_payload=True,
limit=5 limit=5
) )