“檢測結果出來了,沒有一絲人工添加,全是 AI”
之前這個 Dune Query 約 95% 工作量都是由 AI 完成。這篇文章主要介紹 DuneAI ,以及如何使用 AI 高效進行提示詞工程(AI 互調?)
第一部分:Dune AI 使用簡單介紹
@Dune 內置的 AI 能夠幫助用戶使用自然語言快速生成 SQL 查詢。在新建查詢(Query)後可以在代碼塊底部看到提示詞輸入口
使用要點:
1. 使用英文清楚地表達想要查詢的內容,提供上下文,包括數據庫、時間範圍、具體的合約地址、代幣符號等關鍵信息
- 示例:"List all trades involving WETH (0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2) on Uniswap v3 in the past 24 hours"
2. 根據初始結果調整查詢需求
- Dune AI 內置了測試用例,確保生成的查詢可以正常運行
- 使用查詢代碼頂部"fix"功能,可以基於已有查詢進行修改和微調
具體介紹可見官方文檔:
第二部分:多 Agent 提示詞工程
在實際工作中,單獨依賴一個 AI 工具往往難以得到最佳結果。這裡介紹的一套多 Agent 協作的提示詞工程(Prompt Engineerimg)流程,可以顯著提高查詢質量和效率,並擴展到其他業務場景中
基本工作流程
1. 任務描述:首先明確表達業務需求
2. AI1處理:使用通用AI(如ChatGPT或DeepSeek)將需求轉化為專業提示詞
3. AI2執行:將優化後的提示詞輸入專業AI(如Dune AI)執行
4. 結果評估:檢查初步結果是否滿足需求
5. 迭代優化:根據需要調整提示詞,重複上述過程
可以根據需求靈活選擇貼近業務場景的 AI2,如使用 Dune AI 生成查詢、 Copilot Claude 3 完成編程任務、 Grok 3 檢索整理推特信息等
例如我的第一階段提示詞為:
“
我需要分析Solana鏈上特定代幣的交易行為,找出在指定時間範圍內:
1. 買入次數超過N次的地址
2. 每次買入金額大於X美元的地址
3. 淨流入(總買入-總賣出)大於Y美元的地址
4. 賣出次數不超過Z次的地址
最終需要返回這些地址的詳細信息,包括:
- 錢包地址
- 淨流入金額
- 買入次數
- 賣出次數
- 首次交易時間
- 最後一次交易時間
- 代幣地址
請幫我把這個需求轉化為Dune AI能夠理解的專業提示詞格式,包括所有必要的模式和參數定義;使用英文;相關數據庫文檔:(我這裡提供了 中的描述)
”
之後我對第二階段提示詞進行了微調,並交由 Dune AI 生成查詢;使用的第二階段提示詞我放在了評論區
希望這一篇文章對你有幫助
(是的,這篇文章也使用了這個技巧,圖都是用 AI 生成了 mermaid 語法後用 AI 畫的)

第二階段 Prompt
Scheme: `dex_solana.trades`
Scheme Attributes:
block_time: timestamp, UTC timestamp of trade
amount_usd: double, unsigned USD value of the token traded
token_bought_mint_address: string, if token_mint_address here then the trade is identified as buy
token_sold_mint_address: string, if token_mint_address here then the trade is identified as sell
trader_id: string, wallet address
token_
Required Inputs:
token_mint_address: string, solana token mint address to filter;
start_datetime: date, start time;
end_datetime: date, end time. Both in utc time;
min_num_buys: number, minimal total number of buys within the time range;
min_amount_per_buy: number, minimal amount for each buy, in USD;
min_net_inflow: number, minimal amount summing inflow(total buy - total sell), in USD;
max_num_sells: number, maximal total number of sells within the time range;
Required Output :
wallet_address: strings, wallet addresses matching above fields .
net_inflow:number, signed total inflow
num_buys: number, number of buys within time range
num_sells:number, number of sells within time range
first_trade_datetime:date, datetime first trade within the time range
last_trade_datetime:date, last trade within the time range
token_mint_address: string
Write the SQL for me given the above requirements. Wrap the input parameters using double curly brackets {{}} in the SQL lines as place holders.
18
5,278
本頁面內容由第三方提供。除非另有說明,OKX 不是所引用文章的作者,也不對此類材料主張任何版權。該內容僅供參考,並不代表 OKX 觀點,不作為任何形式的認可,也不應被視為投資建議或購買或出售數字資產的招攬。在使用生成式人工智能提供摘要或其他信息的情況下,此類人工智能生成的內容可能不準確或不一致。請閱讀鏈接文章,瞭解更多詳情和信息。OKX 不對第三方網站上的內容負責。包含穩定幣、NFTs 等在內的數字資產涉及較高程度的風險,其價值可能會產生較大波動。請根據自身財務狀況,仔細考慮交易或持有數字資產是否適合您。