Getting Started
Installation
To install thelangchain-dappier package, run:
Setting API Credentials
Generate an API key from the Dappier platform and set it as an environment variable:Python
Python
Dappier Tool
Overview
TheDappierRealTimeSearchTool 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 hereWatch the Video
If you prefer a visual walkthrough, check out the accompanying video below:Features
TheDappierRealTimeSearchTool 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
TheDappierAIRecommendationTool 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 hereOverview
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".

