mirror of
https://github.com/d0zingcat/solana-agent-kit.git
synced 2026-05-29 15:11:14 +00:00
added pnpm
This commit is contained in:
12
examples/agent-kit-langgraph/src/utils/model.ts
Normal file
12
examples/agent-kit-langgraph/src/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/src/utils/route.ts
Normal file
0
examples/agent-kit-langgraph/src/utils/route.ts
Normal file
7
examples/agent-kit-langgraph/src/utils/solanaAgent.ts
Normal file
7
examples/agent-kit-langgraph/src/utils/solanaAgent.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { SolanaAgentKit } from "solana-agent-kit";
|
||||
|
||||
export const agentKit = new SolanaAgentKit(
|
||||
process.env.SOLANA_PRIVATE_KEY!,
|
||||
process.env.RPC_URL!,
|
||||
process.env.OPENAI_API_KEY!,
|
||||
);
|
||||
25
examples/agent-kit-langgraph/src/utils/state.ts
Normal file
25
examples/agent-kit-langgraph/src/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,
|
||||
}),
|
||||
});
|
||||
Reference in New Issue
Block a user