AWS for M&E Blog
Reinvent live sports search with generative AI on AWS
Imagine asking your TV, “When’s the next Formula One race?” and instantly getting accurate results. This is the future of live sports search, powered by generative AI. In an era where viewers expect quick and relevant information, traditional search methods often miss the mark, but a revolutionary solution is taking shape.
Generative AI is transforming how we discover and interact with live sports content. Unlike conventional full-text search engines, generative AI-powered systems grasp the intent behind queries, delivering more precise results. For TV broadcasters, this technology promises increased subscriber conversion and retention. Viewers benefit from seamless search experiences, allowing them to effortlessly find upcoming events, verify channel subscriptions, set reminders, and schedule recordings—all through natural language commands. With the increasing availability of voice-controlled devices, the potential for intuitive, conversational sports search continues to grow, reshaping how we engage with our favorite games and events.
This blog details how to build a solution for queries about live sports using Amazon Bedrock and generative AI agents. The solution lets live sports viewers dynamically query linear TV schedules. It uses the semantic search and metadata filtering capabilities of Amazon Bedrock Knowledge Bases and Amazon OpenSearch Serverless to retrieve highly tailored results. The solution can also extend to other linear TV genres and video on-demand (VOD) search applications.
Solution overview
The following architecture diagram provides a high-level overview of the proposed live sports search solution:
Key components of the architecture include:
- An Amazon API Gateway RESTful API to receive and respond to users’ requests.
- An AWS Lambda function running the generative AI agent that orchestrates calls to the underlying generative AI components.
- A large language model (LLM), an embedding model, and a knowledge base, all hosted on Amazon Bedrock.
- An Amazon Simple Storage Service (Amazon S3) bucket where TV schedule data is ingested into the knowledge base.
The solution incorporates two separate flows: the Data Ingestion flow and the User Query flow. The Data Ingestion flow is used to ingest and load curated live TV programming data into searchable data stores. The User Query flow receives and processes search queries for live sports events from end users, and returns the schedule details of the requested content.
1. Key definitions
Here are the definitions of some key concepts used in this blog:
- Embedding: The process of condensing information by transforming input into a vector of numerical values, known as embeddings. These are used to compare the similarity between different objects by using a shared numerical representation.
- Knowledge Bases: A feature of Amazon Bedrock that allows you to securely integrate proprietary data into generative AI applications and perform semantic or hybrid search queries.
- Data chunking: During ingestion of your data into a knowledge base, Amazon Bedrock splits each file or piece of content into chunks. This is typically used for ingesting large source files.
- Foundation model (FM): A pre-trained model that is used to perform tasks such as image classification, object detection, and natural language processing.
- LangChain: A framework for developing generative AI applications.
- LangChain ReAct agent: An application that carries out orchestration through cyclically interpreting inputs and producing outputs by using an FM. An agent can be used to carry out customer requests.
2. Data Ingestion flow
The solution uses Amazon Bedrock Knowledge Bases—leveraging the metadata filtering feature to improve the relevance of the results. The following is a description of how the Data Ingestion flow works:
Step 1 – For each sports event in the foreseeable linear TV schedule, two curated files are uploaded to the ingest S3 bucket:
- The semantic data file (
<event_filename>.json
) includes the main content for semantic search, such as the sports event description, synopsis, and the list of players. - The metadata file (
<event_filename>.json.metadata.json
) contains structured data used to filter and refine search results, including event start time, duration, broadcast type, and live event identifier.
Next is a sample of data ingestion files (semantics and then metadata) for a soccer game from the Premier League:
premier_league_event_1381.json
premier_league_event_1381.json.metadata.json
Step 2 – The event data files are ingested by the Amazon Bedrock Knowledge Bases with the following configurations:
- Chunking strategy: “No chunking” is used as the semantic data is curated and treated as a single chunk.
- Embeddings model: The Amazon Titan Text Embedding v2 model is used.
- For the Vector store, the Amazon OpenSearch Serverless service is selected.
The solution supports multiple knowledge bases for different media content types.
Step 3 – Next, the semantic data file is transformed into embeddings by the Amazon Titan Text Embedding v2 model.
Step 4 – Lastly, the generated embeddings and corresponding event metadata attributes are stored in the vector store.
3. User Query flow
The User Query flow is responsible for receiving and processing users’ queries and requests. Following is an overview of how this flow operates:
- The User Query flow starts when a user submits a query to the API, such as “
When is the next Chelsea match?
“. - The API invokes an AWS Lambda function to run the generative AI agent.
- The agent leverages Anthropic’s Claude 3 Haiku LLM hosted on Amazon Bedrock to analyze the user’s intent:
-
- The agent first decides on the appropriate knowledge base as follows:
"Thought: To find next Chelsea Football match, I will use the live sports knowledge base to search for upcoming live Chelsea Football events."
-
- The agent formulates an action input for querying the knowledge base contingent on the metadata attributes. It applies filters to lookup “live” events starting “after” the current timestamp. Following is an example of the query parameters used by the knowledge base:
"query": "Chelsea Football"
"start": 1715745600
"content_type": "live"
-
- The agent also performs query augmentation to enrich the search query with additional data. For example, if the user searches using the nickname of a player, the agent will then add the real player’s name to the search query.
- The agent sends the refined query to the knowledge base, which generates the embeddings for the query and performs a hybrid search in the vector store.
- Finally, the search results are returned by the agent to the API, which then returns them to the user.
The solution can be queried in several different ways including, but not limited to, by sport and time, team and time, player and time, nicknames, and even by concept (for example, “Sport where they hit a ball with a bat”).
Additional use cases and potential next steps
The proposed solution could handle other media content types such as movies, documentaries, and talk shows, allowing users to make diverse search queries. The generative AI agent can interpret descriptive queries such as “Movie where dinosaurs roam a theme park” to identify Jurassic Park. Query expansion could also generate multiple search terms, broadening the range of results. For instance, the query “Movie set in space” could return search results containing Star Wars, Star Trek, and Interstellar—providing a variety of relevant content options.
To further improve the user experience, a potential next step is to integrate conversational search capabilities. By utilizing the conversation history, users can refine broad queries like “space movies” with follow-up prompts such as “lightsabers,” allowing a natural and intuitive discovery process. Additionally, personalized results ranking based on user preferences and behavior will enhance search result relevance.
Conclusion
Generative AI agents, with Amazon Bedrock Knowledge Bases, enable media content search to be reimagined. By deciphering user intent and leveraging semantic information, in conjunction with metadata filtering, the solution offers an intuitive and relevant live TV sports search experience. It enhances user satisfaction and unlocks new avenues for content discovery, potentially boosting viewer engagement.
Contact an AWS Representative to know how we can help accelerate your business.