Skip to main content
LangChain is a software framework that helps facilitate the integration of large language models (LLMs) into applications. As a language model integration framework, LangChain’s use-cases largely overlap with those of language models in general, including document analysis and summarization, chatbots, and code analysis. Building your AI app with LangChain? Supercharge your app with immediate access to real-time data, spanning news, entertainment, finance, stock market data, weather, and more.

Getting Started

Installation

To install the langchain-dappier package, run:

Setting API Credentials

Generate an API key from the Dappier platform and set it as an environment variable:
Python
For LangSmith tracing, set your API key:
Python

Dappier Tool

Overview

The DappierRealTimeSearchTool and DappierAIRecommendationTool empower AI applications with real-time data and AI-driven insights. The DappierRealTimeSearchTool provides access to up-to-date information across news, weather, travel, and financial markets, while the DappierAIRecommendationTool enhances applications with factual, premium content from domains like News, Finance, and Sports, powered by Dappier’s pre-trained RAG models and natural language APIs.

DappierRealTimeSearchTool

You can also check this cookbook in colab here

Watch the Video

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

Features

The DappierRealTimeSearchTool provides real-time Google search results, including:
  • Latest news, weather, and travel deals
  • Up-to-date financial news, stock prices, and trades
  • AI-enhanced insights for accurate and fast information retrieval

Instantiation

Python

Usage

Direct Invocation

Python

Using ToolCall

Python

Chaining with LLM

Python
Python

Parameters

ai_model_id (str) Optional:

  • The AI model ID to use for the query.
  • AI model IDs always start with the prefix "am_".
  • Defaults to "am_01j06ytn18ejftedz6dyhz2b15".
  • Multiple AI model IDs are available, which can be found at Dappier marketplace.

DappierAIRecommendationTool

Watch the Video

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

Features

The DappierAIRecommendationTool delivers AI-powered recommendations using Dappier’s pre-trained RAG models:
  • Provides factual and up-to-date responses
  • Sources premium content from News, Finance, Sports, and more

Instantiation

Python

Usage

Direct Invocation

Python

Using ToolCall

Python

Parameters

data_model_id (str) Optional:

  • The data model ID to use for recommendations.
  • Data model IDs always start with the prefix "dm_".
  • Defaults to "dm_01j0pb465keqmatq9k83dthx34".

similarity_top_k (int) Optional:

  • The number of top documents to retrieve based on similarity.
  • Defaults to 9.

ref (str) Optional:

  • The site domain where AI recommendations should be displayed.
  • Defaults to None.

num_articles_ref (int) Optional:

  • The minimum number of articles to return from the specified reference domain (ref).
  • The remaining articles will come from other sites in the RAG model.
  • Defaults to 0.

search_algorithm (str) Optional:

  • The search algorithm to use for retrieving articles.
  • Options:
    • "most_recent" (default),
    • "semantic",
    • "most_recent_semantic",
    • "trending".

Dappier Retriever

You can also check this cookbook in colab here

Overview

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.

Watch the Video

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

Usage

Python

Use within a chain

Like other retrievers, DappierRetriever can be incorporated into LLM applications via chains. We will need a LLM or chat model. Let’s use OpenAI as an example.
Python

Parameters

data_model_id (str) Optional:

  • The data model ID to use for recommendations.
  • Data model IDs always start with the prefix "dm_".
  • Defaults to "dm_01j0pb465keqmatq9k83dthx34".

similarity_top_k (int) Optional:

  • The number of top documents to retrieve based on similarity.
  • Defaults to 9.

ref (str) Optional:

  • The site domain where AI recommendations should be displayed.
  • Defaults to None.

num_articles_ref (int) Optional:

  • The minimum number of articles to return from the specified reference domain (ref).
  • The remaining articles will come from other sites in the RAG model.
  • Defaults to 0.

search_algorithm (str) Optional:

  • The search algorithm to use for retrieving articles.
  • Options:
    • "most_recent" (default),
    • "semantic",
    • "most_recent_semantic",
    • "trending".

Conclusion

Dappier’s tools and retrievers empower AI models with real-time search and AI-driven content recommendations, ensuring seamless and up-to-date knowledge retrieval. For further exploration, visit our marketplace.