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 research documents by meaning, not keywords.


Exercise

1. Load your research documents 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 document

Click any document to see its fields:

Redis Insight browse

Field Type
company_id text
ticker text
document_id text
section_heading text
page_label text
chunk_text text
content_embedding vector

4. Open your exercise file

Open exercises/finance/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=["company_id", "ticker", "document_id", "section_heading", "page_label", "chunk_text"],
    num_results=3,
)

Verify

Restart the server (Ctrl+C then):

make dev
.\workshop.ps1 dev

Open localhost:3040.

  • Ask: "What are NVIDIA's latest revenue trends?"
  • Click Vector-search-policies in the right activity panel to see the results