This is a WORK IN PROGRESS proof of concept of Retrieval Augmented Generation agent based on LanChain and deployed with LangServe. The objective of this repository is to show how the Pocket Network can be used to access web3 data and language models.
- [Morse] Create functional OpenAPI tools.
- [Morse] Add Pocket Network LLM backends.
- [Shannon] Add decentralized access (using Pocket Apps)
- Generate docker image running on root folder:
./build.sh
NOTE By default, the docker is attached into the "host" network
- A simple docker-compose is provided. It requires only to write a
.env
file with
OPENAI_API_KEY= <YOUR_OPENAI_API_KEY>
POCKET_NEWTWORK_ETH_URL=<VALID_ETH_ENDPOINT>
OPENAI_CHAT_MODEL=<OPEN_AI_CHAT_MODEL>
POCKET_NEWTWORK_ETH_OPEN_API_DOCS=<URL_OF_RAW_OPEN_API_SPEC>
An example of the last three parameters is:
POCKET_NEWTWORK_ETH_URL=https://eth-mainnet.rpc.pokt.dev/v1/
OPENAI_CHAT_MODEL=gpt-3.5-turbo
POCKET_NEWTWORK_ETH_OPEN_API_DOCS=https://raw.githubusercontent.com/pokt-foundation/grove-path/main/specs/eth/eth_getBalance.yaml
- Run on root folder
docker compose up
- Interact!
using Python as example:
import requests
address = "<ETH_ADDRESS>"
inputs = {"input": {"input": f"What is the balance of the ETH address {address}?"}}
response = requests.post("http://localhost:8080/pocket_agent/invoke", json=inputs)
response.json()
At the moment, only the method get_balance
for the Eth blockchains is available as an example.
Feel free to code more tools and add them to this repository via pull requests!
Each blockchain (probably) necessitates its own dedicated suite of Langchain Tools
to be developed. Furthermore, an efficient approach could involve crafting individual agents specialized for each blockchain, which could then be integrated into a more comprehensive agent as tools.