-
Notifications
You must be signed in to change notification settings - Fork 287
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: twitter langchain refinements (#43)
* first pass refinemetns to match the rest * formatting * forgot to commit twitter action * rmoving unnecessairy tweep import validation * formatting and import validation * changelog --------- Co-authored-by: John Peterson <[email protected]>
- Loading branch information
1 parent
0fbaa69
commit d8a0020
Showing
11 changed files
with
109 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 21 additions & 14 deletions
35
cdp-agentkit-core/cdp_agentkit_core/actions/social/twitter/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,21 @@ | ||
from cdp_agentkit_core.actions.social.twitter.account_details import ( | ||
ACCOUNT_DETAILS_PROMPT as ACCOUNT_DETAILS_PROMPT, | ||
) | ||
from cdp_agentkit_core.actions.social.twitter.account_details import ( | ||
AccountDetailsInput as AccountDetailsInput, | ||
) | ||
from cdp_agentkit_core.actions.social.twitter.account_details import ( | ||
account_details as account_details, | ||
) | ||
from cdp_agentkit_core.actions.social.twitter.post_tweet import ( | ||
POST_TWEET_PROMPT as POST_TWEET_PROMPT, | ||
) | ||
from cdp_agentkit_core.actions.social.twitter.post_tweet import PostTweetInput as PostTweetInput | ||
from cdp_agentkit_core.actions.social.twitter.post_tweet import post_tweet as post_tweet | ||
from cdp_agentkit_core.actions.social.twitter.account_details import AccountDetailsAction | ||
from cdp_agentkit_core.actions.social.twitter.action import TwitterAction | ||
from cdp_agentkit_core.actions.social.twitter.post_tweet import PostTweetAction | ||
|
||
|
||
def get_all_twitter_actions() -> list[type[TwitterAction]]: | ||
actions = [] | ||
for action in TwitterAction.__subclasses__(): | ||
actions.append(action()) | ||
|
||
return actions | ||
|
||
|
||
TWITTER_ACTIONS = get_all_twitter_actions() | ||
|
||
__all__ = [ | ||
"TwitterAction", | ||
"AccountDetailsAction", | ||
"PostTweetAction", | ||
"TWITTER_ACTIONS", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
cdp-agentkit-core/cdp_agentkit_core/actions/social/twitter/action.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from collections.abc import Callable | ||
|
||
from pydantic import BaseModel | ||
|
||
|
||
class TwitterAction(BaseModel): | ||
"""Twitter Action Base Class.""" | ||
|
||
name: str | ||
description: str | ||
args_schema: type[BaseModel] | None = None | ||
func: Callable[..., str] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
"""CDP Twitter Toolkit.""" | ||
|
||
from twitter_langchain.twitter_action import TwitterAction | ||
from twitter_langchain.twitter_api_wrapper import TwitterApiWrapper | ||
from twitter_langchain.twitter_tool import TwitterTool | ||
from twitter_langchain.twitter_toolkit import TwitterToolkit | ||
|
||
__all__ = [ | ||
"TwitterAction", | ||
"TwitterApiWrapper", | ||
"TwitterTool", | ||
"TwitterToolkit", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters