Skip to content

Commit

Permalink
chatbot functional
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher Gerber authored and stat committed Dec 6, 2024
1 parent d92d97b commit 4d53a1a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion twitter-langchain/examples/chatbot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
21 changes: 11 additions & 10 deletions twitter-langchain/src/twitter_agentkit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
// }
}

/**
Expand Down
1 change: 0 additions & 1 deletion twitter-langchain/src/twitter_toolkit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];
}
}

0 comments on commit 4d53a1a

Please sign in to comment.