File size: 1,871 Bytes
b54e32e
 
 
 
 
 
175d60b
b54e32e
 
 
 
 
dbef01a
 
 
 
 
 
 
 
dd4c4b0
dbef01a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c9ea09a
 
 
 
 
7b9edba
 
 
dbef01a
 
 
 
 
175d60b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
---
title: Whatscooking Advisor
emoji: 
colorFrom: indigo
colorTo: red
sdk: gradio
sdk_version: 4.37.2
app_file: app.py
pinned: false
license: apache-2.0
---


This simple restaurant planner is designed to communicate with MongoDB Atlas Vector Search with the loaded Restaurant data set. 

It uses OpenAI small text embeddings (256 dimesnsions) to query the database for semantic similarity search.

## How to setup your own

1. [Create an Atlas cluter](https://www.mongodb.com/docs/atlas/tutorial/deploy-free-tier-cluster/) (free clusters are available)
2. Load the [dataset](https://huggingface.co/datasets/AIatMongoDB/whatscooking.restaurants) using the `ingest.py` [script](https://huggingface.co/datasets/AIatMongoDB/whatscooking.restaurants#ingest-data) with your connection string.
3. Deploy the relevant [Vector Index](https://www.mongodb.com/docs/atlas/atlas-vector-search/vector-search-tutorial/#create-the-atlas-vector-search-index) on `whatscooking.smart_trips` aggregated collection "name" : `vector_index`.
 ```
 {
  "fields": [
    {
      "numDimensions": 256,
      "path": "embedding",
      "similarity": "cosine",
      "type": "vector"
    },
    {
      "path": "searchTrip",
      "type": "filter"
    }
  ]
}
```
Create a 2dsphere index on `restaurants` collection to allow geo queries on `location.coordinates`:
```
db.restaurants.createIndex({'location.coordinates' : "2dsphere"})
```


 - [Whitelist](https://www.mongodb.com/docs/atlas/security/ip-access-list/#std-label-access-list) access from everywhere (`0.0.0.0/0`)
 - Locate your [cluster connection](https://www.mongodb.com/docs/atlas/tutorial/connect-to-your-cluster/) URI 
5. Obtain your Open AI api key
6. "Duplicate" this space and input
     - `MONGODB_ATLAS_CLUSTER_URI` - Your Atlas Cluster connection string
     - `OPENAI_API_KEY`- Open AI API key

Build and use the planner!