Need advice storing structured JSON to VectorDB

Looking for some help, I’m a complete beginner to this
So I have specific business profiles i would like to store and have an agent do Q&A on the businesses.
What’s a good approach here?
How should I store this payload with multitenancy in mind?
Any input is greatly appreciated! thanks!

[
  {
    "id": "businessId1",
    "name": "Business Name 1",
    "description": "Short description of Business 1.",
    "contact": {
      "phone": "Contact Phone 1",
      "email": "Contact Email 1",
      "website": "Contact Website 1"
    },
    "locations": [
      {
        "id": "locationId1",
        "address": "Location Address 1",
        "services": [
          {
            "id": "serviceId1",
            "name": "Service Name 1",
            "description": "Short description of Service 1.",
            "pricing": [
              { "price": 1500, "currency": "THB", "duration": 60 }
            ]
          }
        ]
      }
    ]
  },
  {
    "id": "businessId2",
    "name": "Business Name 2",
    "description": "Short description of Business 2.",
    "contact": {
      "phone": "Contact Phone 2",
      "email": "Contact Email 2",
      "website": "Contact Website 2"
    },
    "locations": [
      {
        "id": "locationId2",
        "address": "Location Address 2",
        "services": [
          {
            "id": "serviceId2",
            "name": "Service Name 2",
            "description": "Short description of Service 2.",
            "pricing": [
              { "price": 1300, "currency": "THB", "duration": 60 }
            ]
          }
        ]
      }
    ]
  }
]```

Welcome to the community!

To be honest, I’d put that into a classical structured DB and let the model perform queries on it. You could maybe consider using a vector approach for the service descriptions :thinking:

Thanks for the reply here!

I’ve also considered doing that as well with forming queries with SQL, however, I haven’t crossed a solution where if user is asking about a specific service and does not match the name for querying directly

ex “Video Editing Service” is the name in the database

user prompts “how much for a vid edit?”

How many entries would a tenant have?

If a tenant has less than 1000 entries, I’d consider not even using an index for vector search.
On description search, I’d retrieve the (description vector, businessid) tuples from your tenant data table, compute cosims, grab your most likely candidates out of your document store or nosql or whatever and present them to your model

Bada bing bada boom

1 Like

Thanks for this! Guess i was thinking too deep into it. Yes a tenant would most likely have less than 1000 entries. This is my solution:

Create a table for
Business
Location
Service

embed title and description of the service to an embeddings field
embed location details for a location to a field

form additional queries if needed based on relationship Ids from k results

so if user asks initial question such as “where’s the branch in XYZ city”
i would be able to retrieve a location, and be able to perform SQL queries for services data from ids and vice versa

1 Like