Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
255 changes: 255 additions & 0 deletions agentstack/_tools/dappier/__init__.py
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)}"
20 changes: 20 additions & 0 deletions agentstack/_tools/dappier/config.json
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/"
}
1 change: 1 addition & 0 deletions docs/llms.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1287,6 +1287,7 @@ description: 'AgentStack tools from community contributors'

## Search
- [Perplexity](/tools/tool/perplexity)
- [Dappier](/tools/tool/dappier)

## Memory / State

Expand Down
1 change: 1 addition & 0 deletions docs/tools/community.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ description: 'AgentStack tools from community contributors'

## Search
- [Perplexity](/tools/tool/perplexity)
- [Dappier](/tools/tool/dappier)

## Memory / State

Expand Down
66 changes: 66 additions & 0 deletions docs/tools/tool/dappier.mdx
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`.
6 changes: 6 additions & 0 deletions examples/stock_market_research/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#AGENTOPS_API_KEY=...
#OPENAI_API_KEY=...

# Tools

#DAPPIER_API_KEY=...
Loading
Loading