forked from agentstack-ai/AgentStack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path__init__.py
More file actions
255 lines (219 loc) · 9.51 KB
/
__init__.py
File metadata and controls
255 lines (219 loc) · 9.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
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)}"