-
Notifications
You must be signed in to change notification settings - Fork 182
Add Dappier Search Tool #351
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
bboynton97
merged 8 commits into
agentstack-ai:main
from
amaan-ai20:add-dappier-search-tool
May 5, 2025
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
38de84f
add dappier search tool
amaan-ai20 ccda75d
add an example for stock market researcher using dappier real time data
amaan-ai20 edb3692
update inputs.yaml
amaan-ai20 5819471
add tesla investment report as an example
amaan-ai20 bb12c85
fine tune the prompt to get latest news and stock prices
amaan-ai20 20aa461
use current utc time
amaan-ai20 abd1b01
Merge branch 'main' into add-dappier-search-tool
amaan-ai20 0cd6eaa
Merge branch 'main' into add-dappier-search-tool
bboynton97 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,255 @@ | ||
import os | ||
from typing import Optional, Literal | ||
from dappier import Dappier | ||
|
||
# Initialize the Dappier client | ||
client = Dappier(api_key=os.getenv("DAPPIER_API_KEY")) | ||
|
||
# --- Functions for AI Models --- | ||
|
||
|
||
def real_time_web_search(query: str) -> str: | ||
""" | ||
Perform a real-time web search. Access the latest news, stock market data, weather, | ||
travel information, deals, and more using this AI model. Use when no stock ticker symbol | ||
is provided. | ||
|
||
Args: | ||
query: The search query to retrieve real-time information. | ||
|
||
Returns: | ||
A formatted string containing real-time search results. | ||
""" | ||
try: | ||
return client.search_real_time_data_string(query=query, ai_model_id="am_01j06ytn18ejftedz6dyhz2b15") | ||
except Exception as e: | ||
return f"Error: {str(e)}" | ||
|
||
|
||
def stock_market_data_search(query: str) -> str: | ||
""" | ||
Perform a real-time stock market data search. Retrieve real-time financial news, | ||
stock prices, and trade updates with AI-powered insights using this model. Use only when a | ||
stock ticker symbol is provided. | ||
|
||
Args: | ||
query: The search query to retrieve real-time stock market information. | ||
|
||
Returns: | ||
A formatted string containing real-time financial search results. | ||
""" | ||
try: | ||
return client.search_real_time_data_string(query=query, ai_model_id="am_01j749h8pbf7ns8r1bq9s2evrh") | ||
except Exception as e: | ||
return f"Error: {str(e)}" | ||
|
||
|
||
# --- Functions for Data Models --- | ||
|
||
|
||
def get_sports_news( | ||
query: str, | ||
similarity_top_k: int = 9, | ||
ref: Optional[str] = None, | ||
num_articles_ref: int = 0, | ||
search_algorithm: Literal["most_recent", "semantic", "most_recent_semantic", "trending"] = "most_recent", | ||
) -> str: | ||
""" | ||
Fetch AI-powered Sports News recommendations. Get real-time news, updates, and personalized | ||
content from top sports sources like Sportsnaut, Forever Blueshirts, Minnesota Sports Fan, | ||
LAFB Network, Bounding Into Sports, and Ringside Intel. | ||
|
||
Args: | ||
query: The input string for sports-related content recommendations. | ||
similarity_top_k: Number of top similar articles to retrieve. | ||
ref: Optional site domain to prioritize recommendations. | ||
num_articles_ref: Minimum number of articles to return from the reference domain. | ||
search_algorithm: The search algorithm to use ('most_recent', 'semantic', 'most_recent_semantic', 'trending'). | ||
|
||
Returns: | ||
A formatted string containing recommended sports articles. | ||
""" | ||
try: | ||
return client.get_ai_recommendations_string( | ||
query=query, | ||
data_model_id="dm_01j0pb465keqmatq9k83dthx34", | ||
similarity_top_k=similarity_top_k, | ||
ref=ref or "", | ||
num_articles_ref=num_articles_ref, | ||
search_algorithm=search_algorithm, | ||
) | ||
except Exception as e: | ||
return f"Error: {str(e)}" | ||
|
||
|
||
def get_lifestyle_news( | ||
query: str, | ||
similarity_top_k: int = 9, | ||
ref: Optional[str] = None, | ||
num_articles_ref: int = 0, | ||
search_algorithm: Literal["most_recent", "semantic", "most_recent_semantic", "trending"] = "most_recent", | ||
) -> str: | ||
""" | ||
Fetch AI-powered Lifestyle News recommendations. Access current lifestyle updates, analysis, | ||
and insights from leading lifestyle publications like The Mix, Snipdaily, Nerdable | ||
and Familyproof. | ||
|
||
Args: | ||
query: The input string for lifestyle-related content recommendations. | ||
similarity_top_k: Number of top similar articles to retrieve. | ||
ref: Optional site domain to prioritize recommendations. | ||
num_articles_ref: Minimum number of articles to return from the reference domain. | ||
search_algorithm: The search algorithm to use ('most_recent', 'semantic', 'most_recent_semantic', 'trending'). | ||
|
||
Returns: | ||
A formatted string containing recommended lifestyle articles. | ||
""" | ||
try: | ||
return client.get_ai_recommendations_string( | ||
query=query, | ||
data_model_id="dm_01j0q82s4bfjmsqkhs3ywm3x6y", | ||
similarity_top_k=similarity_top_k, | ||
ref=ref or "", | ||
num_articles_ref=num_articles_ref, | ||
search_algorithm=search_algorithm, | ||
) | ||
except Exception as e: | ||
return f"Error: {str(e)}" | ||
|
||
|
||
def get_iheartdogs_content( | ||
query: str, | ||
similarity_top_k: int = 9, | ||
ref: Optional[str] = None, | ||
num_articles_ref: int = 0, | ||
search_algorithm: Literal["most_recent", "semantic", "most_recent_semantic", "trending"] = "most_recent", | ||
) -> str: | ||
""" | ||
Fetch AI-powered iHeartDogs content recommendations. Tap into a dog care expert with access | ||
to thousands of articles covering pet health, behavior, grooming, and ownership from | ||
iHeartDogs.com. | ||
|
||
Args: | ||
query: The input string for dog care-related content recommendations. | ||
similarity_top_k: Number of top similar articles to retrieve. | ||
ref: Optional site domain to prioritize recommendations. | ||
num_articles_ref: Minimum number of articles to return from the reference domain. | ||
search_algorithm: The search algorithm to use ('most_recent', 'semantic', 'most_recent_semantic', 'trending'). | ||
|
||
Returns: | ||
A formatted string containing recommended dog-related articles. | ||
""" | ||
try: | ||
return client.get_ai_recommendations_string( | ||
query=query, | ||
data_model_id="dm_01j1sz8t3qe6v9g8ad102kvmqn", | ||
similarity_top_k=similarity_top_k, | ||
ref=ref or "", | ||
num_articles_ref=num_articles_ref, | ||
search_algorithm=search_algorithm, | ||
) | ||
except Exception as e: | ||
return f"Error: {str(e)}" | ||
|
||
|
||
def get_iheartcats_content( | ||
query: str, | ||
similarity_top_k: int = 9, | ||
ref: Optional[str] = None, | ||
num_articles_ref: int = 0, | ||
search_algorithm: Literal["most_recent", "semantic", "most_recent_semantic", "trending"] = "most_recent", | ||
) -> str: | ||
""" | ||
Fetch AI-powered iHeartCats content recommendations. Utilize a cat care specialist that | ||
provides comprehensive content on cat health, behavior, and lifestyle from iHeartCats.com. | ||
|
||
Args: | ||
query: The input string for cat care-related content recommendations. | ||
similarity_top_k: Number of top similar articles to retrieve. | ||
ref: Optional site domain to prioritize recommendations. | ||
num_articles_ref: Minimum number of articles to return from the reference domain. | ||
search_algorithm: The search algorithm to use ('most_recent', 'semantic', 'most_recent_semantic', 'trending'). | ||
|
||
Returns: | ||
A formatted string containing recommended cat-related articles. | ||
""" | ||
try: | ||
return client.get_ai_recommendations_string( | ||
query=query, | ||
data_model_id="dm_01j1sza0h7ekhaecys2p3y0vmj", | ||
similarity_top_k=similarity_top_k, | ||
ref=ref or "", | ||
num_articles_ref=num_articles_ref, | ||
search_algorithm=search_algorithm, | ||
) | ||
except Exception as e: | ||
return f"Error: {str(e)}" | ||
|
||
|
||
def get_greenmonster_guides( | ||
query: str, | ||
similarity_top_k: int = 9, | ||
ref: Optional[str] = None, | ||
num_articles_ref: int = 0, | ||
search_algorithm: Literal["most_recent", "semantic", "most_recent_semantic", "trending"] = "most_recent", | ||
) -> str: | ||
""" | ||
Fetch AI-powered GreenMonster guides and articles. Receive guidance for making conscious | ||
and compassionate choices benefiting people, animals, and the planet. | ||
|
||
Args: | ||
query: The input string for eco-friendly and conscious lifestyle recommendations. | ||
similarity_top_k: Number of top similar articles to retrieve. | ||
ref: Optional site domain to prioritize recommendations. | ||
num_articles_ref: Minimum number of articles to return from the reference domain. | ||
search_algorithm: The search algorithm to use ('most_recent', 'semantic', 'most_recent_semantic', 'trending'). | ||
|
||
Returns: | ||
A formatted string containing recommended eco-conscious articles. | ||
""" | ||
try: | ||
return client.get_ai_recommendations_string( | ||
query=query, | ||
data_model_id="dm_01j5xy9w5sf49bm6b1prm80m27", | ||
similarity_top_k=similarity_top_k, | ||
ref=ref or "", | ||
num_articles_ref=num_articles_ref, | ||
search_algorithm=search_algorithm, | ||
) | ||
except Exception as e: | ||
return f"Error: {str(e)}" | ||
|
||
|
||
def get_wishtv_news( | ||
query: str, | ||
similarity_top_k: int = 9, | ||
ref: Optional[str] = None, | ||
num_articles_ref: int = 0, | ||
search_algorithm: Literal["most_recent", "semantic", "most_recent_semantic", "trending"] = "most_recent", | ||
) -> str: | ||
""" | ||
Fetch AI-powered WISH-TV news recommendations. Get recommendations covering sports, | ||
breaking news, politics, multicultural updates, Hispanic language content, entertainment, | ||
health, and education. | ||
|
||
Args: | ||
query: The input string for general news recommendations. | ||
similarity_top_k: Number of top similar articles to retrieve. | ||
ref: Optional site domain to prioritize recommendations. | ||
num_articles_ref: Minimum number of articles to return from the reference domain. | ||
search_algorithm: The search algorithm to use ('most_recent', 'semantic', 'most_recent_semantic', 'trending'). | ||
|
||
Returns: | ||
A formatted string containing recommended news articles. | ||
""" | ||
try: | ||
return client.get_ai_recommendations_string( | ||
query=query, | ||
data_model_id="dm_01jagy9nqaeer9hxx8z1sk1jx6", | ||
similarity_top_k=similarity_top_k, | ||
ref=ref or "", | ||
num_articles_ref=num_articles_ref, | ||
search_algorithm=search_algorithm, | ||
) | ||
except Exception as e: | ||
return f"Error: {str(e)}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"name": "dappier", | ||
"url": "https://www.dappier.com/", | ||
"category": "search", | ||
"env": { | ||
"DAPPIER_API_KEY": null | ||
}, | ||
"dependencies": ["dappier>=0.3.5"], | ||
"tools": [ | ||
"real_time_web_search", | ||
"stock_market_data_search", | ||
"get_sports_news", | ||
"get_lifestyle_news", | ||
"get_iheartdogs_content", | ||
"get_iheartcats_content", | ||
"get_greenmonster_guides", | ||
"get_wishtv_news" | ||
], | ||
"cta": "Create an API key at https://platform.dappier.com/profile/api-keys/" | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
--- | ||
title: Dappier | ||
description: Real-time web and content search for agents | ||
icon: search | ||
--- | ||
|
||
Dappier is a real time search that connects any AI to proprietary, real-time data — including web search, news, sports, stock market data, and premium publisher content. | ||
|
||
## Description | ||
Dappier Real-Time Search provides instant access to live web search results and AI-powered recommendations with: | ||
|
||
- Real-Time Web Search offering up-to-the-minute results from Google, financial markets, and global news | ||
- Specialized Content Models trained on curated datasets for domains like sports, lifestyle, pet care, sustainability, and multicultural news | ||
- Intelligent Query Routing that automatically selects the appropriate model based on user input | ||
|
||
### Core Features: | ||
|
||
- Web Search - Perform real-time web lookups across news, stocks, travel, weather, and more | ||
- Stock Market Data - Retrieve live financial news, stock prices, and trades | ||
- Content Recommendations - Get semantically matched articles tailored to user interests | ||
- Domain-Specific Models - Specialized AI trained on lifestyle, pets, sports, and green living | ||
|
||
### Output Formats: | ||
|
||
- Summarized real-time search results | ||
- Curated lists of recommended articles | ||
- Live financial and stock market insights | ||
- Structured query-to-content responses | ||
|
||
## Available Models and Functions | ||
|
||
> Explore various AI models and data models available at [Dappier Marketplace](https://marketplace.dappier.com/marketplace). | ||
|
||
|
||
### AI Models | ||
|
||
| Function | Model | Description | Arguments | | ||
|:---|:---|:---|:---| | ||
| `real_time_web_search` | `am_01j06ytn18ejftedz6dyhz2b15` | Perform a real-time web search across Google, news, weather, and travel data. | `query: str` | | ||
| `stock_market_data_search` | `am_01j749h8pbf7ns8r1bq9s2evrh` | Perform a real-time stock market data search including stock prices and financial news. | `query: str` | | ||
|
||
### Data Models | ||
|
||
| Function | Model | Description | Arguments | | ||
|:---|:---|:---|:---| | ||
| `get_sports_news` | `dm_01j0pb465keqmatq9k83dthx34` | Get real-time sports news and updates from top sports sources. | `query: str`, `similarity_top_k: int`, `ref: Optional[str]`, `num_articles_ref: int`, `search_algorithm: Literal["most_recent", "semantic", "most_recent_semantic", "trending"]` | | ||
| `get_lifestyle_news` | `dm_01j0q82s4bfjmsqkhs3ywm3x6y` | Access real-time lifestyle news and insights from popular publications. | `query: str`, `similarity_top_k: int`, `ref: Optional[str]`, `num_articles_ref: int`, `search_algorithm: Literal["most_recent", "semantic", "most_recent_semantic", "trending"]` | | ||
| `get_iheartdogs_content` | `dm_01j1sz8t3qe6v9g8ad102kvmqn` | Fetch dog care articles on health, behavior, and grooming from iHeartDogs. | `query: str`, `similarity_top_k: int`, `ref: Optional[str]`, `num_articles_ref: int`, `search_algorithm: Literal["most_recent", "semantic", "most_recent_semantic", "trending"]` | | ||
| `get_iheartcats_content` | `dm_01j1sza0h7ekhaecys2p3y0vmj` | Fetch cat care content on health, lifestyle, and behavior from iHeartCats. | `query: str`, `similarity_top_k: int`, `ref: Optional[str]`, `num_articles_ref: int`, `search_algorithm: Literal["most_recent", "semantic", "most_recent_semantic", "trending"]` | | ||
| `get_greenmonster_guides` | `dm_01j5xy9w5sf49bm6b1prm80m27` | Access eco-conscious lifestyle articles from GreenMonster. | `query: str`, `similarity_top_k: int`, `ref: Optional[str]`, `num_articles_ref: int`, `search_algorithm: Literal["most_recent", "semantic", "most_recent_semantic", "trending"]` | | ||
| `get_wishtv_news` | `dm_01jagy9nqaeer9hxx8z1sk1jx6` | Get news updates on politics, entertainment, and multicultural topics from WISH-TV. | `query: str`, `similarity_top_k: int`, `ref: Optional[str]`, `num_articles_ref: int`, `search_algorithm: Literal["most_recent", "semantic", "most_recent_semantic", "trending"]` | | ||
|
||
## Installation | ||
|
||
```bash | ||
agentstack tools add dappier | ||
``` | ||
|
||
Set the environment variable | ||
|
||
```env | ||
DAPPIER_API_KEY=... | ||
``` | ||
|
||
## Usage | ||
Dappier can be configured for different behaviors by modifying `src/tools/dappier_tool.py`. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#AGENTOPS_API_KEY=... | ||
#OPENAI_API_KEY=... | ||
|
||
# Tools | ||
|
||
#DAPPIER_API_KEY=... |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.