Insight Chat is an AI-powered assistant for interacting with blockchain data using natural language. Built with thirdweb-ai
using thirdweb Insight, LangChain and Claude, it provides real-time blockchain insights through an interactive chat interface.
- Natural Language Queries: Ask questions about blockchain data in plain English
- Multi-step Reasoning: Handles complex queries requiring multiple data lookups
- Tool Integration:
- Thirdweb blockchain tools
- JSON data extraction
- Web content retrieval
- Rich Interface: Beautiful terminal interface with progress tracking
- Caching: In-memory caching for faster responses
- Python 3.12 or higher
- Thirdweb API key
- Anthropic API key (for Claude 3)
- Exa API key (for web search)
- Clone the repository:
git clone https://github.com/cjber/thirdweb-ai-langgraph.git
cd thirdweb-ai-langgraph
- Install dependencies using uv:
uv sync
- Set up environment variables:
cp .env.example .env
# Edit .env with your API keys:
# THIRDWEB_SECRET_KEY=your_thirdweb_key
# ANTHROPIC_API_KEY=your_anthropic_key
# EXA_API_KEY=your_exa_api_key
# OPENAI_API_KEY=your_openai_api_key # not required for insight_chat.py
Run the chat interface:
python insight_chat.py
Example queries:
Note that the model supports memory:
-
How much USDT does 0xC22166664e820cdA6bf4cedBdbb4fa1E6A84C440 own?
-
How many different ERC20 tokens does this address own?
-
What is the ENS name of 0xEb0effdFB4dC5b3d5d3aC6ce29F3ED213E95d675?
-
How many different ERC20 tokens does this wallet own?
-
How many ERC721 NFTs does this address own?
Environment Variables:
THIRDWEB_SECRET_KEY
: Your Thirdweb API secret keyANTHROPIC_API_KEY
: Anthropic API key (for Claude 3)EXA_API_KEY
: Exa API key for web search
- Graph Processing:
src/graph.py
- LLM Configuration:
src/llm.py
- Tools Integration:
src/tools.py
- Intent Detection:
src/chains/intent_chain.py
- Reasoning Chain:
src/chains/react_chain.py