-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/adriangomez24/cdp-agentkit
- Loading branch information
Showing
22 changed files
with
145 additions
and
1,216 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
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
15 changes: 10 additions & 5 deletions
15
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,9 +1,14 @@ | ||
from cdp_agentkit_core.actions.social.twitter.post_tweet import ( | ||
POST_TWEET_PROMPT as POST_TWEET_PROMPT, | ||
from cdp_agentkit_core.actions.social.twitter.account_details import ( | ||
ACCOUNT_DETAILS_PROMPT as ACCOUNT_DETAILS_PROMPT, | ||
) | ||
from cdp_agentkit_core.actions.social.twitter.post_tweet import ( | ||
PostTweetInput as PostTweetInput, | ||
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 as post_tweet, | ||
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 |
36 changes: 36 additions & 0 deletions
36
cdp-agentkit-core/cdp_agentkit_core/actions/social/twitter/account_details.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,36 @@ | ||
import tweepy | ||
from pydantic import BaseModel, Field | ||
|
||
ACCOUNT_DETAILS_PROMPT = """ | ||
This tool will return account details for the currently authenticated Twitter (X) user context.""" | ||
|
||
class AccountDetailsInput(BaseModel): | ||
"""Input argument schema for Twitter account details action.""" | ||
|
||
no_input: str = Field( | ||
"", | ||
description="No input required, e.g. `` (empty string).", | ||
) | ||
|
||
def account_details(client: tweepy.Client) -> str: | ||
"""Get the authenticated Twitter (X) user account details. | ||
Returns: | ||
str: A message containing account details for the authenticated user context. | ||
""" | ||
message = "" | ||
|
||
try: | ||
response = client.get_me() | ||
user = response.data | ||
|
||
message = f"""Successfully retrieved authenticated user account details. Please present the following as json and not markdown: | ||
id: {user.id} | ||
name: {user.name} | ||
username: {user.username} | ||
link: https://x.com/{user.username}""" | ||
except tweepy.errors.TweepyException as e: | ||
message = f"Error retrieving authenticated user account details: {e}" | ||
|
||
return message |
Oops, something went wrong.