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: add LLM suggestions to CLI #94

Merged
merged 10 commits into from
May 27, 2023

Conversation

ryan-timothy-albert
Copy link
Contributor

@ryan-timothy-albert ryan-timothy-albert commented May 14, 2023

A sample CLI that communicates with downstream speakeasy API and LLM server.

Normal Testing (CLI)

  1. Make sure you have OPENAI_API_KEY set.
  2. go run main.go validate openapi --schema openapi-invalid.yaml --fix

Testing with Local API
Local Testing

cd speakeasy-registry (API)
1 Run local registry API
2. Make docker-llm (wait until Chroma is up to continue, you should see Uvicorn running on http://0.0.0.0:8000)
3. export SPEAKEASY_SERVER_URL=http://localhost:35290

Copy link
Member

@chase-crumbaugh chase-crumbaugh left a comment

Choose a reason for hiding this comment

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

Overall looking good! A couple comments:

  • You mentioned moving over to use promptui--I would definitely recommend it! It's super easy to use and works great.
  • I think it would good if this was also accessible through a higher-level CLI command, e.g. speakeasy suggest -s openapi.yaml. It will read better in an article IMO and be more discoverable in the CLI instead of buried as an optional flag. Can leave it accessible via --fix as well though

@ryan-timothy-albert
Copy link
Contributor Author

ryan-timothy-albert commented May 16, 2023

Overall looking good! A couple comments:

  • You mentioned moving over to use promptui--I would definitely recommend it! It's super easy to use and works great.
  • I think it would good if this was also accessible through a higher-level CLI command, e.g. speakeasy suggest -s openapi.yaml. It will read better in an article IMO and be more discoverable in the CLI instead of buried as an optional flag. Can leave it accessible via --fix as well though

I think a higher-level CLI command is reasonable. In your mind would this CLI command automatically run validate, then suggest fixes based on that validation? Same behavior just set at a higher level

@ryan-timothy-albert
Copy link
Contributor Author

Overall looking good! A couple comments:

  • You mentioned moving over to use promptui--I would definitely recommend it! It's super easy to use and works great.
  • I think it would good if this was also accessible through a higher-level CLI command, e.g. speakeasy suggest -s openapi.yaml. It will read better in an article IMO and be more discoverable in the CLI instead of buried as an optional flag. Can leave it accessible via --fix as well though

I think a higher-level CLI command is reasonable. In your mind would this CLI command automatically run validate, then suggest fixes based on that validation? Same behavior just set at a higher level

Done with promptui


var suggestCmd = &cobra.Command{
Use: "suggest",
Short: "Validate an OpenAPI document and get fixes suggested by ChatGPT",
Copy link
Member

Choose a reason for hiding this comment

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

nit/question: Are these suggestions technically being generated by ChatGPT? Or is it simply GPT3?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

GPT3.5 which I believe is a chat model

Copy link
Member

@chase-crumbaugh chase-crumbaugh left a comment

Choose a reason for hiding this comment

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

Some very minor things then gtg!

@ryan-timothy-albert ryan-timothy-albert merged commit d350da8 into main May 27, 2023
2 checks passed
@ryan-timothy-albert ryan-timothy-albert deleted the create_new_llm_cli_command branch May 27, 2023 00:10
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.

None yet

4 participants