Stampchain
Guide to use stampchain tool on your AI agent using Vity Toolkit
Quick Start
1
npm install vity-toolkit langchain @langchain/openai2
import { ChatOpenAI } from "@langchain/openai";
import { App, LangchainToolkit } from "vity-toolkit";
import { createOpenAIFunctionsAgent, AgentExecutor } from "langchain/agents";
import { ChatPromptTemplate } from "@langchain/core/prompts";
const model = new ChatOpenAI({ model: "gpt-4o" });
const toolKit = new LangchainToolkit();3
const tools = toolKit.getTools({ apps: [App.STAMPCHAIN] });4
const prompt = ChatPromptTemplate.fromMessages([
["system", `You are an AI agent that explores Bitcoin Stamps and SRC-20 data using Stampchain APIs. Use the provided tools for all data access.`],
["placeholder", "{chat_history}"],
["human", "{input}"],
["placeholder", "{agent_scratchpad}"],
]);
const agent = await createOpenAIFunctionsAgent({
llm: model,
tools,
prompt,
});
const agentExecutor = new AgentExecutor({ agent, tools, verbose: true });5
const response = await agentExecutor.invoke({ input: "Find recent stamp sales and list the 5 most interesting ones with IDs and prices" });
console.log(response);Supported Actions
Action
Description
Action.STAMPCHAIN_GET_STAMPAction.STAMPCHAIN_SEARCH_STAMPSAction.STAMPCHAIN_GET_RECENT_STAMPSAction.STAMPCHAIN_GET_RECENT_SALESAction.STAMPCHAIN_GET_MARKET_DATAAction.STAMPCHAIN_GET_STAMP_MARKET_DATALast updated