Skip to main content
You can also check this cookbook in colab here This notebook demonstrates how to set up and leverage LangChain’s powerful chaining capabilities combined with Dappier’s DappierRetriever for automated sports news summarization. By integrating real-time sports news data and advanced language models, this notebook walks you through an innovative approach to generating concise and accurate sports news summaries. In this notebook, you’ll explore:
  • LangChain: A versatile framework for chaining together language models and other components to create sophisticated AI-driven workflows. It enables seamless integration of LLMs with external tools and data sources, making it ideal for tasks like summarization, question-answering, and more.
  • Dappier: A platform connecting LLMs and Agentic AI agents to real-time, rights-cleared data from trusted sources, specializing in domains like web search, finance, and news. It delivers enriched, prompt-ready data, empowering AI with verified and up-to-date information for diverse applications.
  • OpenAI: A leading provider of advanced AI models capable of natural language understanding, contextual reasoning, and content generation. It enables intelligent, human-like interactions and supports a wide range of applications across various domains.
  • LangSmith: A platform for debugging, testing, and monitoring LangChain applications. It provides detailed tracing and analytics to help you understand and optimize the performance of your AI workflows.
This setup not only demonstrates a practical application of AI-driven sports news summarization but also provides a flexible framework that can be adapted to other real-world scenarios requiring real-time data integration from Dappier and advanced language model capabilities.

Watch the Video Guide

If you prefer a visual walkthrough, check out the accompanying video guide below:

πŸ“¦ Installation

First, install the Langchain Dappier integration package with all its dependencies:

πŸ”‘ Setting Up API Keys

You’ll need to set up your API keys for Dappier, OpenAI and LangSmith You can go to here to get API Key from Dappier with free credits. The API Key could be found under Settings -> Profile.
Python
Your can go to here to get API Key from Open AI.
Python
Your can go to here to get API Key from LangSmith.
Python

πŸ›°οΈ Access AI Recommendations using Dappier Retriever

The Dappier AI Recommendations Retriever is a custom retriever built using LangChain’s retriever interface. It enhances AI applications by providing real-time, AI-driven recommendations from premium content sources across industries like News, Finance, and Sports. By leveraging Dappier’s pre-trained RAG models and natural language APIs, this retriever ensures that responses are not only accurate but also contextually relevant. It takes a user query as input and returns a list of LangChain Document objects with high-quality recommendations, making it a powerful tool for AI applications requiring up-to-date, content-aware insights. In this section, we will search for some breaking news using Wisth-TV AI Data model. Explore a wide range of data models in our marketplace at marketplace.dappier.com. For list of all parameters supported for Dappier retriever visit Dappier docs.
Python
πŸŽ‰ Dappier effortlessly retrieves the latest breaking news in Indiana, providing valuable data for AI integration!

πŸ€ Automated Sports news Summarizer

This section sets up an automated workflow where LangChain and DappierRetriever collaborate to generate concise and accurate sports news summaries. We will guide the system in retrieving real-time sports news data and leveraging OpenAI models to create dynamic, up-to-date summaries._
Python
Initialize DappierRetriever for sports news. For list of all parameters supported for Dappier retriever visit Dappier docs. Explore a wide range of data models in our marketplace at marketplace.dappier.com.
Python
Initialize the OpenAI model
Python
Define the prompt template to create the summary
Python
Create the processing chain
Python
Create the full pipeline to generate the summary using chaining.
Python
Generate Summary
Python

🌟 Highlights

This notebook has guided you through setting up and running a Langchain RAG workflow with Dappier for a automated sports news generator. You can adapt and expand this example for various other scenarios requiring advanced web information retrieval and AI collaboration. Key tools utilized in this notebook include:
  • LangChain: A versatile framework for chaining together language models and other components to create sophisticated AI-driven workflows. It enables seamless integration of LLMs with external tools and data sources, making it ideal for tasks like summarization, question-answering, and more.
  • Dappier: A platform connecting LLMs and Agentic AI agents to real-time, rights-cleared data from trusted sources, specializing in domains like web search, finance, and news. It delivers enriched, prompt-ready data, empowering AI with verified and up-to-date information for diverse applications.
  • OpenAI: A leading provider of advanced AI models capable of natural language understanding, contextual reasoning, and content generation. It enables intelligent, human-like interactions and supports a wide range of applications across various domains.
  • LangSmith: A platform for debugging, testing, and monitoring LangChain applications. It provides detailed tracing and analytics to help you understand and optimize the performance of your AI workflows.
This comprehensive setup allows you to adapt and expand the example for various scenarios requiring advanced web information retrieval, AI collaboration, and multi-source data aggregation.