Notebooks
M
MongoDB
Mongodb Voyage Ai Openai Rag Hybrid Agentic Sports Scores

Mongodb Voyage Ai Openai Rag Hybrid Agentic Sports Scores

agentsartificial-intelligencellmsmongodb-genai-showcasenotebooksgenerative-airag

MongoDB Atlas Vector Search with VoyageAI Embeddings for Sports Scores and Stories

This notebook demonstrates how to use VoyageAI embeddings with MongoDB Atlas Vector Search for retrieving relevant sports scores and stories based on user queries.

Overview

In this tutorial, we'll learn how to:

  1. Connect to MongoDB Atlas and retrieve sports data
  2. Generate embeddings using VoyageAI's embedding models
  3. Store these embeddings in MongoDB
  4. Create and use a vector search index for semantic similarity search
  5. Use hybrid search for result tuning.
  6. Implement a RAG (Retrieval-Augmented Generation) system to answer questions about sports teams and matches
  7. Showing how Agentic rag changes the results by using hybrid search as tools for an ai-agent built with the openai-agent sdk.

This approach combines the power of vector embeddings with natural language processing to provide relevant sports information based on user queries.

Setup and Configuration

First, let's import the necessary libraries and set up our environment. We'll need libraries for data manipulation, machine learning, visualization, and MongoDB connectivity.

[ ]
Collecting voyageai
  Downloading voyageai-0.3.2-py3-none-any.whl.metadata (2.6 kB)
Collecting pymongo
  Downloading pymongo-4.11.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (22 kB)
Requirement already satisfied: numpy in /usr/local/lib/python3.11/dist-packages (2.0.2)
Requirement already satisfied: pandas in /usr/local/lib/python3.11/dist-packages (2.2.2)
Requirement already satisfied: matplotlib in /usr/local/lib/python3.11/dist-packages (3.10.0)
Requirement already satisfied: scikit-learn in /usr/local/lib/python3.11/dist-packages (1.6.1)
Requirement already satisfied: python-dotenv in /usr/local/lib/python3.11/dist-packages (1.1.0)
Requirement already satisfied: openai in /usr/local/lib/python3.11/dist-packages (1.68.2)
Requirement already satisfied: aiohttp in /usr/local/lib/python3.11/dist-packages (from voyageai) (3.11.14)
Collecting aiolimiter (from voyageai)
  Downloading aiolimiter-1.2.1-py3-none-any.whl.metadata (4.5 kB)
Requirement already satisfied: pillow in /usr/local/lib/python3.11/dist-packages (from voyageai) (11.1.0)
Requirement already satisfied: pydantic>=1.10.8 in /usr/local/lib/python3.11/dist-packages (from voyageai) (2.10.6)
Requirement already satisfied: requests in /usr/local/lib/python3.11/dist-packages (from voyageai) (2.32.3)
Requirement already satisfied: tenacity in /usr/local/lib/python3.11/dist-packages (from voyageai) (9.0.0)
Requirement already satisfied: tokenizers>=0.14.0 in /usr/local/lib/python3.11/dist-packages (from voyageai) (0.21.1)
Collecting dnspython<3.0.0,>=1.16.0 (from pymongo)
  Downloading dnspython-2.7.0-py3-none-any.whl.metadata (5.8 kB)
Requirement already satisfied: python-dateutil>=2.8.2 in /usr/local/lib/python3.11/dist-packages (from pandas) (2.8.2)
Requirement already satisfied: pytz>=2020.1 in /usr/local/lib/python3.11/dist-packages (from pandas) (2025.1)
Requirement already satisfied: tzdata>=2022.7 in /usr/local/lib/python3.11/dist-packages (from pandas) (2025.1)
Requirement already satisfied: contourpy>=1.0.1 in /usr/local/lib/python3.11/dist-packages (from matplotlib) (1.3.1)
Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.11/dist-packages (from matplotlib) (0.12.1)
Requirement already satisfied: fonttools>=4.22.0 in /usr/local/lib/python3.11/dist-packages (from matplotlib) (4.56.0)
Requirement already satisfied: kiwisolver>=1.3.1 in /usr/local/lib/python3.11/dist-packages (from matplotlib) (1.4.8)
Requirement already satisfied: packaging>=20.0 in /usr/local/lib/python3.11/dist-packages (from matplotlib) (24.2)
Requirement already satisfied: pyparsing>=2.3.1 in /usr/local/lib/python3.11/dist-packages (from matplotlib) (3.2.1)
Requirement already satisfied: scipy>=1.6.0 in /usr/local/lib/python3.11/dist-packages (from scikit-learn) (1.14.1)
Requirement already satisfied: joblib>=1.2.0 in /usr/local/lib/python3.11/dist-packages (from scikit-learn) (1.4.2)
Requirement already satisfied: threadpoolctl>=3.1.0 in /usr/local/lib/python3.11/dist-packages (from scikit-learn) (3.6.0)
Requirement already satisfied: anyio<5,>=3.5.0 in /usr/local/lib/python3.11/dist-packages (from openai) (4.9.0)
Requirement already satisfied: distro<2,>=1.7.0 in /usr/local/lib/python3.11/dist-packages (from openai) (1.9.0)
Requirement already satisfied: httpx<1,>=0.23.0 in /usr/local/lib/python3.11/dist-packages (from openai) (0.28.1)
Requirement already satisfied: jiter<1,>=0.4.0 in /usr/local/lib/python3.11/dist-packages (from openai) (0.9.0)
Requirement already satisfied: sniffio in /usr/local/lib/python3.11/dist-packages (from openai) (1.3.1)
Requirement already satisfied: tqdm>4 in /usr/local/lib/python3.11/dist-packages (from openai) (4.67.1)
Requirement already satisfied: typing-extensions<5,>=4.11 in /usr/local/lib/python3.11/dist-packages (from openai) (4.12.2)
Requirement already satisfied: idna>=2.8 in /usr/local/lib/python3.11/dist-packages (from anyio<5,>=3.5.0->openai) (3.10)
Requirement already satisfied: certifi in /usr/local/lib/python3.11/dist-packages (from httpx<1,>=0.23.0->openai) (2025.1.31)
Requirement already satisfied: httpcore==1.* in /usr/local/lib/python3.11/dist-packages (from httpx<1,>=0.23.0->openai) (1.0.7)
Requirement already satisfied: h11<0.15,>=0.13 in /usr/local/lib/python3.11/dist-packages (from httpcore==1.*->httpx<1,>=0.23.0->openai) (0.14.0)
Requirement already satisfied: annotated-types>=0.6.0 in /usr/local/lib/python3.11/dist-packages (from pydantic>=1.10.8->voyageai) (0.7.0)
Requirement already satisfied: pydantic-core==2.27.2 in /usr/local/lib/python3.11/dist-packages (from pydantic>=1.10.8->voyageai) (2.27.2)
Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.11/dist-packages (from python-dateutil>=2.8.2->pandas) (1.17.0)
Requirement already satisfied: huggingface-hub<1.0,>=0.16.4 in /usr/local/lib/python3.11/dist-packages (from tokenizers>=0.14.0->voyageai) (0.29.3)
Requirement already satisfied: aiohappyeyeballs>=2.3.0 in /usr/local/lib/python3.11/dist-packages (from aiohttp->voyageai) (2.6.1)
Requirement already satisfied: aiosignal>=1.1.2 in /usr/local/lib/python3.11/dist-packages (from aiohttp->voyageai) (1.3.2)
Requirement already satisfied: attrs>=17.3.0 in /usr/local/lib/python3.11/dist-packages (from aiohttp->voyageai) (25.3.0)
Requirement already satisfied: frozenlist>=1.1.1 in /usr/local/lib/python3.11/dist-packages (from aiohttp->voyageai) (1.5.0)
Requirement already satisfied: multidict<7.0,>=4.5 in /usr/local/lib/python3.11/dist-packages (from aiohttp->voyageai) (6.2.0)
Requirement already satisfied: propcache>=0.2.0 in /usr/local/lib/python3.11/dist-packages (from aiohttp->voyageai) (0.3.0)
Requirement already satisfied: yarl<2.0,>=1.17.0 in /usr/local/lib/python3.11/dist-packages (from aiohttp->voyageai) (1.18.3)
Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.11/dist-packages (from requests->voyageai) (3.4.1)
Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/local/lib/python3.11/dist-packages (from requests->voyageai) (2.3.0)
Requirement already satisfied: filelock in /usr/local/lib/python3.11/dist-packages (from huggingface-hub<1.0,>=0.16.4->tokenizers>=0.14.0->voyageai) (3.18.0)
Requirement already satisfied: fsspec>=2023.5.0 in /usr/local/lib/python3.11/dist-packages (from huggingface-hub<1.0,>=0.16.4->tokenizers>=0.14.0->voyageai) (2025.3.0)
Requirement already satisfied: pyyaml>=5.1 in /usr/local/lib/python3.11/dist-packages (from huggingface-hub<1.0,>=0.16.4->tokenizers>=0.14.0->voyageai) (6.0.2)
Downloading voyageai-0.3.2-py3-none-any.whl (25 kB)
Downloading pymongo-4.11.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.4 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.4/1.4 MB 26.0 MB/s eta 0:00:00
Downloading dnspython-2.7.0-py3-none-any.whl (313 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 313.6/313.6 kB 20.6 MB/s eta 0:00:00
Downloading aiolimiter-1.2.1-py3-none-any.whl (6.7 kB)
Installing collected packages: dnspython, aiolimiter, pymongo, voyageai
Successfully installed aiolimiter-1.2.1 dnspython-2.7.0 pymongo-4.11.3 voyageai-0.3.2
[ ]
False

Environment Variables

We'll use environment variables to store sensitive information like API keys and connection strings. These should be stored in a .env file in the same directory as this notebook.

Example .env file content:

	MONGODB_URI=mongodb+srv://username:password@cluster.mongodb.net/
VOYAGE_API_KEY=your_voyage_api_key_here
OPENAI_API_KEY=your_openai_api_key_here

[3]
Enter your MongoDB connection string: ··········
Enter your VoyageAI API key: ··········
Enter your OpenAI API key: ··········
Environment variables loaded successfully

MongoDB Configuration

Now let's set up our MongoDB connection and define the database and collections we'll be using.

[6]
MongoDB connection successful

VoyageAI Embeddings

Next, we'll create a class to handle generating embeddings using VoyageAI's API. Embeddings are vector representations of text that capture semantic meaning, allowing us to perform operations like similarity search.

[7]

Understanding Embeddings

Embeddings are dense vector representations of text that capture semantic meaning. The VoyageAI model we're using (voyage-3) generates 1024-dimensional vectors for each text input. These vectors have several important properties:

  1. Semantic similarity: Texts with similar meanings will have embeddings that are close to each other in the vector space
  2. Dimensionality: The high-dimensional space allows for capturing complex relationships between concepts
  3. Language understanding: The model has been trained on vast amounts of text data to understand language nuances

In our case, we'll use these embeddings to represent sports data in a way that captures the semantic meaning of team names, match descriptions, and news stories.

Sample Data Generation

For demonstration purposes, let's create some sample sports data. In a real-world scenario, this data would come from an API or another data source.

[ ]
Generating sample sports data...
Inserted 15 teams, 7 matches, and 5 news stories

Data Processing and Embedding Generation

Now let's define functions to process our sports data and generate embeddings.

[ ]
[ ]
[ ]
Generating embeddings for sports data...
Processed 15/15 embeddings
Processed 7/7 embeddings
Processed 5/5 embeddings
Saved 27 embedding records to MongoDB
Setting up Vector Search Index in MongoDB Atlas...
Note: To create the vector search index in MongoDB Atlas:
1. Go to the MongoDB Atlas dashboard
2. Select your cluster
3. Go to the 'Search' tab
4. Create a new index on 'vector_features'with the following configuration:

   {
  "fields": [
    {
      "type": "vector",
      "path": "embedding",
      "numDimensions": 1024,
      "similarity": "cosine"
    }
  ]
}
    
Name the index: voyage_vector_index
5. Apply the index to the vector_features collection
[ ]
Testing vector search with example queries:

==================================================
QUERY: Recent Manchester United games
==================================================
Performing vector search for: Recent Manchester United games
Found 10 relevant items:
1. Team: Manchester United (Score: 0.7876)
2. Match: MNU vs LIV (2-1) (Score: 0.7315)
3. News: Manchester United's Bruno Fernandes wins Player of the Month (Score: 0.7312)
4. Team: Manchester City (Score: 0.7214)
5. Team: Chelsea (Score: 0.6717)
6. News: Manchester City's Erling Haaland on track to break Premier League scoring record (Score: 0.6715)
7. Match: ARS vs MNC (1-1) (Score: 0.6690)
8. Team: Tottenham Hotspur (Score: 0.6638)
9. Team: Atletico Madrid (Score: 0.6635)
10. Team: Arsenal (Score: 0.6631)

==================================================
QUERY: The Red Devils, how did they do?
==================================================
Performing vector search for: The Red Devils, how did they do?
Found 10 relevant items:
1. Team: Manchester United (Score: 0.6628)
2. Team: Borussia Dortmund (Score: 0.6567)
3. Team: Juventus (Score: 0.6364)
4. Match: JUV vs INT (1-1) (Score: 0.6277)
5. Team: Bayern Munich (Score: 0.6154)
6. Team: Liverpool (Score: 0.6116)
7. Team: Paris Saint-Germain (Score: 0.6052)
8. Team: Manchester City (Score: 0.6021)
9. Match: ARS vs MNC (1-1) (Score: 0.6014)
10. Team: AC Milan (Score: 0.6007)

==================================================
QUERY: Who won El Clasico?
==================================================
Performing vector search for: Who won El Clasico?
Found 10 relevant items:
1. News: Barcelona's Lamine Yamal becomes youngest El Clásico goalscorer (Score: 0.7120)
2. Match: BAR vs RMA (3-2) (Score: 0.7113)
3. Team: Real Madrid (Score: 0.6963)
4. Team: Atletico Madrid (Score: 0.6953)
5. Match: ATM vs BAR (1-2) (Score: 0.6768)
6. News: Bayern Munich's Harry Kane scores perfect hat-trick in Der Klassiker (Score: 0.6362)
7. Team: Barcelona (Score: 0.6337)
8. Team: AC Milan (Score: 0.6280)
9. Team: Inter Milan (Score: 0.6269)
10. Match: BAY vs BVB (4-0) (Score: 0.6234)

==================================================
QUERY: Premier League match results
==================================================
Performing vector search for: Premier League match results
Found 10 relevant items:
1. Team: Tottenham Hotspur (Score: 0.7127)
2. Team: Chelsea (Score: 0.6972)
3. Team: Manchester City (Score: 0.6942)
4. Match: ARS vs MNC (1-1) (Score: 0.6912)
5. Team: Liverpool (Score: 0.6910)
6. Team: Arsenal (Score: 0.6883)
7. Team: Manchester United (Score: 0.6875)
8. Match: MNU vs LIV (2-1) (Score: 0.6852)
9. Match: CHE vs TOT (3-0) (Score: 0.6846)
10. News: Bayern Munich's Harry Kane scores perfect hat-trick in Der Klassiker (Score: 0.6694)

==================================================
QUERY: Player injuries news
==================================================
Performing vector search for: Player injuries news
Found 10 relevant items:
1. News: Liverpool suffer injury blow as Salah ruled out for three weeks (Score: 0.7018)
2. Team: Inter Milan (Score: 0.6357)
3. Team: Manchester United (Score: 0.6354)
4. Team: Tottenham Hotspur (Score: 0.6344)
5. Team: Chelsea (Score: 0.6288)
6. Team: Juventus (Score: 0.6286)
7. Team: Paris Saint-Germain (Score: 0.6244)
8. Team: Real Madrid (Score: 0.6239)
9. Team: Atletico Madrid (Score: 0.6221)
10. Team: Manchester City (Score: 0.6215)

==================================================
QUERY: Bayern Munich performance
==================================================
Performing vector search for: Bayern Munich performance
Found 10 relevant items:
1. Team: Bayern Munich (Score: 0.8020)
2. News: Bayern Munich's Harry Kane scores perfect hat-trick in Der Klassiker (Score: 0.7724)
3. Match: BAY vs BVB (4-0) (Score: 0.7520)
4. Team: Borussia Dortmund (Score: 0.6945)
5. Team: Barcelona (Score: 0.6800)
6. Team: Real Madrid (Score: 0.6786)
7. Team: Paris Saint-Germain (Score: 0.6771)
8. Match: ATM vs BAR (1-2) (Score: 0.6743)
9. Team: Inter Milan (Score: 0.6734)
10. Team: Atletico Madrid (Score: 0.6693)

Hybrid Search

Hybrid Search allows combination of full text search for text token matching with vector search for semantic mapping.

[ ]
[8]
[9]
Testing vector search with default wieghts example queries:

==================================================
QUERY: Recent Manchester United games
==================================================
Found 5 relevant items:
1. Team: Manchester United (Score: 0.0083)
2. Team: Manchester United (Score: 0.0083)
3. News: Manchester United's Bruno Fernandes wins Player of the Month (Score: 0.0082)
4. Match: MNU vs LIV (2-1) (Score: 0.0082)
5. News: Manchester United's Bruno Fernandes wins Player of the Month (Score: 0.0081)
Testing vector search with favor of vector wieghts example queries:

==================================================
QUERY: The Red Devils, how did they do?
==================================================
Found 5 relevant items:
1. Team: Chelsea (Score: 0.0083)
2. Team: Manchester United (Score: 0.0083)
3. Team: Liverpool (Score: 0.0082)
4. Team: Borussia Dortmund (Score: 0.0082)
5. Team: Juventus (Score: 0.0081)
Testing vector search with favor of vector wieghts example queries:

==================================================
QUERY: Who won El Clasico?
==================================================
Found 5 relevant items:
1. News: Barcelona's Lamine Yamal becomes youngest El Clásico goalscorer (Score: 0.0083)
2. News: Barcelona's Lamine Yamal becomes youngest El Clásico goalscorer (Score: 0.0083)
3. Match: CHE vs TOT (3-0) (Score: 0.0082)
4. Match: BAR vs RMA (3-2) (Score: 0.0082)
5. Team: Real Madrid (Score: 0.0081)
Testing vector search with favor of vector wieghts example queries:

==================================================
QUERY: Premier League match results
==================================================
Found 5 relevant items:
1. News: Manchester City's Erling Haaland on track to break Premier League scoring record (Score: 0.0083)
2. Team: Tottenham Hotspur (Score: 0.0083)
3. Match: CHE vs TOT (3-0) (Score: 0.0082)
4. Team: Chelsea (Score: 0.0082)
5. Team: Manchester City (Score: 0.0081)
Testing vector search with favor of vector wieghts example queries:

==================================================
QUERY: Player injuries news
==================================================
Found 5 relevant items:
1. News: Manchester United's Bruno Fernandes wins Player of the Month (Score: 0.0083)
2. News: Liverpool suffer injury blow as Salah ruled out for three weeks (Score: 0.0083)
3. News: Liverpool suffer injury blow as Salah ruled out for three weeks (Score: 0.0082)
4. Team: Inter Milan (Score: 0.0082)
5. Team: Manchester United (Score: 0.0081)
Testing vector search with favor of vector wieghts example queries:

==================================================
QUERY: Bayern Munich performance
==================================================
Found 5 relevant items:
1. News: Bayern Munich's Harry Kane scores perfect hat-trick in Der Klassiker (Score: 0.0083)
2. Team: Bayern Munich (Score: 0.0083)
3. Team: Bayern Munich (Score: 0.0082)
4. News: Bayern Munich's Harry Kane scores perfect hat-trick in Der Klassiker (Score: 0.0082)
5. Match: BAY vs BVB (4-0) (Score: 0.0081)
Testing vector search with favor of vector wieghts example queries:

==================================================
QUERY: Recent Manchester United games
==================================================
Found 5 relevant items:
1. Team: Manchester United (Score: 0.0150)
2. Match: MNU vs LIV (2-1) (Score: 0.0148)
3. News: Manchester United's Bruno Fernandes wins Player of the Month (Score: 0.0145)
4. Team: Manchester City (Score: 0.0143)
5. Team: Chelsea (Score: 0.0141)

==================================================
QUERY: The Red Devils, how did they do?
==================================================
Found 5 relevant items:
1. Team: Manchester United (Score: 0.0150)
2. Team: Borussia Dortmund (Score: 0.0148)
3. Team: Juventus (Score: 0.0145)
4. Match: JUV vs INT (1-1) (Score: 0.0143)
5. Team: Bayern Munich (Score: 0.0141)

==================================================
QUERY: Who won El Clasico?
==================================================
Found 5 relevant items:
1. News: Barcelona's Lamine Yamal becomes youngest El Clásico goalscorer (Score: 0.0150)
2. Match: BAR vs RMA (3-2) (Score: 0.0148)
3. Team: Real Madrid (Score: 0.0145)
4. Team: Atletico Madrid (Score: 0.0143)
5. Match: ATM vs BAR (1-2) (Score: 0.0141)

==================================================
QUERY: Premier League match results
==================================================
Found 5 relevant items:
1. Team: Tottenham Hotspur (Score: 0.0150)
2. Team: Chelsea (Score: 0.0148)
3. Team: Manchester City (Score: 0.0145)
4. Match: ARS vs MNC (1-1) (Score: 0.0143)
5. Team: Liverpool (Score: 0.0141)

==================================================
QUERY: Player injuries news
==================================================
Found 5 relevant items:
1. News: Liverpool suffer injury blow as Salah ruled out for three weeks (Score: 0.0150)
2. Team: Inter Milan (Score: 0.0148)
3. Team: Manchester United (Score: 0.0145)
4. Team: Tottenham Hotspur (Score: 0.0143)
5. Team: Chelsea (Score: 0.0141)

==================================================
QUERY: Bayern Munich performance
==================================================
Found 5 relevant items:
1. Team: Bayern Munich (Score: 0.0150)
2. News: Bayern Munich's Harry Kane scores perfect hat-trick in Der Klassiker (Score: 0.0148)
3. Match: BAY vs BVB (4-0) (Score: 0.0145)
4. Team: Borussia Dortmund (Score: 0.0143)
5. Team: Barcelona (Score: 0.0141)

RAG with OpenAI

RAG is a pipeline that loads similarity or hybrid context into an LLM to produce a relevant response considering a specific question.

[ ]
[ ]
Testing hybrid search with example queries:
==================================================
Found 5 relevant items:
1. News: Barcelona's Lamine Yamal becomes youngest El Clásico goalscorer (Score: 0.0083)
2. News: Barcelona's Lamine Yamal becomes youngest El Clásico goalscorer (Score: 0.0083)
3. Match: CHE vs TOT (3-0) (Score: 0.0082)
4. Match: BAR vs RMA (3-2) (Score: 0.0082)
5. Team: Real Madrid (Score: 0.0081)
====================Hybrid RAG====================
Response (Hybrid Search): Barcelona won El Clásico, defeating Real Madrid with a score of 3-2 at Camp Nou.

Testing vector search with example queries:
==================================================
Performing vector search for: Who won El Clasico?
Found 5 relevant items:
1. News: Barcelona's Lamine Yamal becomes youngest El Clásico goalscorer (Score: 0.7120)
2. Match: BAR vs RMA (3-2) (Score: 0.7113)
3. Team: Real Madrid (Score: 0.6963)
4. Team: Atletico Madrid (Score: 0.6953)
5. Match: ATM vs BAR (1-2) (Score: 0.6768)
====================Vector RAG====================
Response (Vector Search): Barcelona won El Clásico against Real Madrid with a 3-2 victory at Camp Nou.
[ ]

Agentic RAG with Hybrid Search

Here we will use the openai-agents sdk to use the "hybrid_search" function as a tool. This helps the AI to better tailor the search term we pass to the tools and can perform multiple step tasks.

[1]
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 106.5/106.5 kB 4.0 MB/s eta 0:00:00
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 129.1/129.1 kB 4.8 MB/s eta 0:00:00
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 76.1/76.1 kB 2.9 MB/s eta 0:00:00
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 72.0/72.0 kB 4.8 MB/s eta 0:00:00
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 62.3/62.3 kB 2.9 MB/s eta 0:00:00
[10]
[13]
[22]
Testing agentic hybrid search with example queries:
==================================================

==================================================
QUERY: Recent Manchester United games
==================================================
Found 5 relevant items:
1. Team: Manchester United (Score: 0.0117)
2. Match: MNU vs LIV (2-1) (Score: 0.0115)
3. News: Manchester United's Bruno Fernandes wins Player of the Month (Score: 0.0113)
4. Team: Manchester City (Score: 0.0111)
5. Team: Chelsea (Score: 0.0109)
WARNING:openai.agents:OPENAI_API_KEY is not set, skipping trace export
Here are some of the recent Manchester United games:

1. **Against Liverpool**  
   Date: March 24, 2025  
   Competition: Premier League  
   Score: Manchester United 2 - 1 Liverpool  
   **Summary:** Manchester United secured a thrilling 2-1 victory over Liverpool at Old Trafford. Bruno Fernandes opened the scoring with a penalty in the 34th minute, before Marcus Rashford doubled the lead with a brilliant solo effort. Mohamed Salah pulled one back for Liverpool, but United held on for a crucial win.

Bruno Fernandes has also been in sizzling form, winning the Premier League Player of the Month award for March. He scored 4 goals and provided 3 assists in 5 matches. Go Bruno! 🎉

Would you like to know more about any specific game or player? 😊
==================================================

==================================================
QUERY: The Red Devils, how did they do?
==================================================
Found 5 relevant items:
1. Team: Manchester United (Score: 0.0083)
2. Team: Manchester United (Score: 0.0083)
3. Match: BAR vs RMA (3-2) (Score: 0.0082)
4. Team: Borussia Dortmund (Score: 0.0082)
5. Team: Liverpool (Score: 0.0081)
WARNING:openai.agents:OPENAI_API_KEY is not set, skipping trace export
I couldn't find the latest match results for the Red Devils (Manchester United). However, they are known as one of the top teams in the Premier League! Would you like more info or try a different search? ⚽
==================================================

==================================================
QUERY: Who won El Clasico?
==================================================
Found 1 relevant items:
1. News: Barcelona's Lamine Yamal becomes youngest El Clásico goalscorer (Score: 0.0083)
Barcelona won the latest El Clásico against Real Madrid with a score of 3-2! Lamine Yamal made history by becoming the youngest goalscorer at just 16 years and 107 days old. How amazing is that? 🎉⚽🎉
==================================================

==================================================
QUERY: Premier League match results
==================================================
WARNING:openai.agents:OPENAI_API_KEY is not set, skipping trace export
Found 5 relevant items:
1. News: Manchester City's Erling Haaland on track to break Premier League scoring record (Score: 0.0083)
2. Team: Tottenham Hotspur (Score: 0.0083)
3. Match: CHE vs TOT (3-0) (Score: 0.0082)
4. Team: Chelsea (Score: 0.0082)
5. Team: Manchester City (Score: 0.0081)
Here's an exciting recent Premier League match result for you:

- **Chelsea vs Tottenham Hotspur**
  - **Date**: March 25, 2025
  - **Stadium**: Stamford Bridge
  - **Result**: Chelsea 3-0 Tottenham Hotspur
  - **Summary**: Chelsea dominated the London derby with a 3-0 victory at Stamford Bridge. Cole Palmer scored twice in the first half, and Nicolas Jackson added a third goal in the 78th minute. Spurs found it difficult to create any clear chances throughout the match.

If you want more match results or details, just let me know! 🎉⚽
==================================================

==================================================
QUERY: Player injuries news
==================================================
WARNING:openai.agents:OPENAI_API_KEY is not set, skipping trace export
Found 5 relevant items:
1. News: Manchester United's Bruno Fernandes wins Player of the Month (Score: 0.0083)
2. News: Liverpool suffer injury blow as Salah ruled out for three weeks (Score: 0.0083)
3. Match: ARS vs MNC (1-1) (Score: 0.0082)
4. Team: Inter Milan (Score: 0.0082)
5. Team: Manchester United (Score: 0.0081)
WARNING:openai.agents:OPENAI_API_KEY is not set, skipping trace export
Here's some fresh injury news from the world of sports:

### Liverpool:

- **Mohamed Salah** is facing a setback! 😢 The star forward has been ruled out for three weeks due to a hamstring strain. He sustained the injury during Liverpool's recent match against Manchester United. This comes at a bad time as Liverpool prepares to face off against Arsenal and Manchester City. Manager Jürgen Klopp described the situation as "unfortunate timing." 

Stay tuned for more updates! ⚽🔍
==================================================

==================================================
QUERY: Bayern Munich performance
==================================================
WARNING:openai.agents:OPENAI_API_KEY is not set, skipping trace export
Found 5 relevant items:
1. News: Bayern Munich's Harry Kane scores perfect hat-trick in Der Klassiker (Score: 0.0083)
2. Team: Bayern Munich (Score: 0.0083)
3. Team: Bayern Munich (Score: 0.0082)
4. News: Bayern Munich's Harry Kane scores perfect hat-trick in Der Klassiker (Score: 0.0082)
5. Match: BAY vs BVB (4-0) (Score: 0.0081)
Bayern Munich is on fire! 🎉

1. **Harry Kane's Hat-Trick Magic**: Harry Kane recently scored a *perfect hat-trick* (right foot, left foot, and header) as Bayern Munich crushed Borussia Dortmund 4-0 in Der Klassiker. Kane, who joined from Tottenham, is thriving in the Bundesliga, saying he's loving his time in Munich and the fantastic football they're playing!

2. **Match Details**: In that same match, apart from Kane's brilliant performance, Leroy Sané also got on the scoresheet, leading Bayern to a dominant victory at the Allianz Arena.

Bayern Munich is clearly playing some dazzling football right now! ⚽🥳
==================================================