Skip to content

Module 1: Vector Search


Your agent can't answer questions yet. In this module you'll connect it to Redis so it can search policy documents by meaning, not keywords.


Exercise

1. Load your policies into Redis

make seed-data
.\workshop.ps1 seed-data

2. See what you just loaded

Go to your database in Redis Cloud and click the three dotsLaunch Redis Insight Web.

Three dots menu


3. Explore a policy document

Click any document to see its fields:

Redis Insight browse

Field Type
policy_id text
title text
category text
content text
content_embedding vector

4. Open your exercise file

Open exercises/digital-native/vector_search.py in your IDE.


Replace return None with:

return VectorQuery(
    vector=embedding,
    vector_field_name="___",                    # which field stores the vectors?
    return_fields=["___", "___", "___", "___"], # which fields do you want back?
    num_results=3,
)
  • vector_field_name is the field with type vector
  • return_fields are the fields with type text
Show solution
return VectorQuery(
    vector=embedding,
    vector_field_name="content_embedding",
    return_fields=["policy_id", "title", "category", "content"],
    num_results=3,
)

Verify

Restart the server (Ctrl+C then):

make dev
.\workshop.ps1 dev

Open localhost:3040.

  • Ask: "Why is my order running late?"
  • Click Vector-search-policies in the right activity panel to see the results