From 46fa8d60819701027d167f726e9bdcff6e25cc34 Mon Sep 17 00:00:00 2001 From: Christopher Gerber Date: Thu, 5 Dec 2024 16:22:08 -0800 Subject: [PATCH] chatbot functional --- .../examples/chatbot/package.json | 2 +- twitter-langchain/src/twitter_agentkit.ts | 21 ++++++++++--------- twitter-langchain/src/twitter_toolkit.ts | 1 - 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/twitter-langchain/examples/chatbot/package.json b/twitter-langchain/examples/chatbot/package.json index a207a89..51747ef 100644 --- a/twitter-langchain/examples/chatbot/package.json +++ b/twitter-langchain/examples/chatbot/package.json @@ -12,9 +12,9 @@ }, "dependencies": { "@coinbase/twitter-langchain": "^0.0.1", + "@langchain/core": "0.3.21", "@langchain/langgraph": "^0.2.22", "@langchain/openai": "^0.3.14", - "@langchain/core": "0.3.21", "dotenv": "^16.4.5", "zod": "^3.22.4" }, diff --git a/twitter-langchain/src/twitter_agentkit.ts b/twitter-langchain/src/twitter_agentkit.ts index caf2394..8ea946a 100644 --- a/twitter-langchain/src/twitter_agentkit.ts +++ b/twitter-langchain/src/twitter_agentkit.ts @@ -37,22 +37,23 @@ export class TwitterAgentkit { options.accessTokenSecret ||= process.env.TWITTER_ACCESS_TOKEN_SECRET; options.bearerToken ||= process.env.TWITTER_BEARER_TOKEN; + console.log("options:", options); if (!this.validateOptions(options)) { throw new Error( "Twitter (X) Agentkit options require either bearer token, or all other credentials.", ); } - if (options.bearerToken) { - this.client = new TwitterApi(options.bearerToken); - } else { - this.client = new TwitterApi({ - appKey: options.apiKey, - appSecret: options.apiSecret, - accessToken: options.accessToken, - accessSecret: options.accessTokenSecret, - } as TwitterApiTokens); - } + // if (options.bearerToken) { + // this.client = new TwitterApi(options.bearerToken); + // } else { + this.client = new TwitterApi({ + appKey: options.apiKey, + appSecret: options.apiSecret, + accessToken: options.accessToken, + accessSecret: options.accessTokenSecret, + } as TwitterApiTokens); + // } } /** diff --git a/twitter-langchain/src/twitter_toolkit.ts b/twitter-langchain/src/twitter_toolkit.ts index d740c3a..aba157f 100644 --- a/twitter-langchain/src/twitter_toolkit.ts +++ b/twitter-langchain/src/twitter_toolkit.ts @@ -50,6 +50,5 @@ export class TwitterToolkit extends Toolkit { const actions = TWITTER_ACTIONS; const tools = actions.map(action => new TwitterTool(action, agentkit)); this.tools = tools; - this.tools = []; } }