|
1 | | -# Pattern Core |
| 1 | +# Pattern Core API |
2 | 2 |
|
3 | | -This repository, **Pattern Core**, is a monorepo that contains both the API and the client. |
| 3 | +## Initialization |
4 | 4 |
|
5 | | -For more details, please refer to the [API documentation](https://github.com/pattern-tech/pattern-core/tree/develop/api) and the [client documentation](https://github.com/pattern-tech/pattern-core/tree/develop/client). |
| 5 | +### Install Requirements |
| 6 | + |
| 7 | +To install the required dependencies, run: |
| 8 | + |
| 9 | +```sh |
| 10 | +cp .env.example .env |
| 11 | +pip install -r requirements.txt |
| 12 | +``` |
| 13 | + |
| 14 | +Note: Fill up the `.env` file according to your config |
| 15 | + |
| 16 | + |
| 17 | +Notes: |
| 18 | +- Add your own tool services or use existing ones |
| 19 | +- Add provided agents (currently : ``ETHER_SCAN, MORALIS, GOLDRUSH``) |
| 20 | +- Choose the llm provider |
| 21 | + |
| 22 | +### Running the Application |
| 23 | + |
| 24 | +#### method 1) Locally |
| 25 | + |
| 26 | +Check the services dependency and make sure all services are up with config provided in `.env` file |
| 27 | + |
| 28 | +depend services: |
| 29 | +- postgres |
| 30 | + |
| 31 | +##### Run main app |
| 32 | +If you have `make` installed on your machine, you can start the application using: |
| 33 | + |
| 34 | +```sh |
| 35 | +make watch |
| 36 | +``` |
| 37 | + |
| 38 | +Otherwise, you can manually run it with: |
| 39 | + |
| 40 | +```sh |
| 41 | +python3 -m uvicorn src.main:app --host 0.0.0.0 --reload |
| 42 | +``` |
| 43 | + |
| 44 | +#### method 2) Docker Compose |
| 45 | + |
| 46 | +If you have docker compose installed, run: |
| 47 | + |
| 48 | +```sh |
| 49 | +docker compose -f docker-compose.yaml up |
| 50 | +``` |
| 51 | + |
| 52 | +By default, the API runs on port `8000`: |
| 53 | + |
| 54 | +```sh |
| 55 | +localhost:8000 |
| 56 | +``` |
| 57 | + |
| 58 | +### API Documentation |
| 59 | + |
| 60 | +We support both Swagger and Scalar documentation: |
| 61 | + |
| 62 | +- Swagger: Available at `/docs` |
| 63 | +- Scalar: Available at `/api-doc` |
| 64 | + |
| 65 | +## AI Features |
| 66 | + |
| 67 | +### 1. EtherScan Agent |
| 68 | + |
| 69 | +Agent for handling Ethereum blockchain-related queries and tasks.: |
| 70 | + |
| 71 | +- Get the current Unix timestamp |
| 72 | +- Convert a natural language date string into a Unix timestamp |
| 73 | +- Retrieve the source code of a smart contract |
| 74 | +- Retrieve the ABI of a smart contract |
| 75 | +- Retrieve the ABI of a specific event from a smart contract |
| 76 | +- Fetch events for a given smart contract event within a block range |
| 77 | +- Retrieve the latest Ethereum block number |
| 78 | +- Convert a Unix timestamp to the nearest Ethereum block number |
| 79 | + |
| 80 | +### 2. Moralis Agent |
| 81 | + |
| 82 | +Agent for handling Ethereum blockchain-related queries and tasks.: |
| 83 | + |
| 84 | + - Get active chains for a wallet address across all chains |
| 85 | + - Get token balances for a specific wallet address and their prices in USD. (paginated) |
| 86 | + - Get the stats for a wallet address. |
| 87 | + - Retrieve the full transaction history of a specified wallet address, including sends, receives, token and NFT transfers and contract interactions. |
| 88 | + - Get the contents of a transaction by the given transaction hash. |
| 89 | + - Get ERC20 approvals for one or many wallet addresses and/or contract addresses, ordered by block number in descending order. |
| 90 | + |
| 91 | +### 3. GoldRush Agent |
| 92 | + |
| 93 | +Agent for handling Ethereum blockchain-related queries and tasks.: |
| 94 | + |
| 95 | +- Get activity across all chains for address |
| 96 | +- fetch the native, fungible (ERC20), and non-fungible (ERC721 & ERC1155) tokens held by an address |
| 97 | +- Fetch transactions for a given wallet address (paginated) |
| 98 | +- Fetch a summary of transactions (earliest and latest) for a given wallet address. |
| 99 | +- Fetch a single transaction including its decoded event logs |
| 100 | +- Fetch list of approvals across all token contracts categorized by spenders for a wallet’s assets |
| 101 | + |
| 102 | +### 2. Web Search Integration |
| 103 | + |
| 104 | +This feature enables searching the web using online and indexed search engines, including: |
| 105 | + |
| 106 | +- Answering questions that require web search using Tavily and Perplexity |
| 107 | +- Retrieving website content along with their links |
| 108 | +- Finding similar links |
0 commit comments