Natural Language Queries
Interact with blockchain data using natural language through our advanced AI agent. Hexa AI's custom Language Model processes your queries and returns structured, accurate blockchain data in real-time.
AI-Powered Queries
Our custom LLM is trained on vast amounts of blockchain data and continuously updated to understand complex DeFi concepts, token metrics, and market dynamics.
Implementation
Basic Query Example
import { HexaAI } from '@hexaai/sdk';
// Initialize the SDK with your API key
const hexa = new HexaAI('your_api_key');
// Create an async function to query blockchain data
async function queryBlockchain() {
try {
const response = await hexa.query({
text: "What is the current TVL of Uniswap?",
chainId: 1, // Ethereum mainnet
});
console.log(response);
// {
// tvl: "5234567890.45",
// timestamp: "2024-01-27T12:34:56Z",
// confidence: 0.98
// }
} catch (error) {
console.error('Query failed:', error);
}
}
Advanced Query with Parameters
// Stream real-time responses for complex queries
const stream = await hexa.queryStream({
text: "Monitor SOL/USD price and alert if it drops below $80",
parameters: {
threshold: 80,
interval: "1m",
alertChannel: "webhook"
},
webhook: "https://api.yourservice.com/alerts"
});
stream.on('update', (data) => {
console.log('Price Update:', data);
});
stream.on('alert', (alert) => {
console.log('Threshold Alert:', alert);
});
Key Features
Context-Aware Understanding
Our AI agent understands complex DeFi concepts, token mechanics, and blockchain-specific terminology, providing accurate responses to domain-specific queries.
Real-Time Processing
Queries are processed in real-time with sub-second latency, enabling immediate access to current blockchain state and market data.
Multi-Chain Support
Query data across multiple blockchain networks simultaneously, with support for Ethereum, Solana, and other major networks.
Structured Output
Responses can be returned in multiple formats including JSON, pandas DataFrames, and streaming updates for real-time monitoring.