https://github.com/thirdweb-example/thirdweb-ai-langgraph
https://github.com/thirdweb-example/thirdweb-ai-langgraph
Last synced: 10 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/thirdweb-example/thirdweb-ai-langgraph
- Owner: thirdweb-example
- Created: 2025-03-19T18:38:04.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-03-21T16:39:33.000Z (11 months ago)
- Last Synced: 2025-05-05T07:43:40.798Z (10 months ago)
- Language: Python
- Size: 170 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Insight Chat - Blockchain AI Assistant
Insight Chat is an AI-powered assistant for interacting with blockchain data using natural language. Built with `thirdweb-ai` using [thirdweb Insight](https://thirdweb.com/insight), LangChain and Claude, it provides real-time blockchain insights through an interactive chat interface.
## Features
- **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
## Installation
### Prerequisites
- Python 3.12 or higher
- Thirdweb API key
- Anthropic API key (for Claude 3)
- Exa API key (for web search)
### Setup
1. Clone the repository:
```bash
git clone https://github.com/cjber/thirdweb-ai-langgraph.git
cd thirdweb-ai-langgraph
```
2. Install dependencies using uv:
```bash
uv sync
```
3. Set up environment variables:
```bash
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
```
## Usage
Run the chat interface:
```bash
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?
## Configuration
Environment Variables:
- `THIRDWEB_SECRET_KEY`: Your Thirdweb API secret key
- `ANTHROPIC_API_KEY`: Anthropic API key (for Claude 3)
- `EXA_API_KEY`: Exa API key for web search
## Development
### Key Components
- **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`