mirror of
https://github.com/d0zingcat/solana-agent-kit.git
synced 2026-05-13 23:16:55 +00:00
init
This commit is contained in:
0
examples/agent-kit-langgraph/README.json
Normal file
0
examples/agent-kit-langgraph/README.json
Normal file
6
examples/agent-kit-langgraph/index.ts
Normal file
6
examples/agent-kit-langgraph/index.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import { StateGraph } from "@langchain/langgraph";
|
||||
import { solanaAgentState } from "./utils/state";
|
||||
|
||||
const workflow = new StateGraph(solanaAgentState);
|
||||
|
||||
export const graph = workflow.compile();
|
||||
7
examples/agent-kit-langgraph/langgraph.json
Normal file
7
examples/agent-kit-langgraph/langgraph.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"graphs": {
|
||||
"solana-agent": "./index.ts:graph"
|
||||
},
|
||||
"env": ".env",
|
||||
"node_version": "20"
|
||||
}
|
||||
12
examples/agent-kit-langgraph/utils/model.ts
Normal file
12
examples/agent-kit-langgraph/utils/model.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { ChatOpenAI } from "@langchain/openai";
|
||||
import "dotenv/config";
|
||||
|
||||
export const gpt4o = new ChatOpenAI({
|
||||
modelName: "gpt-4o",
|
||||
apiKey: process.env.OPENAI_API_KEY!,
|
||||
});
|
||||
|
||||
export const gpt4oMini = new ChatOpenAI({
|
||||
modelName: "gpt-4o-mini",
|
||||
apiKey: process.env.OPENAI_API_KEY!,
|
||||
});
|
||||
0
examples/agent-kit-langgraph/utils/route.ts
Normal file
0
examples/agent-kit-langgraph/utils/route.ts
Normal file
7
examples/agent-kit-langgraph/utils/solanaAgent.ts
Normal file
7
examples/agent-kit-langgraph/utils/solanaAgent.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { SolanaAgentKit } from "../../../src/agent";
|
||||
|
||||
export const agentKit = new SolanaAgentKit(
|
||||
process.env.SOLANA_PRIVATE_KEY!,
|
||||
process.env.RPC_URL!,
|
||||
process.env.OPENAI_API_KEY!,
|
||||
);
|
||||
25
examples/agent-kit-langgraph/utils/state.ts
Normal file
25
examples/agent-kit-langgraph/utils/state.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { Annotation } from "@langchain/langgraph";
|
||||
import { BaseMessage } from "@langchain/core/messages";
|
||||
import { messagesStateReducer } from "@langchain/langgraph";
|
||||
|
||||
export const solanaAgentState = Annotation.Root({
|
||||
messages: Annotation<BaseMessage[]>({
|
||||
reducer: messagesStateReducer,
|
||||
default: () => [],
|
||||
}),
|
||||
|
||||
isSolanaReadQuery: Annotation<boolean>({
|
||||
reducer: (x, y) => y ?? x ?? false,
|
||||
default: () => false,
|
||||
}),
|
||||
|
||||
isSolanaWriteQuery: Annotation<boolean>({
|
||||
reducer: (x, y) => y ?? x ?? false,
|
||||
default: () => false,
|
||||
}),
|
||||
|
||||
isGeneralQuery: Annotation<boolean>({
|
||||
reducer: (x, y) => y ?? x ?? false,
|
||||
default: () => false,
|
||||
}),
|
||||
});
|
||||
14
package.json
14
package.json
@@ -23,9 +23,9 @@
|
||||
"dependencies": {
|
||||
"@bonfida/spl-name-service": "^3.0.7",
|
||||
"@coral-xyz/anchor": "0.29",
|
||||
"@langchain/core": "^0.3.18",
|
||||
"@langchain/core": "^0.3.26",
|
||||
"@langchain/groq": "^0.1.2",
|
||||
"@langchain/langgraph": "^0.2.27",
|
||||
"@langchain/langgraph": "^0.2.34",
|
||||
"@langchain/openai": "^0.3.13",
|
||||
"@lightprotocol/compressed-token": "^0.17.1",
|
||||
"@lightprotocol/stateless.js": "^0.17.1",
|
||||
@@ -56,13 +56,13 @@
|
||||
"@types/bn.js": "^5.1.5",
|
||||
"@types/chai": "^5.0.1",
|
||||
"@types/node": "^22.9.0",
|
||||
"ts-node": "^10.9.2",
|
||||
"typescript": "^5.7.2",
|
||||
"@typescript-eslint/eslint-plugin": "^7.0.0",
|
||||
"@typescript-eslint/parser": "^7.0.0",
|
||||
"eslint": "^8.56.0",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-plugin-prettier": "^5.1.3",
|
||||
"@typescript-eslint/eslint-plugin": "^7.0.0",
|
||||
"@typescript-eslint/parser": "^7.0.0",
|
||||
"prettier": "^3.2.5"
|
||||
"prettier": "^3.2.5",
|
||||
"ts-node": "^10.9.2",
|
||||
"typescript": "^5.7.2"
|
||||
}
|
||||
}
|
||||
|
||||
4
pnpm-lock.yaml
generated
4
pnpm-lock.yaml
generated
@@ -15,13 +15,13 @@ importers:
|
||||
specifier: '0.29'
|
||||
version: 0.29.0(bufferutil@4.0.8)(utf-8-validate@5.0.10)
|
||||
'@langchain/core':
|
||||
specifier: ^0.3.18
|
||||
specifier: ^0.3.26
|
||||
version: 0.3.26(openai@4.77.0(zod@3.24.1))
|
||||
'@langchain/groq':
|
||||
specifier: ^0.1.2
|
||||
version: 0.1.2(@langchain/core@0.3.26(openai@4.77.0(zod@3.24.1)))
|
||||
'@langchain/langgraph':
|
||||
specifier: ^0.2.27
|
||||
specifier: ^0.2.34
|
||||
version: 0.2.34(@langchain/core@0.3.26(openai@4.77.0(zod@3.24.1)))
|
||||
'@langchain/openai':
|
||||
specifier: ^0.3.13
|
||||
|
||||
Reference in New Issue
Block a user