Added Prompt for tools (#68)
* Create detailed markdown instructions for all toolkits * Update all toolkit classes to load instructions from external .md files * Add query examples for cryptocurrency report generation
This commit was merged in pull request #68.
This commit is contained in:
@@ -12,21 +12,69 @@
|
||||
**TASK:** Retrieve cryptocurrency price data based on user requests.
|
||||
|
||||
**PARAMETERS:**
|
||||
- **Asset ID**: Convert common names to tickers (Bitcoin → BTC, Ethereum → ETH)
|
||||
- **Time Range**: Parse user request (e.g., "last 7 days", "past month", "today")
|
||||
- **Asset ID Conversion** (CRITICAL - Always convert common name to tickers):
|
||||
* Bitcoin → BTC
|
||||
* Ethereum → ETH
|
||||
* Solana → SOL
|
||||
* Cardano → ADA
|
||||
* Ripple → XRP
|
||||
* Polkadot → DOT
|
||||
* Dogecoin → DOGE
|
||||
- **Time Range Interpretation**:
|
||||
* "last 7 days" / "past week" → limit=7
|
||||
* "last 30 days" / "past month" → limit=30
|
||||
* "last 24 hours" / "today" → limit=1
|
||||
* "last 3 months" → limit=90
|
||||
- **Interval**: Determine granularity (hourly, daily, weekly) from context
|
||||
- **Defaults**: If not specified, use current price or last 24h data
|
||||
|
||||
**TOOL DESCRIPTIONS:**
|
||||
- get_product: Fetches current price for a specific cryptocurrency from a single source.
|
||||
- get_historical_price: Retrieves historical price data for a cryptocurrency over a specified time range from a single source.
|
||||
- get_products_aggregated: Fetches current prices by aggregating data from multiple sources. Use this if user requests more specific or reliable data.
|
||||
- get_historical_prices_aggregated: Retrieves historical price data by aggregating multiple sources. Use this if user requests more specific or reliable data.
|
||||
**AVAILABLE TOOLS (6 total):**
|
||||
|
||||
**SINGLE-SOURCE TOOLS (FAST - Use by default for quick queries):**
|
||||
1. **get_product(asset_id: str)** → ProductInfo
|
||||
- Fetches current price for ONE asset from first available provider
|
||||
- Example: get_product("BTC")
|
||||
- Use when: Quick price check for single asset
|
||||
|
||||
2. **get_products(asset_ids: list[str])** → list[ProductInfo]
|
||||
- Fetches current prices for MULTIPLE assets from first available provider
|
||||
- Example: get_products(["BTC", "ETH", "SOL"])
|
||||
- Use when: Quick prices for multiple assets
|
||||
|
||||
3. **get_historical_prices(asset_id: str, limit: int)** → list[Price]
|
||||
- Fetches historical data for ONE asset from first available provider
|
||||
- Example: get_historical_prices("BTC", limit=7) for last 7 days
|
||||
- Use when: Price history needed (7 days → limit=7, 30 days → limit=30)
|
||||
|
||||
**AGGREGATED TOOLS (COMPREHENSIVE - Use only when explicitly requested):**
|
||||
4. **get_product_aggregated(asset_id: str)** → ProductInfo
|
||||
- Queries ALL providers (Binance, YFinance, Coinbase, CryptoCompare) and aggregates using VWAP
|
||||
- Returns most accurate/reliable price
|
||||
- Use when: User requests "accurate", "reliable", "comprehensive", "from all sources"
|
||||
- Warning: Uses 4x API calls
|
||||
|
||||
5. **get_products_aggregated(asset_ids: list[str])** → list[ProductInfo]
|
||||
- Queries ALL providers for multiple assets and aggregates
|
||||
- Use when: User requests detailed/comprehensive multi-asset analysis
|
||||
- Warning: Uses 4x API calls per asset
|
||||
|
||||
6. **get_historical_prices_aggregated(asset_id: str, limit: int)** → list[Price]
|
||||
- Queries ALL providers for historical data and aggregates
|
||||
- Use when: User requests comprehensive historical analysis
|
||||
- Warning: Uses 4x API calls
|
||||
|
||||
**TOOL SELECTION STRATEGY:**
|
||||
- "What's BTC price?" → get_product("BTC") [#1]
|
||||
- "Get accurate BTC price" → get_product_aggregated("BTC") [#4]
|
||||
- "Compare BTC, ETH, SOL" → get_products(["BTC", "ETH", "SOL"]) [#2]
|
||||
- "Detailed analysis of BTC and ETH" → get_products_aggregated(["BTC", "ETH"]) [#5]
|
||||
- "BTC price last week" → get_historical_prices("BTC", limit=7) [#3]
|
||||
- "Comprehensive BTC history" → get_historical_prices_aggregated("BTC", limit=30) [#6]
|
||||
|
||||
**OUTPUT FORMAT JSON:**
|
||||
|
||||
**Current Price Request:**
|
||||
```
|
||||
```json
|
||||
{
|
||||
Asset: [TICKER]
|
||||
Current Price: $[PRICE]
|
||||
@@ -36,7 +84,7 @@
|
||||
```
|
||||
|
||||
**Historical Data Request:**
|
||||
```
|
||||
```json
|
||||
{
|
||||
"Asset": "[TICKER]",
|
||||
"Period": {
|
||||
@@ -62,8 +110,12 @@
|
||||
4. **Report data completeness**: If user asks for 30 days but got 7, state this explicitly
|
||||
5. **Current date context**: Remind that data is as of {{CURRENT_DATE}}
|
||||
6. **Token Optimization**: Be extremely concise to save tokens. Provide all necessary data using as few words as possible. Exceed 100 words ONLY if absolutely necessary to include all required data points.
|
||||
7. **Aggregation indicator**: In aggregated results, the 'provider' field shows which sources were used
|
||||
8. **Currency**: All prices are typically in USD unless specified otherwise
|
||||
|
||||
**ERROR HANDLING:**
|
||||
- Tools failed → "Price data unavailable. Error: [details if available]"
|
||||
- All providers fail → "Price data unavailable from all sources. Error: [details if available]"
|
||||
- Partial data → Report what was retrieved + note missing portions
|
||||
- Wrong asset → "Unable to find price data for [ASSET]. Check ticker symbol."
|
||||
- API rate limits → Try single-source tools instead of aggregated tools
|
||||
- Invalid asset symbol → Suggest correct ticker or similar assets
|
||||
|
||||
Reference in New Issue
Block a user