AutoGPT
AutoGPT copied to clipboard
OpenAI Plugins/OpenAPI(Swagger) REST APIs commands generator
Background
OpenAI declared their interface for plugins, which effectively could be commands for Auto-GPT OpenAI plugins spec https://platform.openai.com/docs/plugins/introduction .
Effectively it's OpenAPI(Swagger) specification, with OpenAI Plugin metadata on top of it For example here is weather plugin https://weathergpt.vercel.app/ https://weathergpt.vercel.app/.well-known/ai-plugin.json https://github.com/steven-tey/weathergpt
I started to work on this as a testing framework for OpenAI plugins, while access to plugins Feature there is still behind the whitelist.
Changes
As this work was started previously in https://github.com/BillSchumacher/Auto-GPT/pull/4 and was merged in master half-baked, this is a continuation of it and finalization so it actually works. Compared to the previous PR OpenAPI/AI support was moved from plugins.py into commands openapi.py instead as Commands are looking better suited for REST Endpoint - Method type of calls and ingestions.
Documentation

To achieve client generation for any REST API which supports OpenAPI spec openapi command was added, where we generate REST API client using openapi-python-client, instantiating it and injecting in commands, based on config provided to users.
Any APIs added to openapi_commands.yaml and whitelisted in OPENAPI_APIS envs would be fetched for OpenAPI spec of OpenAI manifest and all methods found would be added to Auto-GPT commands.
For any REST API added to the config, we have:
- OpenAPI(Swagger) spec parsed and each endpoint-method ingested as separate commands
- OpenAI manifest is generated and saved in ./plugins/openapi/{api_name}/ai-plugin.json making it OpenAI plugins generator
- Custom python client package is generated and placed ./plugins/openapi/{api_name}/client
- Making changes in manifest/openapi spec/client anyone can effectively develop new API plugins, or adjust them.
Test Plan
All added methods are covered with unit tests. Manually tested.
Future plans
- Add Authorization support
- Add ability to generate plugins in Auto-GPT runtime when it's hitting rest API's supporting OpenAPI schema.
PR Quality Checklist
- [X] My pull request is atomic and focuses on a single change.
- [X] I have thoroughly tested my changes with multiple different prompts.
- [X] I have considered potential risks and mitigations for my changes.
- [X] I have documented my changes clearly and comprehensively.
- [X] I have not snuck in any "extra" small tweaks changes
@BillSchumacher I've refactored previously merged https://github.com/BillSchumacher/Auto-GPT/pull/4 and moved this functionality to commands injection as it looked like it fits better there. Can you please review it? Thanks.
I see throughout the PR openai
and openapi
are used interchangeably. Easy to do, but they are very different.
I see throughout the PR
openai
andopenapi
are used interchangeably. Easy to do, but they are very different.
There are methods that are specific for support of OpenAI Plugins Interface https://platform.openai.com/docs/plugins/introduction that's why they named differently. Actually, I see one place where it could be changed based on what's happening inside, going to fix it, thanks.
LGTM!
This pull request has conflicts with the base branch, please resolve those so we can evaluate the pull request.
How does this work with passing data to the prompt? Some conversations need to be had about how we load plugins in general.
How does this work with passing data to the prompt? Some conversations need to be had about how we load plugins in general.
It's returned as Json, same way search or any other command does, here's an example:

Conflicts have been resolved! 🎉 A maintainer will review the pull request shortly.
This pull request has conflicts with the base branch, please resolve those so we can evaluate the pull request.
Conflicts have been resolved! 🎉 A maintainer will review the pull request shortly.
Test loading normal and open ai plugins side by side
Codecov Report
Patch coverage: 77.24
% and project coverage change: -7.48
:warning:
Comparison is base (
2b5852f
) 45.09% compared to head (433547b
) 37.62%.
Additional details and impacted files
@@ Coverage Diff @@
## master #2642 +/- ##
==========================================
- Coverage 45.09% 37.62% -7.48%
==========================================
Files 60 60
Lines 2856 2860 +4
Branches 472 478 +6
==========================================
- Hits 1288 1076 -212
- Misses 1463 1727 +264
+ Partials 105 57 -48
Impacted Files | Coverage Δ | |
---|---|---|
autogpt/cli.py | 0.00% <0.00%> (ø) |
|
autogpt/plugins.py | 89.58% <ø> (+15.70%) |
:arrow_up: |
autogpt/commands/openapi.py | 78.57% <78.57%> (ø) |
|
autogpt/config/config.py | 74.14% <100.00%> (-1.20%) |
:arrow_down: |
... and 15 files with indirect coverage changes
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.
Run black and issort to fix linter
Add tests to not reduce coverage of project
This pull request has conflicts with the base branch, please resolve those so we can evaluate the pull request.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Ignored Deployment
Name | Status | Preview | Comments | Updated (UTC) |
---|---|---|---|---|
docs | ⬜️ Ignored (Inspect) | Visit Preview | May 4, 2023 5:20am |
This PR exceeds the recommended size of 200 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size
Conflicts have been resolved! 🎉 A maintainer will review the pull request shortly.
This PR exceeds the recommended size of 200 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size
This pull request has conflicts with the base branch, please resolve those so we can evaluate the pull request.
Conflicts have been resolved! 🎉 A maintainer will review the pull request shortly.
This PR exceeds the recommended size of 200 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size
This PR exceeds the recommended size of 200 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size
Codecov Report
Patch coverage: 77.24
% and project coverage change: -0.05
:warning:
Comparison is base (
cb97f5c
) 60.96% compared to head (cecc26b
) 60.91%.
Additional details and impacted files
@@ Coverage Diff @@
## master #2642 +/- ##
==========================================
- Coverage 60.96% 60.91% -0.05%
==========================================
Files 72 72
Lines 3302 3306 +4
Branches 542 548 +6
==========================================
+ Hits 2013 2014 +1
- Misses 1151 1159 +8
+ Partials 138 133 -5
Impacted Files | Coverage Δ | |
---|---|---|
autogpt/main.py | 0.00% <0.00%> (ø) |
|
autogpt/plugins.py | 92.30% <ø> (+16.94%) |
:arrow_up: |
autogpt/commands/openapi.py | 78.57% <78.57%> (ø) |
|
autogpt/config/config.py | 75.00% <100.00%> (+0.14%) |
:arrow_up: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.
This is a mass message from the AutoGPT core team. Our apologies for the ongoing delay in processing PRs. This is because we are re-architecting the AutoGPT core!
For more details (and for infor on joining our Discord), please refer to: https://github.com/Significant-Gravitas/Auto-GPT/wiki/Architecting
References issue #3652
This pull request has conflicts with the base branch, please resolve those so we can evaluate the pull request.
@evahteev are you still interested in this? I know its been a good bit
Closed as it was merged