Skip to content
This repository has been archived by the owner on Jun 9, 2024. It is now read-only.

Fix parameter type in post_prompt function #240

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/autogpt_plugins/api_tools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ def post_prompt(self, prompt: PromptGenerator) -> PromptGenerator:
prompt.add_command( # type: ignore
"api",
"API Call",
{"host": "<str>", "endpoint": "<str>", "mthd": "<str>", "params": "<dict>", "body": "<str>", "hdrs": "<dict>", "timeout": "<int>"},
{"host": "string", "endpoint": "string", "mthd":"string", "params": "object", "body": "str", "hdrs": "object", "timeout": "integer"},

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: The dictionary values for the API call parameters should be actual types or default values, not the string representation of the type names. This ensures that the data types are correctly enforced and used within the function. [bug]

Suggested change
{"host": "string", "endpoint": "string", "mthd":"string", "params": "object", "body": "str", "hdrs": "object", "timeout": "integer"},
{
"host": "", "endpoint": "", "mthd": "", "params": {}, "body": "", "hdrs": {}, "timeout": 0
}

self.plugin_class.make_api_call
)
return prompt
Expand Down
2 changes: 1 addition & 1 deletion src/autogpt_plugins/baidu_search/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def post_prompt(self, prompt: PromptGenerator) -> PromptGenerator:
prompt.add_command(
"Baidu Search",
"baidu_search",
{"query": "<query>"},
{"query": "string"},
_baidu_search,
)
else:
Expand Down
2 changes: 1 addition & 1 deletion src/autogpt_plugins/bing_search/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def post_prompt(self, prompt: PromptGenerator) -> PromptGenerator:
prompt.add_command(
"Bing Search",
"bing_search",
{"query": "<query>"},
{"query": "string"},
_bing_search,
)
else:
Expand Down
6 changes: 3 additions & 3 deletions src/autogpt_plugins/bluesky/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ def post_prompt(self, prompt: PromptGenerator) -> PromptGenerator:

prompt.add_command(
"post_to_bluesky", "Post to Bluesky", {
"text": "<text>"}, post_message
"text": "string"}, post_message
)
prompt.add_command(
"get_bluesky_posts", "Get Blueskey Posts", {
"username": "<username>",
"number_of_posts": "<number_of_posts>"}, get_latest_posts)
"username": "string",
"number_of_posts": "integer"}, get_latest_posts)
Comment on lines +48 to +49

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: The 'number_of_posts' parameter in the 'get_bluesky_posts' command should be an integer to correctly represent the number of posts. [bug]

Suggested change
"username": "string",
"number_of_posts": "integer"}, get_latest_posts)
{
"username": "",
"number_of_posts": 10
}


return prompt

Expand Down
18 changes: 9 additions & 9 deletions src/autogpt_plugins/email/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,27 +36,27 @@ def post_prompt(self, prompt: PromptGenerator) -> PromptGenerator:
"Read Emails",
"read_emails",
{
"imap_folder": "<imap_folder>",
"imap_search_command": "<imap_search_criteria_command>",
"limit": "<email_count_return_limit>",
"page": "<number_of_email_results_page>",
"imap_folder": "string",
"imap_search_command": "string",
"limit": "string",
"page": "string",
Comment on lines +39 to +42

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: The 'limit' and 'page' parameters in the 'read_emails' command should be integers to correctly represent limits and pagination, not strings. [bug]

Suggested change
"imap_folder": "string",
"imap_search_command": "string",
"limit": "string",
"page": "string",
{
"imap_folder": "",
"imap_search_command": "",
"limit": 0,
"page": 0
}

},
read_emails,
)
prompt.add_command(
"Send Email",
"send_email",
{"to": "<to>", "subject": "<subject>", "body": "<body>"},
{"to": "string", "subject": "string", "body": "string"},
send_email,
)
prompt.add_command(
"Send Email",
"send_email_with_attachment",
{
"to": "<to>",
"subject": "<subject>",
"body": "<body>",
"filename": "<attachment filename>",
"to": "subject",
"subject": "string",
"body": "string",
"filename": "string",
},
send_email_with_attachment,
)
Expand Down
2 changes: 1 addition & 1 deletion src/autogpt_plugins/news_search/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def post_prompt(self, prompt: PromptGenerator) -> PromptGenerator:
prompt.add_command(
"News Search",
"news_search",
{"query": "<query>"},
{"query": "string"},
self.news_search.news_everything_search,
)
else:
Expand Down
2 changes: 1 addition & 1 deletion src/autogpt_plugins/planner/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def post_prompt(self, prompt: PromptGenerator) -> PromptGenerator:
prompt.add_command(
"mark_task_completed",
"Updates the status of a task and marks it as completed",
{"task_id": "<int>"},
{"task_id": "integer"},
update_task_status,
)

Expand Down
10 changes: 5 additions & 5 deletions src/autogpt_plugins/random_values/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,31 +208,31 @@ def post_prompt(self, prompt: PromptGenerator) -> PromptGenerator:
prompt.add_command( # type: ignore
"rnd_num",
"Random Numbers",
{"min": "<int>", "max": "<int>", "cnt": "<int>"},
{"min": "integer", "max": "integer", "cnt": "integer"},
self.plugin_class.random_number,
)
prompt.add_command( # type: ignore
"uuids",
"Make UUIDs",
{"cnt": "<int>"},
{"cnt": "integer"},
self.plugin_class.make_uuids
)
prompt.add_command( # type: ignore
"make_str",
"Generate Strings",
{"len": "<int>", "cnt": "<int>"},
{"len": "integer", "cnt": "integer"},
self.plugin_class.generate_string,
)
prompt.add_command( # type: ignore
"pwds",
"Create Passwords",
{"len": "<int>", "cnt": "<int>"},
{"len": "integer", "cnt": "integer"},
Comment on lines +211 to +229

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: For the 'generate_string', 'generate_password', and 'random_number' commands, ensure that the 'min', 'max', 'len', and 'cnt' parameters are integers for proper functionality. [bug]

Suggested change
{"min": "integer", "max": "integer", "cnt": "integer"},
self.plugin_class.random_number,
)
prompt.add_command( # type: ignore
"uuids",
"Make UUIDs",
{"cnt": "<int>"},
{"cnt": "integer"},
self.plugin_class.make_uuids
)
prompt.add_command( # type: ignore
"make_str",
"Generate Strings",
{"len": "<int>", "cnt": "<int>"},
{"len": "integer", "cnt": "integer"},
self.plugin_class.generate_string,
)
prompt.add_command( # type: ignore
"pwds",
"Create Passwords",
{"len": "<int>", "cnt": "<int>"},
{"len": "integer", "cnt": "integer"},
{
"min": 0, "max": 100, "cnt": 1
}
{
"len": 10, "cnt": 1
}
{
"len": 10, "cnt": 1
}

self.plugin_class.generate_password,
)
prompt.add_command( # type: ignore
"lorem_ipsum",
"Create Lorem Sentences",
{"cnt": "<int>"},
{"cnt": "integer"},
self.plugin_class.generate_placeholder_text,
)
return prompt
Expand Down
2 changes: 1 addition & 1 deletion src/autogpt_plugins/scenex/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def post_prompt(self, prompt: PromptGenerator) -> PromptGenerator:
self._description,
"describe_image",
{
"image": "<image>",
"image": "string",
},
self.scenexplain.describe_image,
)
Expand Down
2 changes: 1 addition & 1 deletion src/autogpt_plugins/serpapi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def post_prompt(self, prompt: PromptGenerator) -> PromptGenerator:
prompt.add_command(
"SerpApi Search",
"serpapi_search",
{"query": "<query>"},
{"query": "string"},
serpapi_search,
)
else:
Expand Down
8 changes: 4 additions & 4 deletions src/autogpt_plugins/twitter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,21 +243,21 @@ def post_prompt(self, prompt: PromptGenerator) -> PromptGenerator:
)

prompt.add_command(
"post_tweet", "Post Tweet", {"tweet_text": "<tweet_text>"}, post_tweet
"post_tweet", "Post Tweet", {"tweet_text": "string"}, post_tweet
)
prompt.add_command(
"post_reply",
"Post Twitter Reply",
{"tweet_text": "<tweet_text>", "tweet_id": "<tweet_id>"},
{"tweet_text": "string", "tweet_id": "integer"},
post_reply,
)
prompt.add_command("get_mentions", "Get Twitter Mentions", {}, get_mentions)
prompt.add_command(
"search_twitter_user",
"Search Twitter",
{
"target_user": "<target_user>",
"number_of_tweets": "<number_of_tweets",
"target_user": "string",
"number_of_tweets": "integer",
},
search_twitter_user,
)
Expand Down
2 changes: 1 addition & 1 deletion src/autogpt_plugins/wikipedia_search/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def post_prompt(self, prompt: PromptGenerator) -> PromptGenerator:
prompt.add_command(
"wikipedia_search",
"Wikipedia search",
{"query": "<query>"},
{"query": "string"},
_wikipedia_search,
)
return prompt
Expand Down
2 changes: 1 addition & 1 deletion src/autogpt_plugins/wolframalpha_search/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ def post_prompt(self, prompt: PromptGenerator) -> PromptGenerator:
prompt.add_command(
"wolframalpha_search",
self._description,
{"query": "<query>"},
{"query": "string"},
_wolframalpha_search,
)
return prompt
Expand Down