-
Notifications
You must be signed in to change notification settings - Fork 112
Add AI-Assistant flag and features #2801
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
Conversation
yunyad
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally LGTM, please check the comments.
core/amber/src/main/scala/edu/uci/ics/amber/engine/common/AmberConfig.scala
Outdated
Show resolved
Hide resolved
core/amber/src/main/scala/edu/uci/ics/amber/engine/common/AmberConfig.scala
Outdated
Show resolved
Hide resolved
core/amber/src/main/scala/edu/uci/ics/amber/engine/common/AmberConfig.scala
Outdated
Show resolved
Hide resolved
core/amber/src/main/scala/edu/uci/ics/amber/engine/common/AmberConfig.scala
Outdated
Show resolved
Hide resolved
yunyad
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
yunyad
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to have a further discussion.
This PR adds a flag to allow the user to use the AI assistant (currently only OpenAI) and introduces some AI features that enhance the user experience of the Python UDF after integrating with the Pyright language server. You can refer to the PR for the Pyright language server here: #2797.
Key change:
Flag:
If the user chooses the 'none' flag, all AI features will be hidden and not available to the user. Otherwise, the AI features will be accessible in the Python UDF editor.
Add Type Annotation:
This action requires the user to select a single argument in their Python UDF code. A UI with a suggestion for the selected argument will pop up. The user can choose to accept or decline the suggestion from OpenAI. If they accept the suggestion, it will be added to their code; otherwise, the code will remain unchanged. The suggestion is provided by OpenAI. After the backend receives the response from OpenAI, it will be forwarded to the frontend via a RESTful API.
Example:
7879e394439dc30d2e09baaf36062bf1.mp4
Add All Type Annotation:
This action requires the user to select a code block in their Python UDF code. The action will automatically identify all arguments without type annotations and provide type annotation suggestions for each argument sequentially. The selected code block will be sent to the backend for Python Abstract Syntax Tree (AST) analysis to locate arguments without type annotations, and the result will be sent back to the frontend via a RESTful API. If the user selects a code block that has no arguments or where all the arguments already have type annotations, the code will remain unchanged.
Example:
add.all.type.annotation.mp4
Summary:
With these two AI features, users can easily add type annotations to their code. This will enable the Pyright language server to perform better at detecting semantic errors after the type annotations are added.