Gibwork
Guide to use gibwork 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 llm = new ChatOpenAI({ model: "gpt-4o" });
const toolKit = new LangchainToolkit({
appPrivateKey: "<app-wallet-private-key>",
userPrivateKey: "<user-wallet-private-key>",
});3
const tools = toolKit.getTools({ apps: [App.GIBWORK] });4
const prompt = ChatPromptTemplate.fromMessages([
["system", `You are an AI agent responsible for taking actions on Gibwork on users' behalf.
You need to take action on Gibwork using Gibwork APIs. Use correct tools to run APIs from the given tool-set.`],
["placeholder", "{chat_history}"],
["human", "{input}"],
["placeholder", "{agent_scratchpad}"],
]);
const agent = await createOpenAIFunctionsAgent({
llm,
tools,
prompt,
});
const agentExecutor = new AgentExecutor({ agent, tools, verbose: true });5
const response = await agentExecutor.invoke({ input: "Create a Gibwork task: Follow my Twitter account @thatsmeadarsh if you have 50+ followers. My total budget is 11 USDC. Submit a screenshot showing you’ve followed, along with your Twitter profile link, to qualify for the reward. The mint address for USDC is EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v" });
console.log(response);Supported Actions
Action
Description
Action.GIBWORK_EXPLOREAction.GIBWORK_TASKSAction.GIBWORK_CREATE_TASKLast updated