Vector + Graph Retrieval Tool

Introduction

You will enhance your agent by adding a custom document retrieval tool that combines semantic search and vectors with graph traversal.

The agent decides automatically which tool is best for each question:

Schema Tool:

  • Understanding database structure

  • "What entities exist in the graph?"

  • "How are companies related to risk factors?"

Document Retrieval Tool:

  • Finding content with company context

  • "What are Microsoft’s main risk factors?"

  • "Tell me about cybersecurity threats mentioned by tech companies"

Two-Tool Agent

Open the notebook: 02_02_vector_graph_agent.ipynb

Add the Vector + Cypher Retriever as a second tool:

  1. Keep existing schema tool (from previous lesson)

  2. Add new document retrieval tool (vector search with graph context)

  3. Let agent choose between tools based on question

Now your agent can handle both simple semantic search AND contextual relationship queries.

Try These Questions

Try these questions to see tool selection:

Semantic Search (Vector Tool):

  • "What are the main risk factors mentioned in the documents?"

  • "Tell me about cybersecurity threats in financial services"

Contextual Search (Vector + Cypher Tool):

  • "What products does Microsoft mention in its financial documents?"

  • "How are companies connected through their mentioned products?"

Notice: The agent chooses the right tool automatically based on whether relationships are needed!

Summary

In this lesson, you enhanced your agent by adding the Vector + Cypher Retriever as a second tool:

Key Concepts:

  • Tool selection: Agent chooses between semantic and contextual search

  • Multi-tool agent: Two retrievers wrapped as conversational tools

  • Intelligent routing: Questions automatically matched to appropriate tool

What You Built:

  • Agent with two retriever tools

  • Automatic tool selection based on question type

  • Enhanced capability for both simple and contextual queries

Progress:

  • ✅ Vector Retriever tool (semantic search)

  • ✅ Vector + Cypher Retriever tool (contextual search)

  • ⏳ Text2Cypher Retriever tool (coming next!)

In the next lesson, you will add the final tool: Text2Cypher Retriever for precise database queries.

Chatbot

How can I help you today?