intentkit 0.5.0__py3-none-any.whl → 0.5.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of intentkit might be problematic. Click here for more details.
- intentkit/__init__.py +17 -0
- intentkit/abstracts/__init__.py +0 -0
- intentkit/abstracts/agent.py +60 -0
- intentkit/abstracts/api.py +4 -0
- intentkit/abstracts/engine.py +38 -0
- intentkit/abstracts/exception.py +9 -0
- intentkit/abstracts/graph.py +25 -0
- intentkit/abstracts/skill.py +129 -0
- intentkit/abstracts/twitter.py +54 -0
- intentkit/clients/__init__.py +14 -0
- intentkit/clients/cdp.py +53 -0
- intentkit/clients/twitter.py +445 -0
- intentkit/config/__init__.py +0 -0
- intentkit/config/config.py +164 -0
- intentkit/core/__init__.py +0 -0
- intentkit/core/agent.py +191 -0
- intentkit/core/api.py +40 -0
- intentkit/core/client.py +45 -0
- intentkit/core/credit.py +1767 -0
- intentkit/core/engine.py +1018 -0
- intentkit/core/node.py +223 -0
- intentkit/core/prompt.py +58 -0
- intentkit/core/skill.py +124 -0
- intentkit/models/agent.py +1689 -0
- intentkit/models/agent_data.py +810 -0
- intentkit/models/agent_schema.json +733 -0
- intentkit/models/app_setting.py +156 -0
- intentkit/models/base.py +9 -0
- intentkit/models/chat.py +581 -0
- intentkit/models/conversation.py +286 -0
- intentkit/models/credit.py +1406 -0
- intentkit/models/db.py +120 -0
- intentkit/models/db_mig.py +102 -0
- intentkit/models/generator.py +347 -0
- intentkit/models/llm.py +746 -0
- intentkit/models/redis.py +132 -0
- intentkit/models/skill.py +466 -0
- intentkit/models/user.py +243 -0
- intentkit/skills/__init__.py +12 -0
- intentkit/skills/acolyt/__init__.py +83 -0
- intentkit/skills/acolyt/acolyt.jpg +0 -0
- intentkit/skills/acolyt/ask.py +128 -0
- intentkit/skills/acolyt/base.py +28 -0
- intentkit/skills/acolyt/schema.json +89 -0
- intentkit/skills/aixbt/README.md +71 -0
- intentkit/skills/aixbt/__init__.py +73 -0
- intentkit/skills/aixbt/aixbt.jpg +0 -0
- intentkit/skills/aixbt/base.py +21 -0
- intentkit/skills/aixbt/projects.py +153 -0
- intentkit/skills/aixbt/schema.json +99 -0
- intentkit/skills/allora/__init__.py +83 -0
- intentkit/skills/allora/allora.jpeg +0 -0
- intentkit/skills/allora/base.py +28 -0
- intentkit/skills/allora/price.py +130 -0
- intentkit/skills/allora/schema.json +89 -0
- intentkit/skills/base.py +174 -0
- intentkit/skills/carv/README.md +95 -0
- intentkit/skills/carv/__init__.py +121 -0
- intentkit/skills/carv/base.py +183 -0
- intentkit/skills/carv/carv.webp +0 -0
- intentkit/skills/carv/fetch_news.py +92 -0
- intentkit/skills/carv/onchain_query.py +164 -0
- intentkit/skills/carv/schema.json +137 -0
- intentkit/skills/carv/token_info_and_price.py +110 -0
- intentkit/skills/cdp/__init__.py +137 -0
- intentkit/skills/cdp/base.py +21 -0
- intentkit/skills/cdp/cdp.png +0 -0
- intentkit/skills/cdp/get_balance.py +81 -0
- intentkit/skills/cdp/schema.json +473 -0
- intentkit/skills/chainlist/README.md +38 -0
- intentkit/skills/chainlist/__init__.py +54 -0
- intentkit/skills/chainlist/base.py +21 -0
- intentkit/skills/chainlist/chain_lookup.py +208 -0
- intentkit/skills/chainlist/chainlist.png +0 -0
- intentkit/skills/chainlist/schema.json +47 -0
- intentkit/skills/common/__init__.py +82 -0
- intentkit/skills/common/base.py +21 -0
- intentkit/skills/common/common.jpg +0 -0
- intentkit/skills/common/current_time.py +84 -0
- intentkit/skills/common/schema.json +57 -0
- intentkit/skills/cookiefun/README.md +121 -0
- intentkit/skills/cookiefun/__init__.py +78 -0
- intentkit/skills/cookiefun/base.py +41 -0
- intentkit/skills/cookiefun/constants.py +18 -0
- intentkit/skills/cookiefun/cookiefun.png +0 -0
- intentkit/skills/cookiefun/get_account_details.py +171 -0
- intentkit/skills/cookiefun/get_account_feed.py +282 -0
- intentkit/skills/cookiefun/get_account_smart_followers.py +181 -0
- intentkit/skills/cookiefun/get_sectors.py +128 -0
- intentkit/skills/cookiefun/schema.json +155 -0
- intentkit/skills/cookiefun/search_accounts.py +225 -0
- intentkit/skills/cryptocompare/__init__.py +130 -0
- intentkit/skills/cryptocompare/api.py +159 -0
- intentkit/skills/cryptocompare/base.py +303 -0
- intentkit/skills/cryptocompare/cryptocompare.png +0 -0
- intentkit/skills/cryptocompare/fetch_news.py +96 -0
- intentkit/skills/cryptocompare/fetch_price.py +99 -0
- intentkit/skills/cryptocompare/fetch_top_exchanges.py +113 -0
- intentkit/skills/cryptocompare/fetch_top_market_cap.py +109 -0
- intentkit/skills/cryptocompare/fetch_top_volume.py +108 -0
- intentkit/skills/cryptocompare/fetch_trading_signals.py +107 -0
- intentkit/skills/cryptocompare/schema.json +168 -0
- intentkit/skills/cryptopanic/__init__.py +108 -0
- intentkit/skills/cryptopanic/base.py +51 -0
- intentkit/skills/cryptopanic/cryptopanic.png +0 -0
- intentkit/skills/cryptopanic/fetch_crypto_news.py +153 -0
- intentkit/skills/cryptopanic/fetch_crypto_sentiment.py +136 -0
- intentkit/skills/cryptopanic/schema.json +103 -0
- intentkit/skills/dapplooker/README.md +92 -0
- intentkit/skills/dapplooker/__init__.py +83 -0
- intentkit/skills/dapplooker/base.py +26 -0
- intentkit/skills/dapplooker/dapplooker.jpg +0 -0
- intentkit/skills/dapplooker/dapplooker_token_data.py +476 -0
- intentkit/skills/dapplooker/schema.json +91 -0
- intentkit/skills/defillama/__init__.py +323 -0
- intentkit/skills/defillama/api.py +315 -0
- intentkit/skills/defillama/base.py +135 -0
- intentkit/skills/defillama/coins/__init__.py +0 -0
- intentkit/skills/defillama/coins/fetch_batch_historical_prices.py +116 -0
- intentkit/skills/defillama/coins/fetch_block.py +98 -0
- intentkit/skills/defillama/coins/fetch_current_prices.py +105 -0
- intentkit/skills/defillama/coins/fetch_first_price.py +100 -0
- intentkit/skills/defillama/coins/fetch_historical_prices.py +110 -0
- intentkit/skills/defillama/coins/fetch_price_chart.py +109 -0
- intentkit/skills/defillama/coins/fetch_price_percentage.py +93 -0
- intentkit/skills/defillama/config/__init__.py +0 -0
- intentkit/skills/defillama/config/chains.py +433 -0
- intentkit/skills/defillama/defillama.jpeg +0 -0
- intentkit/skills/defillama/fees/__init__.py +0 -0
- intentkit/skills/defillama/fees/fetch_fees_overview.py +130 -0
- intentkit/skills/defillama/schema.json +383 -0
- intentkit/skills/defillama/stablecoins/__init__.py +0 -0
- intentkit/skills/defillama/stablecoins/fetch_stablecoin_chains.py +100 -0
- intentkit/skills/defillama/stablecoins/fetch_stablecoin_charts.py +129 -0
- intentkit/skills/defillama/stablecoins/fetch_stablecoin_prices.py +83 -0
- intentkit/skills/defillama/stablecoins/fetch_stablecoins.py +126 -0
- intentkit/skills/defillama/tests/__init__.py +0 -0
- intentkit/skills/defillama/tests/api_integration.test.py +192 -0
- intentkit/skills/defillama/tests/api_unit.test.py +583 -0
- intentkit/skills/defillama/tvl/__init__.py +0 -0
- intentkit/skills/defillama/tvl/fetch_chain_historical_tvl.py +106 -0
- intentkit/skills/defillama/tvl/fetch_chains.py +107 -0
- intentkit/skills/defillama/tvl/fetch_historical_tvl.py +91 -0
- intentkit/skills/defillama/tvl/fetch_protocol.py +207 -0
- intentkit/skills/defillama/tvl/fetch_protocol_current_tvl.py +93 -0
- intentkit/skills/defillama/tvl/fetch_protocols.py +196 -0
- intentkit/skills/defillama/volumes/__init__.py +0 -0
- intentkit/skills/defillama/volumes/fetch_dex_overview.py +157 -0
- intentkit/skills/defillama/volumes/fetch_dex_summary.py +123 -0
- intentkit/skills/defillama/volumes/fetch_options_overview.py +131 -0
- intentkit/skills/defillama/yields/__init__.py +0 -0
- intentkit/skills/defillama/yields/fetch_pool_chart.py +100 -0
- intentkit/skills/defillama/yields/fetch_pools.py +126 -0
- intentkit/skills/dexscreener/__init__.py +93 -0
- intentkit/skills/dexscreener/base.py +133 -0
- intentkit/skills/dexscreener/dexscreener.png +0 -0
- intentkit/skills/dexscreener/model/__init__.py +0 -0
- intentkit/skills/dexscreener/model/search_token_response.py +82 -0
- intentkit/skills/dexscreener/schema.json +48 -0
- intentkit/skills/dexscreener/search_token.py +321 -0
- intentkit/skills/dune_analytics/__init__.py +103 -0
- intentkit/skills/dune_analytics/base.py +46 -0
- intentkit/skills/dune_analytics/dune.png +0 -0
- intentkit/skills/dune_analytics/fetch_kol_buys.py +128 -0
- intentkit/skills/dune_analytics/fetch_nation_metrics.py +237 -0
- intentkit/skills/dune_analytics/schema.json +99 -0
- intentkit/skills/elfa/README.md +100 -0
- intentkit/skills/elfa/__init__.py +123 -0
- intentkit/skills/elfa/base.py +28 -0
- intentkit/skills/elfa/elfa.jpg +0 -0
- intentkit/skills/elfa/mention.py +504 -0
- intentkit/skills/elfa/schema.json +153 -0
- intentkit/skills/elfa/stats.py +118 -0
- intentkit/skills/elfa/tokens.py +126 -0
- intentkit/skills/enso/README.md +75 -0
- intentkit/skills/enso/__init__.py +114 -0
- intentkit/skills/enso/abi/__init__.py +0 -0
- intentkit/skills/enso/abi/approval.py +279 -0
- intentkit/skills/enso/abi/erc20.py +14 -0
- intentkit/skills/enso/abi/route.py +129 -0
- intentkit/skills/enso/base.py +44 -0
- intentkit/skills/enso/best_yield.py +286 -0
- intentkit/skills/enso/enso.jpg +0 -0
- intentkit/skills/enso/networks.py +105 -0
- intentkit/skills/enso/prices.py +93 -0
- intentkit/skills/enso/route.py +300 -0
- intentkit/skills/enso/schema.json +212 -0
- intentkit/skills/enso/tokens.py +223 -0
- intentkit/skills/enso/wallet.py +381 -0
- intentkit/skills/github/README.md +63 -0
- intentkit/skills/github/__init__.py +54 -0
- intentkit/skills/github/base.py +21 -0
- intentkit/skills/github/github.jpg +0 -0
- intentkit/skills/github/github_search.py +183 -0
- intentkit/skills/github/schema.json +59 -0
- intentkit/skills/heurist/__init__.py +143 -0
- intentkit/skills/heurist/base.py +26 -0
- intentkit/skills/heurist/heurist.png +0 -0
- intentkit/skills/heurist/image_generation_animagine_xl.py +162 -0
- intentkit/skills/heurist/image_generation_arthemy_comics.py +162 -0
- intentkit/skills/heurist/image_generation_arthemy_real.py +162 -0
- intentkit/skills/heurist/image_generation_braindance.py +162 -0
- intentkit/skills/heurist/image_generation_cyber_realistic_xl.py +162 -0
- intentkit/skills/heurist/image_generation_flux_1_dev.py +162 -0
- intentkit/skills/heurist/image_generation_sdxl.py +161 -0
- intentkit/skills/heurist/schema.json +196 -0
- intentkit/skills/lifi/README.md +294 -0
- intentkit/skills/lifi/__init__.py +141 -0
- intentkit/skills/lifi/base.py +21 -0
- intentkit/skills/lifi/lifi.png +0 -0
- intentkit/skills/lifi/schema.json +89 -0
- intentkit/skills/lifi/token_execute.py +472 -0
- intentkit/skills/lifi/token_quote.py +190 -0
- intentkit/skills/lifi/utils.py +656 -0
- intentkit/skills/moralis/README.md +490 -0
- intentkit/skills/moralis/__init__.py +110 -0
- intentkit/skills/moralis/api.py +281 -0
- intentkit/skills/moralis/base.py +55 -0
- intentkit/skills/moralis/fetch_chain_portfolio.py +191 -0
- intentkit/skills/moralis/fetch_nft_portfolio.py +284 -0
- intentkit/skills/moralis/fetch_solana_portfolio.py +331 -0
- intentkit/skills/moralis/fetch_wallet_portfolio.py +301 -0
- intentkit/skills/moralis/moralis.png +0 -0
- intentkit/skills/moralis/schema.json +156 -0
- intentkit/skills/moralis/tests/__init__.py +0 -0
- intentkit/skills/moralis/tests/test_wallet.py +511 -0
- intentkit/skills/nation/__init__.py +62 -0
- intentkit/skills/nation/base.py +31 -0
- intentkit/skills/nation/nation.png +0 -0
- intentkit/skills/nation/nft_check.py +106 -0
- intentkit/skills/nation/schema.json +58 -0
- intentkit/skills/openai/__init__.py +107 -0
- intentkit/skills/openai/base.py +32 -0
- intentkit/skills/openai/dalle_image_generation.py +128 -0
- intentkit/skills/openai/gpt_image_generation.py +152 -0
- intentkit/skills/openai/gpt_image_to_image.py +186 -0
- intentkit/skills/openai/image_to_text.py +126 -0
- intentkit/skills/openai/openai.png +0 -0
- intentkit/skills/openai/schema.json +139 -0
- intentkit/skills/portfolio/README.md +55 -0
- intentkit/skills/portfolio/__init__.py +151 -0
- intentkit/skills/portfolio/base.py +107 -0
- intentkit/skills/portfolio/constants.py +9 -0
- intentkit/skills/portfolio/moralis.png +0 -0
- intentkit/skills/portfolio/schema.json +237 -0
- intentkit/skills/portfolio/token_balances.py +155 -0
- intentkit/skills/portfolio/wallet_approvals.py +102 -0
- intentkit/skills/portfolio/wallet_defi_positions.py +80 -0
- intentkit/skills/portfolio/wallet_history.py +155 -0
- intentkit/skills/portfolio/wallet_net_worth.py +112 -0
- intentkit/skills/portfolio/wallet_nfts.py +139 -0
- intentkit/skills/portfolio/wallet_profitability.py +101 -0
- intentkit/skills/portfolio/wallet_profitability_summary.py +91 -0
- intentkit/skills/portfolio/wallet_stats.py +79 -0
- intentkit/skills/portfolio/wallet_swaps.py +147 -0
- intentkit/skills/skills.toml +103 -0
- intentkit/skills/slack/__init__.py +98 -0
- intentkit/skills/slack/base.py +55 -0
- intentkit/skills/slack/get_channel.py +109 -0
- intentkit/skills/slack/get_message.py +136 -0
- intentkit/skills/slack/schedule_message.py +92 -0
- intentkit/skills/slack/schema.json +135 -0
- intentkit/skills/slack/send_message.py +81 -0
- intentkit/skills/slack/slack.jpg +0 -0
- intentkit/skills/system/__init__.py +90 -0
- intentkit/skills/system/base.py +22 -0
- intentkit/skills/system/read_agent_api_key.py +87 -0
- intentkit/skills/system/regenerate_agent_api_key.py +77 -0
- intentkit/skills/system/schema.json +53 -0
- intentkit/skills/system/system.svg +76 -0
- intentkit/skills/tavily/README.md +86 -0
- intentkit/skills/tavily/__init__.py +91 -0
- intentkit/skills/tavily/base.py +27 -0
- intentkit/skills/tavily/schema.json +119 -0
- intentkit/skills/tavily/tavily.jpg +0 -0
- intentkit/skills/tavily/tavily_extract.py +147 -0
- intentkit/skills/tavily/tavily_search.py +139 -0
- intentkit/skills/token/README.md +89 -0
- intentkit/skills/token/__init__.py +107 -0
- intentkit/skills/token/base.py +154 -0
- intentkit/skills/token/constants.py +9 -0
- intentkit/skills/token/erc20_transfers.py +145 -0
- intentkit/skills/token/moralis.png +0 -0
- intentkit/skills/token/schema.json +141 -0
- intentkit/skills/token/token_analytics.py +81 -0
- intentkit/skills/token/token_price.py +132 -0
- intentkit/skills/token/token_search.py +121 -0
- intentkit/skills/twitter/__init__.py +146 -0
- intentkit/skills/twitter/base.py +68 -0
- intentkit/skills/twitter/follow_user.py +69 -0
- intentkit/skills/twitter/get_mentions.py +124 -0
- intentkit/skills/twitter/get_timeline.py +111 -0
- intentkit/skills/twitter/get_user_by_username.py +84 -0
- intentkit/skills/twitter/get_user_tweets.py +123 -0
- intentkit/skills/twitter/like_tweet.py +65 -0
- intentkit/skills/twitter/post_tweet.py +90 -0
- intentkit/skills/twitter/reply_tweet.py +98 -0
- intentkit/skills/twitter/retweet.py +76 -0
- intentkit/skills/twitter/schema.json +258 -0
- intentkit/skills/twitter/search_tweets.py +115 -0
- intentkit/skills/twitter/twitter.png +0 -0
- intentkit/skills/unrealspeech/__init__.py +55 -0
- intentkit/skills/unrealspeech/base.py +21 -0
- intentkit/skills/unrealspeech/schema.json +100 -0
- intentkit/skills/unrealspeech/text_to_speech.py +177 -0
- intentkit/skills/unrealspeech/unrealspeech.jpg +0 -0
- intentkit/skills/venice_audio/__init__.py +106 -0
- intentkit/skills/venice_audio/base.py +119 -0
- intentkit/skills/venice_audio/input.py +41 -0
- intentkit/skills/venice_audio/schema.json +152 -0
- intentkit/skills/venice_audio/venice_audio.py +240 -0
- intentkit/skills/venice_audio/venice_logo.jpg +0 -0
- intentkit/skills/venice_image/README.md +119 -0
- intentkit/skills/venice_image/__init__.py +154 -0
- intentkit/skills/venice_image/api.py +138 -0
- intentkit/skills/venice_image/base.py +188 -0
- intentkit/skills/venice_image/config.py +35 -0
- intentkit/skills/venice_image/image_enhance/README.md +119 -0
- intentkit/skills/venice_image/image_enhance/__init__.py +0 -0
- intentkit/skills/venice_image/image_enhance/image_enhance.py +80 -0
- intentkit/skills/venice_image/image_enhance/image_enhance_base.py +23 -0
- intentkit/skills/venice_image/image_enhance/image_enhance_input.py +40 -0
- intentkit/skills/venice_image/image_generation/README.md +144 -0
- intentkit/skills/venice_image/image_generation/__init__.py +0 -0
- intentkit/skills/venice_image/image_generation/image_generation_base.py +117 -0
- intentkit/skills/venice_image/image_generation/image_generation_fluently_xl.py +26 -0
- intentkit/skills/venice_image/image_generation/image_generation_flux_dev.py +27 -0
- intentkit/skills/venice_image/image_generation/image_generation_flux_dev_uncensored.py +26 -0
- intentkit/skills/venice_image/image_generation/image_generation_input.py +158 -0
- intentkit/skills/venice_image/image_generation/image_generation_lustify_sdxl.py +26 -0
- intentkit/skills/venice_image/image_generation/image_generation_pony_realism.py +26 -0
- intentkit/skills/venice_image/image_generation/image_generation_stable_diffusion_3_5.py +28 -0
- intentkit/skills/venice_image/image_generation/image_generation_venice_sd35.py +28 -0
- intentkit/skills/venice_image/image_upscale/README.md +111 -0
- intentkit/skills/venice_image/image_upscale/__init__.py +0 -0
- intentkit/skills/venice_image/image_upscale/image_upscale.py +90 -0
- intentkit/skills/venice_image/image_upscale/image_upscale_base.py +23 -0
- intentkit/skills/venice_image/image_upscale/image_upscale_input.py +22 -0
- intentkit/skills/venice_image/image_vision/README.md +112 -0
- intentkit/skills/venice_image/image_vision/__init__.py +0 -0
- intentkit/skills/venice_image/image_vision/image_vision.py +100 -0
- intentkit/skills/venice_image/image_vision/image_vision_base.py +17 -0
- intentkit/skills/venice_image/image_vision/image_vision_input.py +9 -0
- intentkit/skills/venice_image/schema.json +267 -0
- intentkit/skills/venice_image/utils.py +78 -0
- intentkit/skills/venice_image/venice_image.jpg +0 -0
- intentkit/skills/web_scraper/README.md +82 -0
- intentkit/skills/web_scraper/__init__.py +92 -0
- intentkit/skills/web_scraper/base.py +21 -0
- intentkit/skills/web_scraper/langchain.png +0 -0
- intentkit/skills/web_scraper/schema.json +115 -0
- intentkit/skills/web_scraper/scrape_and_index.py +327 -0
- intentkit/utils/__init__.py +1 -0
- intentkit/utils/chain.py +436 -0
- intentkit/utils/error.py +134 -0
- intentkit/utils/logging.py +70 -0
- intentkit/utils/middleware.py +61 -0
- intentkit/utils/random.py +16 -0
- intentkit/utils/s3.py +267 -0
- intentkit/utils/slack_alert.py +79 -0
- intentkit/utils/tx.py +37 -0
- {intentkit-0.5.0.dist-info → intentkit-0.5.2.dist-info}/METADATA +1 -1
- intentkit-0.5.2.dist-info/RECORD +365 -0
- intentkit-0.5.0.dist-info/RECORD +0 -4
- {intentkit-0.5.0.dist-info → intentkit-0.5.2.dist-info}/WHEEL +0 -0
- {intentkit-0.5.0.dist-info → intentkit-0.5.2.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,504 @@
|
|
|
1
|
+
import datetime
|
|
2
|
+
import time
|
|
3
|
+
from typing import Type
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
from langchain.tools.base import ToolException
|
|
7
|
+
from langchain_core.runnables import RunnableConfig
|
|
8
|
+
from pydantic import BaseModel, Field, HttpUrl
|
|
9
|
+
|
|
10
|
+
from .base import ElfaBaseTool, base_url
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def get_current_epoch_timestamp() -> int:
|
|
14
|
+
"""Returns the current epoch timestamp (seconds since 1970-01-01 UTC)."""
|
|
15
|
+
return int(time.time())
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def get_yesterday_epoch_timestamp() -> int:
|
|
19
|
+
"""Returns the epoch timestamp for yesterday (beginning of yesterday in UTC)."""
|
|
20
|
+
yesterday = datetime.date.today() - datetime.timedelta(days=1)
|
|
21
|
+
# Combine with midnight time to get beginning of yesterday
|
|
22
|
+
yesterday_midnight = datetime.datetime.combine(yesterday, datetime.time.min)
|
|
23
|
+
# Convert to UTC
|
|
24
|
+
yesterday_midnight_utc = yesterday_midnight.replace(tzinfo=datetime.timezone.utc)
|
|
25
|
+
return int(yesterday_midnight_utc.timestamp())
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class ElfaGetMentionsInput(BaseModel):
|
|
29
|
+
pass
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class MediaUrl(BaseModel):
|
|
33
|
+
url: str | None = Field(None, description="Media URL")
|
|
34
|
+
type: str | None = Field(None, description="Media type")
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class AccountData(BaseModel):
|
|
38
|
+
name: str | None = Field(None, description="the name of the account")
|
|
39
|
+
location: str | None = Field(
|
|
40
|
+
None, description="the geographical location of the user account"
|
|
41
|
+
)
|
|
42
|
+
userSince: str | None = Field(None, description="account registration date")
|
|
43
|
+
description: str | None = Field(None, description="description of the account")
|
|
44
|
+
profileImageUrl: str | None = Field(None, description="url of the profile image")
|
|
45
|
+
profileBannerUrl: str | None = Field(
|
|
46
|
+
None, description="the url of the user profile banner"
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
class Account(BaseModel):
|
|
51
|
+
id: int | None = Field(None, description="id of the account")
|
|
52
|
+
username: str | None = Field(None, description="username of the account")
|
|
53
|
+
data: AccountData | None = Field(
|
|
54
|
+
None, description="detailed information of the account"
|
|
55
|
+
)
|
|
56
|
+
followerCount: int | None = Field(
|
|
57
|
+
None, description="the total number of the followers"
|
|
58
|
+
)
|
|
59
|
+
followingCount: int | None = Field(
|
|
60
|
+
None, description="the total number of the followings"
|
|
61
|
+
)
|
|
62
|
+
isVerified: bool | None = Field(
|
|
63
|
+
None, description="whether is a verified account of Twitter or not"
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
class TweetData(BaseModel):
|
|
68
|
+
mediaUrls: list[MediaUrl] | None = Field(
|
|
69
|
+
None, description="the URLs of the media files"
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
class Tweet(BaseModel):
|
|
74
|
+
id: str | None = Field(None, description="Tweet ID")
|
|
75
|
+
type: str | None = Field(None, description="Tweet type")
|
|
76
|
+
content: str | None = Field(None, description="content of the Tweet")
|
|
77
|
+
originalUrl: str | None = Field(None, description="the original URL of the tweet")
|
|
78
|
+
data: TweetData | None = Field(None, description="the data of the Tweet")
|
|
79
|
+
likeCount: int | None = Field(None, description="number of times liked")
|
|
80
|
+
quoteCount: int | None = Field(None, description="content of the quoted")
|
|
81
|
+
replyCount: int | None = Field(None, description="number of times replied")
|
|
82
|
+
repostCount: int | None = Field(None, description="number of the reposts")
|
|
83
|
+
viewCount: int | None = Field(None, description="number of views")
|
|
84
|
+
mentionedAt: str | None = Field(
|
|
85
|
+
None, description="the time of getting mentioned by other accounts"
|
|
86
|
+
)
|
|
87
|
+
bookmarkCount: int | None = Field(None, description="number of times bookmarked")
|
|
88
|
+
account: Account | None = Field(None, description="the account information")
|
|
89
|
+
repliedToUser: str | None = Field(None, description="replied to user")
|
|
90
|
+
repliedToTweet: str | None = Field(None, description="replied to tweet")
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
class ElfaGetMentionsOutput(BaseModel):
|
|
94
|
+
success: bool
|
|
95
|
+
data: list[Tweet] | None = Field(None, description="the list of tweets.")
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
class ElfaGetMentions(ElfaBaseTool):
|
|
99
|
+
"""
|
|
100
|
+
This tool uses the Elfa AI API to query hourly-updated tweets from "smart accounts" – accounts identified as influential or relevant – that have received at least 10 interactions (comments, retweets, quote tweets).
|
|
101
|
+
|
|
102
|
+
This tool is useful for:
|
|
103
|
+
|
|
104
|
+
* **Real-time Trend Analysis:** Identify emerging trends and discussions as they happen.
|
|
105
|
+
* **Competitor Monitoring:** Track the social media activity of your competitors.
|
|
106
|
+
* **Influencer Tracking:** Monitor the conversations and content shared by key influencers.
|
|
107
|
+
* **Reputation Management:** Identify and address potential PR issues.
|
|
108
|
+
|
|
109
|
+
The data returned includes the tweet content, timestamp, and potentially other relevant metadata.
|
|
110
|
+
|
|
111
|
+
Attributes:
|
|
112
|
+
name (str): Name of the tool, specifically "elfa_get_mentions".
|
|
113
|
+
description (str): Comprehensive description of the tool's purpose and functionality.
|
|
114
|
+
args_schema (Type[BaseModel]): Schema for input arguments, specifying expected parameters.
|
|
115
|
+
"""
|
|
116
|
+
|
|
117
|
+
name: str = "elfa_get_mentions"
|
|
118
|
+
description: str = """This tool uses the Elfa AI API to query hourly-updated tweets from "smart accounts" – accounts identified as influential or relevant – that have received at least 10 interactions (comments, retweets, quote tweets).
|
|
119
|
+
|
|
120
|
+
This tool is useful for:
|
|
121
|
+
|
|
122
|
+
* **Real-time Trend Analysis:** Identify emerging trends and discussions as they happen.
|
|
123
|
+
* **Competitor Monitoring:** Track the social media activity of your competitors.
|
|
124
|
+
* **Influencer Tracking:** Monitor the conversations and content shared by key influencers.
|
|
125
|
+
* **Reputation Management:** Identify and address potential PR issues.
|
|
126
|
+
|
|
127
|
+
The data returned includes the tweet content, timestamp, and potentially other relevant metadata."""
|
|
128
|
+
args_schema: Type[BaseModel] = ElfaGetMentionsInput
|
|
129
|
+
|
|
130
|
+
async def _arun(
|
|
131
|
+
self, config: RunnableConfig = None, **kwargs
|
|
132
|
+
) -> ElfaGetMentionsOutput:
|
|
133
|
+
"""Run the tool to get the the ELFA AI API to query hourly-updated tweets from smart accounts with at least 10 interactions (comments, retweets, quote tweets).
|
|
134
|
+
|
|
135
|
+
Args:
|
|
136
|
+
config: The configuration for the runnable, containing agent context.
|
|
137
|
+
**kwargs: Additional parameters.
|
|
138
|
+
|
|
139
|
+
Returns:
|
|
140
|
+
ElfaGetMentionsOutput: A structured output containing output of Elfa get mentions API.
|
|
141
|
+
|
|
142
|
+
Raises:
|
|
143
|
+
Exception: If there's an error accessing the Elfa API.
|
|
144
|
+
"""
|
|
145
|
+
context = self.context_from_config(config)
|
|
146
|
+
api_key = self.get_api_key(context)
|
|
147
|
+
if not api_key:
|
|
148
|
+
raise ValueError("Elfa API key not found")
|
|
149
|
+
|
|
150
|
+
url = f"{base_url}/v1/mentions"
|
|
151
|
+
headers = {
|
|
152
|
+
"accept": "application/json",
|
|
153
|
+
"x-elfa-api-key": api_key,
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
params = ElfaGetMentionsInput(limit=100, offset=0).model_dump(exclude_none=True)
|
|
157
|
+
|
|
158
|
+
async with httpx.AsyncClient() as client:
|
|
159
|
+
try:
|
|
160
|
+
response = await client.get(
|
|
161
|
+
url, headers=headers, timeout=30, params=params
|
|
162
|
+
)
|
|
163
|
+
response.raise_for_status()
|
|
164
|
+
json_dict = response.json()
|
|
165
|
+
|
|
166
|
+
res = ElfaGetMentionsOutput(**json_dict)
|
|
167
|
+
|
|
168
|
+
return res
|
|
169
|
+
except httpx.RequestError as req_err:
|
|
170
|
+
raise ToolException(
|
|
171
|
+
f"request error from Elfa API: {req_err}"
|
|
172
|
+
) from req_err
|
|
173
|
+
except httpx.HTTPStatusError as http_err:
|
|
174
|
+
raise ToolException(
|
|
175
|
+
f"http error from Elfa API: {http_err}"
|
|
176
|
+
) from http_err
|
|
177
|
+
except Exception as e:
|
|
178
|
+
raise ToolException(f"error from Elfa API: {e}") from e
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
class ElfaGetTopMentionsInput(BaseModel):
|
|
182
|
+
ticker: str = Field(description="Stock ticker symbol (e.g., ETH, $ETH, BTC, $BTC)")
|
|
183
|
+
timeWindow: str | None = Field("24h", description="Time window (e.g., 24h, 7d)")
|
|
184
|
+
includeAccountDetails: bool | None = Field(
|
|
185
|
+
False, description="Include account details"
|
|
186
|
+
)
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
class TopMentionsPostMetrics(BaseModel):
|
|
190
|
+
like_count: int | None = Field(None, description="Number of likes for the post")
|
|
191
|
+
reply_count: int | None = Field(None, description="Number of replies for the post")
|
|
192
|
+
repost_count: int | None = Field(None, description="Number of reposts for the post")
|
|
193
|
+
view_count: int | None = Field(None, description="Number of views for the post")
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
class TwitterAccountInfo(BaseModel):
|
|
197
|
+
username: str | None = Field(None, description="Twitter username")
|
|
198
|
+
twitter_user_id: str | None = Field(None, description="Twitter user ID")
|
|
199
|
+
description: str | None = Field(None, description="Twitter account description")
|
|
200
|
+
profileImageUrl: HttpUrl | None = Field(
|
|
201
|
+
None, description="URL of the profile image"
|
|
202
|
+
)
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
class TopMentionsPostData(BaseModel):
|
|
206
|
+
id: int | None = Field(None, description="Unique ID of the post")
|
|
207
|
+
twitter_id: str | None = Field(None, description="Twitter ID of the post")
|
|
208
|
+
twitter_user_id: str | None = Field(
|
|
209
|
+
None, description="Twitter user ID of the poster"
|
|
210
|
+
)
|
|
211
|
+
content: str | None = Field(None, description="Content of the post")
|
|
212
|
+
mentioned_at: str | None = Field(
|
|
213
|
+
None, description="Timestamp when the post was mentioned"
|
|
214
|
+
) # Consider using datetime if needed
|
|
215
|
+
type: str | None = Field(None, description="Type of the post (e.g., post, quote)")
|
|
216
|
+
metrics: TopMentionsPostMetrics | None = Field(
|
|
217
|
+
None, description="Metrics related to the post"
|
|
218
|
+
)
|
|
219
|
+
twitter_account_info: TwitterAccountInfo | None = Field(
|
|
220
|
+
None, description="Information about the Twitter account"
|
|
221
|
+
)
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
class TopMentionsData(BaseModel):
|
|
225
|
+
data: list[TopMentionsPostData] | None = Field(
|
|
226
|
+
None, description="List of post data"
|
|
227
|
+
)
|
|
228
|
+
total: int | None = Field(None, description="Total number of posts")
|
|
229
|
+
page: int | None = Field(None, description="Current page number")
|
|
230
|
+
pageSize: int | None = Field(None, description="Number of posts per page")
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
class ElfaGetTopMentionsOutput(BaseModel):
|
|
234
|
+
success: bool = Field(None, description="Indicates if the request was successful")
|
|
235
|
+
data: TopMentionsData | None = Field(None, description="Data returned by the API")
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
class ElfaGetTopMentions(ElfaBaseTool):
|
|
239
|
+
"""
|
|
240
|
+
This tool uses the Elfa API to query tweets mentioning a specific stock ticker. The tweets are ranked by view count, providing insight into the most visible and potentially influential discussions surrounding the stock. The results are updated hourly, allowing for real-time monitoring of market sentiment.
|
|
241
|
+
|
|
242
|
+
This tool is useful for:
|
|
243
|
+
|
|
244
|
+
* **Real-time Sentiment Analysis:** Track changes in public opinion about a stock.
|
|
245
|
+
* **News Monitoring:** Identify trending news and discussions related to a specific ticker.
|
|
246
|
+
* **Investor Insights:** Monitor the conversations and opinions of investors and traders.
|
|
247
|
+
|
|
248
|
+
To use this tool, simply provide the stock ticker symbol (e.g., "AAPL", "TSLA"). The tool will return a list of tweets, ranked by view count.
|
|
249
|
+
|
|
250
|
+
Attributes:
|
|
251
|
+
name (str): Name of the tool, specifically "elfa_get_top_mentions".
|
|
252
|
+
description (str): Comprehensive description of the tool's purpose and functionality.
|
|
253
|
+
args_schema (Type[BaseModel]): Schema for input arguments, specifying expected parameters.
|
|
254
|
+
"""
|
|
255
|
+
|
|
256
|
+
name: str = "elfa_get_top_mentions"
|
|
257
|
+
description: str = """This tool uses the Elfa API to query tweets mentioning a specific stock ticker. The tweets are ranked by view count, providing insight into the most visible and potentially influential discussions surrounding the stock. The results are updated hourly, allowing for real-time monitoring of market sentiment.
|
|
258
|
+
|
|
259
|
+
This tool is useful for:
|
|
260
|
+
|
|
261
|
+
* **Real-time Sentiment Analysis:** Track changes in public opinion about a stock.
|
|
262
|
+
* **News Monitoring:** Identify trending news and discussions related to a specific ticker.
|
|
263
|
+
* **Investor Insights:** Monitor the conversations and opinions of investors and traders.
|
|
264
|
+
|
|
265
|
+
To use this tool, simply provide the stock ticker symbol (e.g., "AAPL", "TSLA"). The tool will return a list of tweets, ranked by view count."""
|
|
266
|
+
args_schema: Type[BaseModel] = ElfaGetTopMentionsInput
|
|
267
|
+
|
|
268
|
+
def _run(
|
|
269
|
+
self,
|
|
270
|
+
ticker: str,
|
|
271
|
+
timeWindow: str = "24h",
|
|
272
|
+
includeAccountDetails: bool = False,
|
|
273
|
+
) -> ElfaGetTopMentionsOutput:
|
|
274
|
+
"""Run the tool to get the Elfa API to query tweets mentioning a specific stock ticker. The tweets are ranked by view count and the results are updated hourly.
|
|
275
|
+
|
|
276
|
+
Returns:
|
|
277
|
+
ElfaAskOutput: A structured output containing output of Elfa top mentions API.
|
|
278
|
+
|
|
279
|
+
Raises:
|
|
280
|
+
Exception: If there's an error accessing the Elfa API.
|
|
281
|
+
"""
|
|
282
|
+
raise NotImplementedError("Use _arun instead")
|
|
283
|
+
|
|
284
|
+
async def _arun(
|
|
285
|
+
self,
|
|
286
|
+
ticker: str,
|
|
287
|
+
timeWindow: str = "24h",
|
|
288
|
+
includeAccountDetails: bool = False,
|
|
289
|
+
config: RunnableConfig = None,
|
|
290
|
+
**kwargs,
|
|
291
|
+
) -> ElfaGetTopMentionsOutput:
|
|
292
|
+
"""Run the tool to get the Elfa API to query tweets mentioning a specific stock ticker. The tweets are ranked by view count and the results are updated hourly.
|
|
293
|
+
|
|
294
|
+
Args:
|
|
295
|
+
ticker: Stock ticker symbol.
|
|
296
|
+
timeWindow: Time window (optional).
|
|
297
|
+
includeAccountDetails: Include account details.
|
|
298
|
+
config: The configuration for the runnable, containing agent context.
|
|
299
|
+
**kwargs: Additional parameters.
|
|
300
|
+
|
|
301
|
+
Returns:
|
|
302
|
+
ElfaGetTopMentionsOutput: A structured output containing output of Elfa top mentions API.
|
|
303
|
+
|
|
304
|
+
Raises:
|
|
305
|
+
Exception: If there's an error accessing the Elfa API.
|
|
306
|
+
"""
|
|
307
|
+
context = self.context_from_config(config)
|
|
308
|
+
api_key = self.get_api_key(context)
|
|
309
|
+
if not api_key:
|
|
310
|
+
raise ValueError("Elfa API key not found")
|
|
311
|
+
|
|
312
|
+
url = f"{base_url}/v1/top-mentions"
|
|
313
|
+
headers = {
|
|
314
|
+
"accept": "application/json",
|
|
315
|
+
"x-elfa-api-key": api_key,
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
params = ElfaGetTopMentionsInput(
|
|
319
|
+
ticker=ticker,
|
|
320
|
+
timeWindow=timeWindow,
|
|
321
|
+
page=1,
|
|
322
|
+
pageSize=20,
|
|
323
|
+
includeAccountDetails=includeAccountDetails,
|
|
324
|
+
).model_dump(exclude_none=True)
|
|
325
|
+
|
|
326
|
+
async with httpx.AsyncClient() as client:
|
|
327
|
+
try:
|
|
328
|
+
response = await client.get(
|
|
329
|
+
url, headers=headers, timeout=30, params=params
|
|
330
|
+
)
|
|
331
|
+
response.raise_for_status()
|
|
332
|
+
json_dict = response.json()
|
|
333
|
+
|
|
334
|
+
res = ElfaGetTopMentionsOutput(**json_dict)
|
|
335
|
+
|
|
336
|
+
return res
|
|
337
|
+
except httpx.RequestError as req_err:
|
|
338
|
+
raise ToolException(
|
|
339
|
+
f"request error from Elfa API: {req_err}"
|
|
340
|
+
) from req_err
|
|
341
|
+
except httpx.HTTPStatusError as http_err:
|
|
342
|
+
raise ToolException(
|
|
343
|
+
f"http error from Elfa API: {http_err}"
|
|
344
|
+
) from http_err
|
|
345
|
+
except Exception as e:
|
|
346
|
+
raise ToolException(f"error from Elfa API: {e}") from e
|
|
347
|
+
|
|
348
|
+
|
|
349
|
+
class ElfaSearchMentionsInput(BaseModel):
|
|
350
|
+
keywords: str = Field(
|
|
351
|
+
description="Up to 5 keywords to search for, separated by commas. Phrases accepted"
|
|
352
|
+
)
|
|
353
|
+
from_: int | None = Field(
|
|
354
|
+
None, description="Start date (unix timestamp), set default as 24 hours ago"
|
|
355
|
+
)
|
|
356
|
+
to: int | None = Field(
|
|
357
|
+
None, description="End date (unix timestamp), set default as now"
|
|
358
|
+
)
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
class SearchMentionsPostMetrics(BaseModel):
|
|
362
|
+
like_count: int | None = Field(None, description="Number of likes for the post")
|
|
363
|
+
reply_count: int | None = Field(None, description="Number of replies for the post")
|
|
364
|
+
repost_count: int | None = Field(None, description="Number of reposts for the post")
|
|
365
|
+
view_count: int | None = Field(None, description="Number of views for the post")
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
class SearchMentionsPostData(BaseModel):
|
|
369
|
+
id: int | None = Field(None, description="Unique ID of the post")
|
|
370
|
+
twitter_id: str | None = Field(None, description="Twitter ID of the post")
|
|
371
|
+
twitter_user_id: str | None = Field(
|
|
372
|
+
None, description="Twitter user ID of the poster"
|
|
373
|
+
)
|
|
374
|
+
content: str | None = Field(None, description="Content of the post")
|
|
375
|
+
mentioned_at: str | None = Field(
|
|
376
|
+
None, description="Timestamp when the post was mentioned"
|
|
377
|
+
)
|
|
378
|
+
type: str | None = Field(
|
|
379
|
+
None, description="Type of the post (e.g., post, quote, repost)"
|
|
380
|
+
)
|
|
381
|
+
metrics: SearchMentionsPostMetrics | None = Field(
|
|
382
|
+
None, description="Metrics related to the post"
|
|
383
|
+
)
|
|
384
|
+
sentiment: str | None = Field(
|
|
385
|
+
None, description="Sentiment of the post (e.g., positive, negative, neutral)"
|
|
386
|
+
)
|
|
387
|
+
|
|
388
|
+
|
|
389
|
+
class ElfaSearchMentionsOutput(BaseModel):
|
|
390
|
+
success: bool | None
|
|
391
|
+
data: list[SearchMentionsPostData] | None = Field(
|
|
392
|
+
None, description="the list of tweets."
|
|
393
|
+
)
|
|
394
|
+
|
|
395
|
+
|
|
396
|
+
class ElfaSearchMentions(ElfaBaseTool):
|
|
397
|
+
"""
|
|
398
|
+
This tool uses the Elfa API to search tweets mentioning up to five keywords. It can search within the past 30 days of data, which is updated every 5 minutes, or access up to six months of historical tweet data.
|
|
399
|
+
|
|
400
|
+
This tool is useful for:
|
|
401
|
+
|
|
402
|
+
* **Market Research:** Track conversations and sentiment around specific products or industries.
|
|
403
|
+
* **Brand Monitoring:** Monitor mentions of your brand and identify potential PR issues.
|
|
404
|
+
* **Public Opinion Tracking:** Analyze public opinion on various topics.
|
|
405
|
+
* **Competitive Analysis:** See what people are saying about your competitors.
|
|
406
|
+
|
|
407
|
+
To use this tool, provide up to five keywords. You can also specify whether you want to search recent or historical tweets.
|
|
408
|
+
|
|
409
|
+
Attributes:
|
|
410
|
+
name (str): Name of the tool, specifically "elfa_search_mentions".
|
|
411
|
+
description (str): Comprehensive description of the tool's purpose and functionality.
|
|
412
|
+
args_schema (Type[BaseModel]): Schema for input arguments, specifying expected parameters.
|
|
413
|
+
"""
|
|
414
|
+
|
|
415
|
+
name: str = "elfa_search_mentions"
|
|
416
|
+
description: str = """This tool uses the Elfa API to search tweets mentioning up to five keywords. It can search within the past 30 days of data, which is updated every 5 minutes, or access up to six months of historical tweet data.
|
|
417
|
+
|
|
418
|
+
This tool is useful for:
|
|
419
|
+
|
|
420
|
+
* **Market Research:** Track conversations and sentiment around specific products or industries.
|
|
421
|
+
* **Brand Monitoring:** Monitor mentions of your brand and identify potential PR issues.
|
|
422
|
+
* **Public Opinion Tracking:** Analyze public opinion on various topics.
|
|
423
|
+
* **Competitive Analysis:** See what people are saying about your competitors.
|
|
424
|
+
|
|
425
|
+
To use this tool, provide up to five keywords. You can also specify whether you want to search recent or historical tweets."""
|
|
426
|
+
args_schema: Type[BaseModel] = ElfaSearchMentionsInput
|
|
427
|
+
|
|
428
|
+
def _run(
|
|
429
|
+
self,
|
|
430
|
+
keywords: str,
|
|
431
|
+
from_: int = get_current_epoch_timestamp(),
|
|
432
|
+
to: int = get_yesterday_epoch_timestamp(),
|
|
433
|
+
) -> ElfaSearchMentionsOutput:
|
|
434
|
+
"""Run the tool to for tweets mentioning up to five keywords within the past 30 days. It can access up to six months of historical tweet data, updated every five minutes via the Elfa API.
|
|
435
|
+
|
|
436
|
+
Returns:
|
|
437
|
+
ElfaAskOutput: A structured output containing output of Elfa top mentions API.
|
|
438
|
+
|
|
439
|
+
Raises:
|
|
440
|
+
Exception: If there's an error accessing the Elfa API.
|
|
441
|
+
"""
|
|
442
|
+
raise NotImplementedError("Use _arun instead")
|
|
443
|
+
|
|
444
|
+
async def _arun(
|
|
445
|
+
self,
|
|
446
|
+
keywords: str,
|
|
447
|
+
from_: int = get_current_epoch_timestamp(),
|
|
448
|
+
to: int = get_yesterday_epoch_timestamp(),
|
|
449
|
+
config: RunnableConfig = None,
|
|
450
|
+
**kwargs,
|
|
451
|
+
) -> ElfaSearchMentionsOutput:
|
|
452
|
+
"""Run the tool to for tweets mentioning up to five keywords within the past 30 days. It can access up to six months of historical tweet data, updated every five minutes via the Elfa API.
|
|
453
|
+
|
|
454
|
+
Args:
|
|
455
|
+
keywords: Keywords to search.
|
|
456
|
+
from_: Start date (Unix timestamp).
|
|
457
|
+
to: End date (Unix timestamp).
|
|
458
|
+
config: The configuration for the runnable, containing agent context.
|
|
459
|
+
**kwargs: Additional parameters.
|
|
460
|
+
|
|
461
|
+
Returns:
|
|
462
|
+
ElfaSearchMentionsOutput: A structured output containing output of Elfa top mentions API.
|
|
463
|
+
|
|
464
|
+
Raises:
|
|
465
|
+
Exception: If there's an error accessing the Elfa API.
|
|
466
|
+
"""
|
|
467
|
+
context = self.context_from_config(config)
|
|
468
|
+
api_key = self.get_api_key(context)
|
|
469
|
+
if not api_key:
|
|
470
|
+
raise ValueError("Elfa API key not found")
|
|
471
|
+
|
|
472
|
+
url = f"{base_url}/v1/mentions/search"
|
|
473
|
+
headers = {
|
|
474
|
+
"accept": "application/json",
|
|
475
|
+
"x-elfa-api-key": api_key,
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
params = ElfaSearchMentionsInput(
|
|
479
|
+
keywords=keywords,
|
|
480
|
+
from_=from_,
|
|
481
|
+
to=to,
|
|
482
|
+
).model_dump(exclude_none=True)
|
|
483
|
+
|
|
484
|
+
async with httpx.AsyncClient() as client:
|
|
485
|
+
try:
|
|
486
|
+
response = await client.get(
|
|
487
|
+
url, headers=headers, timeout=30, params=params
|
|
488
|
+
)
|
|
489
|
+
response.raise_for_status()
|
|
490
|
+
json_dict = response.json()
|
|
491
|
+
|
|
492
|
+
res = ElfaSearchMentionsOutput(**json_dict)
|
|
493
|
+
|
|
494
|
+
return res
|
|
495
|
+
except httpx.RequestError as req_err:
|
|
496
|
+
raise ToolException(
|
|
497
|
+
f"request error from Elfa API: {req_err}"
|
|
498
|
+
) from req_err
|
|
499
|
+
except httpx.HTTPStatusError as http_err:
|
|
500
|
+
raise ToolException(
|
|
501
|
+
f"http error from Elfa API: {http_err}"
|
|
502
|
+
) from http_err
|
|
503
|
+
except Exception as e:
|
|
504
|
+
raise ToolException(f"error from Elfa API: {e}") from e
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"title": "Elfa",
|
|
5
|
+
"description": "Integration with Elfa AI API providing data analysis and processing capabilities with secure authentication for advanced data operations",
|
|
6
|
+
"x-icon": "https://ai.service.crestal.dev/skills/elfa/elfa.jpg",
|
|
7
|
+
"x-tags": [
|
|
8
|
+
"Data"
|
|
9
|
+
],
|
|
10
|
+
"x-nft-requirement": 1,
|
|
11
|
+
"properties": {
|
|
12
|
+
"enabled": {
|
|
13
|
+
"type": "boolean",
|
|
14
|
+
"title": "Enabled",
|
|
15
|
+
"description": "Whether this skill is enabled",
|
|
16
|
+
"default": true
|
|
17
|
+
},
|
|
18
|
+
"states": {
|
|
19
|
+
"type": "object",
|
|
20
|
+
"properties": {
|
|
21
|
+
"get_mentions": {
|
|
22
|
+
"type": "string",
|
|
23
|
+
"title": "Get Mentions",
|
|
24
|
+
"enum": [
|
|
25
|
+
"disabled",
|
|
26
|
+
"public",
|
|
27
|
+
"private"
|
|
28
|
+
],
|
|
29
|
+
"x-enum-title": [
|
|
30
|
+
"Disabled",
|
|
31
|
+
"Agent Owner + All Users",
|
|
32
|
+
"Agent Owner Only"
|
|
33
|
+
],
|
|
34
|
+
"description": "This tool uses the Elfa AI API to query hourly-updated tweets from \"smart accounts\" \u2013 accounts identified as influential or relevant \u2013 that have received at least 10 interactions (comments, retweets, quote tweets).",
|
|
35
|
+
"default": "disabled"
|
|
36
|
+
},
|
|
37
|
+
"get_top_mentions": {
|
|
38
|
+
"type": "string",
|
|
39
|
+
"title": "Get Top Mentions",
|
|
40
|
+
"enum": [
|
|
41
|
+
"disabled",
|
|
42
|
+
"public",
|
|
43
|
+
"private"
|
|
44
|
+
],
|
|
45
|
+
"x-enum-title": [
|
|
46
|
+
"Disabled",
|
|
47
|
+
"Agent Owner + All Users",
|
|
48
|
+
"Agent Owner Only"
|
|
49
|
+
],
|
|
50
|
+
"description": "This tool uses the Elfa API to query tweets mentioning a specific stock ticker. The tweets are ranked by view count, providing insight into the most visible and potentially influential discussions surrounding the stock. The results are updated hourly, allowing for real-time monitoring of market sentiment.",
|
|
51
|
+
"default": "private"
|
|
52
|
+
},
|
|
53
|
+
"search_mentions": {
|
|
54
|
+
"type": "string",
|
|
55
|
+
"title": "Search Mentions",
|
|
56
|
+
"enum": [
|
|
57
|
+
"disabled",
|
|
58
|
+
"public",
|
|
59
|
+
"private"
|
|
60
|
+
],
|
|
61
|
+
"x-enum-title": [
|
|
62
|
+
"Disabled",
|
|
63
|
+
"Agent Owner + All Users",
|
|
64
|
+
"Agent Owner Only"
|
|
65
|
+
],
|
|
66
|
+
"description": "This tool uses the Elfa API to search tweets mentioning up to five keywords. It can search within the past 30 days of data, which is updated every 5 minutes, or access up to six months of historical tweet data.",
|
|
67
|
+
"default": "private"
|
|
68
|
+
},
|
|
69
|
+
"get_trending_tokens": {
|
|
70
|
+
"type": "string",
|
|
71
|
+
"title": "Get Trending Tokens",
|
|
72
|
+
"enum": [
|
|
73
|
+
"disabled",
|
|
74
|
+
"public",
|
|
75
|
+
"private"
|
|
76
|
+
],
|
|
77
|
+
"x-enum-title": [
|
|
78
|
+
"Disabled",
|
|
79
|
+
"Agent Owner + All Users",
|
|
80
|
+
"Agent Owner Only"
|
|
81
|
+
],
|
|
82
|
+
"description": "This tool ranks the most discussed tokens based on smart mentions count for a given period, with updates every 5 minutes via the Elfa API. Smart mentions provide a more sophisticated measure of discussion volume than simple keyword counts.",
|
|
83
|
+
"default": "disabled"
|
|
84
|
+
},
|
|
85
|
+
"get_smart_stats": {
|
|
86
|
+
"type": "string",
|
|
87
|
+
"title": "Get Smart Stats",
|
|
88
|
+
"enum": [
|
|
89
|
+
"disabled",
|
|
90
|
+
"public",
|
|
91
|
+
"private"
|
|
92
|
+
],
|
|
93
|
+
"x-enum-title": [
|
|
94
|
+
"Disabled",
|
|
95
|
+
"Agent Owner + All Users",
|
|
96
|
+
"Agent Owner Only"
|
|
97
|
+
],
|
|
98
|
+
"description": "This tool uses the Elfa API to retrieve key social media metrics for a given username. These metrics include Smart Following Count, Engagement Score, and Engagement Ratio.",
|
|
99
|
+
"default": "private"
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
"description": "States for each Elfa skill (disabled, public, or private)"
|
|
103
|
+
},
|
|
104
|
+
"api_key_provider": {
|
|
105
|
+
"type": "string",
|
|
106
|
+
"title": "API Key Provider",
|
|
107
|
+
"description": "Provider of the API key",
|
|
108
|
+
"enum": [
|
|
109
|
+
"platform",
|
|
110
|
+
"agent_owner"
|
|
111
|
+
],
|
|
112
|
+
"x-enum-title": [
|
|
113
|
+
"Nation Hosted",
|
|
114
|
+
"Owner Provided"
|
|
115
|
+
],
|
|
116
|
+
"default": "platform"
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
"required": [
|
|
120
|
+
"states",
|
|
121
|
+
"enabled"
|
|
122
|
+
],
|
|
123
|
+
"if": {
|
|
124
|
+
"properties": {
|
|
125
|
+
"api_key_provider": {
|
|
126
|
+
"const": "agent_owner"
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
"then": {
|
|
131
|
+
"properties": {
|
|
132
|
+
"api_key": {
|
|
133
|
+
"type": "string",
|
|
134
|
+
"title": "Elfa API Key",
|
|
135
|
+
"x-sensitive": true,
|
|
136
|
+
"description": "Elfa API key for authentication"
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
"if": {
|
|
140
|
+
"properties": {
|
|
141
|
+
"enabled": {
|
|
142
|
+
"const": true
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
"then": {
|
|
147
|
+
"required": [
|
|
148
|
+
"api_key"
|
|
149
|
+
]
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
"additionalProperties": true
|
|
153
|
+
}
|