Skip to content

Commit 6483f7a

Browse files
authored
Merge branch 'main' into adubatl/model_fetching_PoC
2 parents 56741a5 + a793d4e commit 6483f7a

File tree

19 files changed

+952
-0
lines changed

19 files changed

+952
-0
lines changed

agentstack/_tools/dappier/__init__.py

Lines changed: 255 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,255 @@
1+
import os
2+
from typing import Optional, Literal
3+
from dappier import Dappier
4+
5+
# Initialize the Dappier client
6+
client = Dappier(api_key=os.getenv("DAPPIER_API_KEY"))
7+
8+
# --- Functions for AI Models ---
9+
10+
11+
def real_time_web_search(query: str) -> str:
12+
"""
13+
Perform a real-time web search. Access the latest news, stock market data, weather,
14+
travel information, deals, and more using this AI model. Use when no stock ticker symbol
15+
is provided.
16+
17+
Args:
18+
query: The search query to retrieve real-time information.
19+
20+
Returns:
21+
A formatted string containing real-time search results.
22+
"""
23+
try:
24+
return client.search_real_time_data_string(query=query, ai_model_id="am_01j06ytn18ejftedz6dyhz2b15")
25+
except Exception as e:
26+
return f"Error: {str(e)}"
27+
28+
29+
def stock_market_data_search(query: str) -> str:
30+
"""
31+
Perform a real-time stock market data search. Retrieve real-time financial news,
32+
stock prices, and trade updates with AI-powered insights using this model. Use only when a
33+
stock ticker symbol is provided.
34+
35+
Args:
36+
query: The search query to retrieve real-time stock market information.
37+
38+
Returns:
39+
A formatted string containing real-time financial search results.
40+
"""
41+
try:
42+
return client.search_real_time_data_string(query=query, ai_model_id="am_01j749h8pbf7ns8r1bq9s2evrh")
43+
except Exception as e:
44+
return f"Error: {str(e)}"
45+
46+
47+
# --- Functions for Data Models ---
48+
49+
50+
def get_sports_news(
51+
query: str,
52+
similarity_top_k: int = 9,
53+
ref: Optional[str] = None,
54+
num_articles_ref: int = 0,
55+
search_algorithm: Literal["most_recent", "semantic", "most_recent_semantic", "trending"] = "most_recent",
56+
) -> str:
57+
"""
58+
Fetch AI-powered Sports News recommendations. Get real-time news, updates, and personalized
59+
content from top sports sources like Sportsnaut, Forever Blueshirts, Minnesota Sports Fan,
60+
LAFB Network, Bounding Into Sports, and Ringside Intel.
61+
62+
Args:
63+
query: The input string for sports-related content recommendations.
64+
similarity_top_k: Number of top similar articles to retrieve.
65+
ref: Optional site domain to prioritize recommendations.
66+
num_articles_ref: Minimum number of articles to return from the reference domain.
67+
search_algorithm: The search algorithm to use ('most_recent', 'semantic', 'most_recent_semantic', 'trending').
68+
69+
Returns:
70+
A formatted string containing recommended sports articles.
71+
"""
72+
try:
73+
return client.get_ai_recommendations_string(
74+
query=query,
75+
data_model_id="dm_01j0pb465keqmatq9k83dthx34",
76+
similarity_top_k=similarity_top_k,
77+
ref=ref or "",
78+
num_articles_ref=num_articles_ref,
79+
search_algorithm=search_algorithm,
80+
)
81+
except Exception as e:
82+
return f"Error: {str(e)}"
83+
84+
85+
def get_lifestyle_news(
86+
query: str,
87+
similarity_top_k: int = 9,
88+
ref: Optional[str] = None,
89+
num_articles_ref: int = 0,
90+
search_algorithm: Literal["most_recent", "semantic", "most_recent_semantic", "trending"] = "most_recent",
91+
) -> str:
92+
"""
93+
Fetch AI-powered Lifestyle News recommendations. Access current lifestyle updates, analysis,
94+
and insights from leading lifestyle publications like The Mix, Snipdaily, Nerdable
95+
and Familyproof.
96+
97+
Args:
98+
query: The input string for lifestyle-related content recommendations.
99+
similarity_top_k: Number of top similar articles to retrieve.
100+
ref: Optional site domain to prioritize recommendations.
101+
num_articles_ref: Minimum number of articles to return from the reference domain.
102+
search_algorithm: The search algorithm to use ('most_recent', 'semantic', 'most_recent_semantic', 'trending').
103+
104+
Returns:
105+
A formatted string containing recommended lifestyle articles.
106+
"""
107+
try:
108+
return client.get_ai_recommendations_string(
109+
query=query,
110+
data_model_id="dm_01j0q82s4bfjmsqkhs3ywm3x6y",
111+
similarity_top_k=similarity_top_k,
112+
ref=ref or "",
113+
num_articles_ref=num_articles_ref,
114+
search_algorithm=search_algorithm,
115+
)
116+
except Exception as e:
117+
return f"Error: {str(e)}"
118+
119+
120+
def get_iheartdogs_content(
121+
query: str,
122+
similarity_top_k: int = 9,
123+
ref: Optional[str] = None,
124+
num_articles_ref: int = 0,
125+
search_algorithm: Literal["most_recent", "semantic", "most_recent_semantic", "trending"] = "most_recent",
126+
) -> str:
127+
"""
128+
Fetch AI-powered iHeartDogs content recommendations. Tap into a dog care expert with access
129+
to thousands of articles covering pet health, behavior, grooming, and ownership from
130+
iHeartDogs.com.
131+
132+
Args:
133+
query: The input string for dog care-related content recommendations.
134+
similarity_top_k: Number of top similar articles to retrieve.
135+
ref: Optional site domain to prioritize recommendations.
136+
num_articles_ref: Minimum number of articles to return from the reference domain.
137+
search_algorithm: The search algorithm to use ('most_recent', 'semantic', 'most_recent_semantic', 'trending').
138+
139+
Returns:
140+
A formatted string containing recommended dog-related articles.
141+
"""
142+
try:
143+
return client.get_ai_recommendations_string(
144+
query=query,
145+
data_model_id="dm_01j1sz8t3qe6v9g8ad102kvmqn",
146+
similarity_top_k=similarity_top_k,
147+
ref=ref or "",
148+
num_articles_ref=num_articles_ref,
149+
search_algorithm=search_algorithm,
150+
)
151+
except Exception as e:
152+
return f"Error: {str(e)}"
153+
154+
155+
def get_iheartcats_content(
156+
query: str,
157+
similarity_top_k: int = 9,
158+
ref: Optional[str] = None,
159+
num_articles_ref: int = 0,
160+
search_algorithm: Literal["most_recent", "semantic", "most_recent_semantic", "trending"] = "most_recent",
161+
) -> str:
162+
"""
163+
Fetch AI-powered iHeartCats content recommendations. Utilize a cat care specialist that
164+
provides comprehensive content on cat health, behavior, and lifestyle from iHeartCats.com.
165+
166+
Args:
167+
query: The input string for cat care-related content recommendations.
168+
similarity_top_k: Number of top similar articles to retrieve.
169+
ref: Optional site domain to prioritize recommendations.
170+
num_articles_ref: Minimum number of articles to return from the reference domain.
171+
search_algorithm: The search algorithm to use ('most_recent', 'semantic', 'most_recent_semantic', 'trending').
172+
173+
Returns:
174+
A formatted string containing recommended cat-related articles.
175+
"""
176+
try:
177+
return client.get_ai_recommendations_string(
178+
query=query,
179+
data_model_id="dm_01j1sza0h7ekhaecys2p3y0vmj",
180+
similarity_top_k=similarity_top_k,
181+
ref=ref or "",
182+
num_articles_ref=num_articles_ref,
183+
search_algorithm=search_algorithm,
184+
)
185+
except Exception as e:
186+
return f"Error: {str(e)}"
187+
188+
189+
def get_greenmonster_guides(
190+
query: str,
191+
similarity_top_k: int = 9,
192+
ref: Optional[str] = None,
193+
num_articles_ref: int = 0,
194+
search_algorithm: Literal["most_recent", "semantic", "most_recent_semantic", "trending"] = "most_recent",
195+
) -> str:
196+
"""
197+
Fetch AI-powered GreenMonster guides and articles. Receive guidance for making conscious
198+
and compassionate choices benefiting people, animals, and the planet.
199+
200+
Args:
201+
query: The input string for eco-friendly and conscious lifestyle recommendations.
202+
similarity_top_k: Number of top similar articles to retrieve.
203+
ref: Optional site domain to prioritize recommendations.
204+
num_articles_ref: Minimum number of articles to return from the reference domain.
205+
search_algorithm: The search algorithm to use ('most_recent', 'semantic', 'most_recent_semantic', 'trending').
206+
207+
Returns:
208+
A formatted string containing recommended eco-conscious articles.
209+
"""
210+
try:
211+
return client.get_ai_recommendations_string(
212+
query=query,
213+
data_model_id="dm_01j5xy9w5sf49bm6b1prm80m27",
214+
similarity_top_k=similarity_top_k,
215+
ref=ref or "",
216+
num_articles_ref=num_articles_ref,
217+
search_algorithm=search_algorithm,
218+
)
219+
except Exception as e:
220+
return f"Error: {str(e)}"
221+
222+
223+
def get_wishtv_news(
224+
query: str,
225+
similarity_top_k: int = 9,
226+
ref: Optional[str] = None,
227+
num_articles_ref: int = 0,
228+
search_algorithm: Literal["most_recent", "semantic", "most_recent_semantic", "trending"] = "most_recent",
229+
) -> str:
230+
"""
231+
Fetch AI-powered WISH-TV news recommendations. Get recommendations covering sports,
232+
breaking news, politics, multicultural updates, Hispanic language content, entertainment,
233+
health, and education.
234+
235+
Args:
236+
query: The input string for general news recommendations.
237+
similarity_top_k: Number of top similar articles to retrieve.
238+
ref: Optional site domain to prioritize recommendations.
239+
num_articles_ref: Minimum number of articles to return from the reference domain.
240+
search_algorithm: The search algorithm to use ('most_recent', 'semantic', 'most_recent_semantic', 'trending').
241+
242+
Returns:
243+
A formatted string containing recommended news articles.
244+
"""
245+
try:
246+
return client.get_ai_recommendations_string(
247+
query=query,
248+
data_model_id="dm_01jagy9nqaeer9hxx8z1sk1jx6",
249+
similarity_top_k=similarity_top_k,
250+
ref=ref or "",
251+
num_articles_ref=num_articles_ref,
252+
search_algorithm=search_algorithm,
253+
)
254+
except Exception as e:
255+
return f"Error: {str(e)}"

agentstack/_tools/dappier/config.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"name": "dappier",
3+
"url": "https://www.dappier.com/",
4+
"category": "search",
5+
"env": {
6+
"DAPPIER_API_KEY": null
7+
},
8+
"dependencies": ["dappier>=0.3.5"],
9+
"tools": [
10+
"real_time_web_search",
11+
"stock_market_data_search",
12+
"get_sports_news",
13+
"get_lifestyle_news",
14+
"get_iheartdogs_content",
15+
"get_iheartcats_content",
16+
"get_greenmonster_guides",
17+
"get_wishtv_news"
18+
],
19+
"cta": "Create an API key at https://platform.dappier.com/profile/api-keys/"
20+
}

docs/llms.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1287,6 +1287,7 @@ description: 'AgentStack tools from community contributors'
12871287

12881288
## Search
12891289
- [Perplexity](/tools/tool/perplexity)
1290+
- [Dappier](/tools/tool/dappier)
12901291

12911292
## Memory / State
12921293

docs/tools/community.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ description: 'AgentStack tools from community contributors'
1717

1818
## Search
1919
- [Perplexity](/tools/tool/perplexity)
20+
- [Dappier](/tools/tool/dappier)
2021

2122
## Memory / State
2223

docs/tools/tool/dappier.mdx

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
---
2+
title: Dappier
3+
description: Real-time web and content search for agents
4+
icon: search
5+
---
6+
7+
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.
8+
9+
## Description
10+
Dappier Real-Time Search provides instant access to live web search results and AI-powered recommendations with:
11+
12+
- Real-Time Web Search offering up-to-the-minute results from Google, financial markets, and global news
13+
- Specialized Content Models trained on curated datasets for domains like sports, lifestyle, pet care, sustainability, and multicultural news
14+
- Intelligent Query Routing that automatically selects the appropriate model based on user input
15+
16+
### Core Features:
17+
18+
- Web Search - Perform real-time web lookups across news, stocks, travel, weather, and more
19+
- Stock Market Data - Retrieve live financial news, stock prices, and trades
20+
- Content Recommendations - Get semantically matched articles tailored to user interests
21+
- Domain-Specific Models - Specialized AI trained on lifestyle, pets, sports, and green living
22+
23+
### Output Formats:
24+
25+
- Summarized real-time search results
26+
- Curated lists of recommended articles
27+
- Live financial and stock market insights
28+
- Structured query-to-content responses
29+
30+
## Available Models and Functions
31+
32+
> Explore various AI models and data models available at [Dappier Marketplace](https://marketplace.dappier.com/marketplace).
33+
34+
35+
### AI Models
36+
37+
| Function | Model | Description | Arguments |
38+
|:---|:---|:---|:---|
39+
| `real_time_web_search` | `am_01j06ytn18ejftedz6dyhz2b15` | Perform a real-time web search across Google, news, weather, and travel data. | `query: str` |
40+
| `stock_market_data_search` | `am_01j749h8pbf7ns8r1bq9s2evrh` | Perform a real-time stock market data search including stock prices and financial news. | `query: str` |
41+
42+
### Data Models
43+
44+
| Function | Model | Description | Arguments |
45+
|:---|:---|:---|:---|
46+
| `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"]` |
47+
| `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"]` |
48+
| `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"]` |
49+
| `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"]` |
50+
| `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"]` |
51+
| `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"]` |
52+
53+
## Installation
54+
55+
```bash
56+
agentstack tools add dappier
57+
```
58+
59+
Set the environment variable
60+
61+
```env
62+
DAPPIER_API_KEY=...
63+
```
64+
65+
## Usage
66+
Dappier can be configured for different behaviors by modifying `src/tools/dappier_tool.py`.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#AGENTOPS_API_KEY=...
2+
#OPENAI_API_KEY=...
3+
4+
# Tools
5+
6+
#DAPPIER_API_KEY=...

0 commit comments

Comments
 (0)