Skip to content

Commit

Permalink
Only take subclasses of AutoGPTPluginTemplate as plugins
Browse files Browse the repository at this point in the history
Co-authored-by: Nicholas Tindle <[email protected]>
Co-authored-by: Luke <[email protected]>
  • Loading branch information
3 people authored Jun 26, 2023
1 parent 321edc5 commit 9e99db1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ __pycache__/
build/
develop-eggs/
dist/
plugins/
/plugins/
plugins_config.yaml
downloads/
eggs/
Expand Down
9 changes: 7 additions & 2 deletions autogpt/plugins/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,9 +259,10 @@ def scan_plugins(config: Config, debug: bool = False) -> List[AutoGPTPluginTempl
if key.startswith("__"):
continue
a_module = getattr(zipped_module, key)
a_keys = dir(a_module)

if (
"_abc_impl" in a_keys
inspect.isclass(a_module)
and issubclass(a_module, AutoGPTPluginTemplate)
and a_module.__name__ != "AutoGPTPluginTemplate"
):
plugin_name = a_module.__name__
Expand All @@ -284,6 +285,10 @@ def scan_plugins(config: Config, debug: bool = False) -> List[AutoGPTPluginTempl
f"they are enabled in plugins_config.yaml. Zipped plugins should use the class "
f"name ({plugin_name}) as the key."
)
else:
logger.debug(
f"Skipping {key}: {a_module.__name__} because it doesn't subclass AutoGPTPluginTemplate."
)

# OpenAI plugins
if config.plugins_openai:
Expand Down

0 comments on commit 9e99db1

Please sign in to comment.