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

Adding ChatGPT plugin tool #405

Merged
merged 2 commits into from
Jul 25, 2023
Merged

Conversation

ajhofmann
Copy link
Contributor

A tool that allows you to easily load a ChatGPT Plugin from a manifest file, leveraging the OpenAPI tool spec and Requests tool specs.

plugins from a manifest file
"""

spec_functions = ['describe_plugin']
Copy link
Collaborator

Choose a reason for hiding this comment

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

hmm i think the tool spec interface is a bit confusing now that we're overriding to_tool_list. a bit hard to tell now which tools are actually getting returned to the agent, and the spec_functions don't quite match anymore

Copy link
Collaborator

Choose a reason for hiding this comment

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

do you have thoughts on how to simplify this?

Copy link
Collaborator

Choose a reason for hiding this comment

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

also, unrelated maybe to this PR but out of curiosity why does the openapi tool take in a pre-existing dict instead of loading the openapi spec as part of the function

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah I see what you mean, I think if we wanted to make the interface more intuitive from the code we could:

  • Require the user to import and pass the Requests tool spec, similar to what OpenAPI tool spec requires right now.
  • have ChatGPT plugin export its own load_openapi_spec that calls the internally wrapped OpenAPIToolSpec, and add it to spec functions

With that we wouldn't need to override to_tool_list and make it potentially a bit easier for users to customize request headers. I think this seems a bit more straight forward, I'll put together some code.

Copy link
Contributor Author

@ajhofmann ajhofmann Jul 20, 2023

Choose a reason for hiding this comment

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

For the openapi tool taking a dict, my thinking was it allows users to load a spec from url or local file, but we could also update the interface to accept a file path or url and load the spec from there. I can't really imagine users wanting to load an OpenAPI spec in a different way.

Copy link
Collaborator

Choose a reason for hiding this comment

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

yeah that's more intuitive, it unbundles loading the spec from actually calling the spec (with the requests tool). We can just treat the chatgpt plugin as a special case of the openapi spec

@ajhofmann
Copy link
Contributor Author

@jerryjliu Fixed up the openapi spec to accept a url or a spec, and same with the ChatGPT plugin. Also simplified the interface as we discussed.

@@ -41,6 +45,10 @@
"id": "tools/slack",
"author": "jerryjliu"
},
"TextToImageToolSpec": {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Tag along fix because I missed adding this in the initial text to image PR

@jerryjliu jerryjliu merged commit c4b4c56 into run-llama:main Jul 25, 2023
2 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants