added write functionalities ie, swap and transfer

This commit is contained in:
Deepak
2024-12-27 16:53:12 +05:30
parent ab9259d4e2
commit 3cdd45d623
13 changed files with 572 additions and 17 deletions

View File

@@ -0,0 +1,23 @@
import { prompt, parser } from "../prompts/manager";
import { RunnableSequence } from "@langchain/core/runnables";
import { solanaAgentState } from "../utils/state";
import { gpt4o } from "../utils/model";
const chain = RunnableSequence.from([prompt, gpt4o, parser]);
export const managerNode = async (state: typeof solanaAgentState.State) => {
const { messages } = state;
const result = await chain.invoke({
formatInstructions: parser.getFormatInstructions(),
messages: messages,
});
const { isSolanaReadQuery, isSolanaWriteQuery, isGeneralQuery } = result;
return {
isSolanaReadQuery,
isSolanaWriteQuery,
isGeneralQuery,
};
};