Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: better handling of OpenAPI tools #667

Merged
merged 5 commits into from
Jul 30, 2024

Conversation

g-linville
Copy link
Member

@g-linville g-linville commented Jul 27, 2024

This changes how we handle OpenAPI tools. Rather than generating an individual tool for each operation in the OpenAPI file, we always generate three tools: list, getSchema, and run. These basically act as an interface around the OpenAPI file. The LLM calls list to find out about all of the available operations. It then calls getSchema to get the JSONSchema for the args for a particular operation. It can then call that operation with the run tool by providing the name of the operation and the JSON string for the args.

Right now this is hidden behind the GPTSCRIPT_OPENAPI_REVAMP environment variable.

@g-linville g-linville marked this pull request as ready for review July 29, 2024 15:37
Signed-off-by: Grant Linville <[email protected]>
Signed-off-by: Grant Linville <[email protected]>
Copy link
Contributor

@iwilltry42 iwilltry42 left a comment

Choose a reason for hiding this comment

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

This PR is a monster O.o
Good Job!
Left some comments...

pkg/engine/openapi.go Outdated Show resolved Hide resolved
pkg/openapi/list.go Outdated Show resolved Hide resolved
pkg/loader/loader.go Show resolved Hide resolved
pkg/openapi/run.go Show resolved Hide resolved
Signed-off-by: Grant Linville <[email protected]>
Copy link
Contributor

@thedadams thedadams left a comment

Choose a reason for hiding this comment

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

Mostly just nits.

pkg/engine/openapi.go Outdated Show resolved Hide resolved
pkg/engine/openapi.go Show resolved Hide resolved
pkg/openapi/load.go Outdated Show resolved Hide resolved
pkg/openapi/run.go Outdated Show resolved Hide resolved
pkg/openapi/run.go Outdated Show resolved Hide resolved
pkg/openapi/run.go Outdated Show resolved Hide resolved
pkg/openapi/run.go Outdated Show resolved Hide resolved
pkg/openapi/getschema.go Outdated Show resolved Hide resolved
Signed-off-by: Grant Linville <[email protected]>
@g-linville g-linville merged commit 76042bd into gptscript-ai:main Jul 30, 2024
10 checks passed
@g-linville g-linville deleted the openapi-revamp branch July 30, 2024 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants