-
Notifications
You must be signed in to change notification settings - Fork 113
[3/3] Add AI Assistant Service - add the "Add All Type Annotation" Python UDF action #2857
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Yicong-Huang
requested changes
Sep 23, 2024
Contributor
Yicong-Huang
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.
I left some comments for changes. The major ones are:
- the way you generate annotations, should use AST to generate, not text-based (i.e., start line/col or end line/col).
- you do need to test cases to validate the functionality of your type annotate module. I could not review it by just looking at the code. Also I doubt it works with complex cases such as a static method with keyward arguments and wildcard arguments.
- frontend logic seems unnatural to me. maybe you are not following the typical MVVC design?
core/amber/src/main/scala/edu/uci/ics/texera/web/resource/aiassistant/AiAssistantResource.scala
Show resolved
Hide resolved
core/amber/src/main/scala/edu/uci/ics/texera/web/resource/aiassistant/AiAssistantResource.scala
Outdated
Show resolved
Hide resolved
core/amber/src/main/scala/edu/uci/ics/texera/web/resource/aiassistant/AiAssistantResource.scala
Show resolved
Hide resolved
...er/src/main/scala/edu/uci/ics/texera/web/resource/aiassistant/python_abstract_syntax_tree.py
Outdated
Show resolved
Hide resolved
...er/src/main/scala/edu/uci/ics/texera/web/resource/aiassistant/python_abstract_syntax_tree.py
Outdated
Show resolved
Hide resolved
...er/src/main/scala/edu/uci/ics/texera/web/resource/aiassistant/python_abstract_syntax_tree.py
Outdated
Show resolved
Hide resolved
...er/src/main/scala/edu/uci/ics/texera/web/resource/aiassistant/python_abstract_syntax_tree.py
Outdated
Show resolved
Hide resolved
core/gui/src/app/workspace/component/code-editor-dialog/code-editor.component.ts
Show resolved
Hide resolved
core/gui/src/app/workspace/service/ai-assistant/ai-assistant.service.ts
Outdated
Show resolved
Hide resolved
core/amber/src/main/scala/edu/uci/ics/texera/web/resource/aiassistant/AiAssistantResource.scala
Outdated
Show resolved
Hide resolved
Yicong-Huang
approved these changes
Oct 1, 2024
Contributor
Yicong-Huang
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.
In general looks good! Left some comments to handle.
...r/src/main/scala/edu/uci/ics/texera/web/resource/aiassistant/test_type_annotation_visitor.py
Outdated
Show resolved
Hide resolved
...r/src/main/scala/edu/uci/ics/texera/web/resource/aiassistant/test_type_annotation_visitor.py
Show resolved
Hide resolved
.../amber/src/main/scala/edu/uci/ics/texera/web/resource/aiassistant/type_annotation_visitor.py
Outdated
Show resolved
Hide resolved
.../amber/src/main/scala/edu/uci/ics/texera/web/resource/aiassistant/type_annotation_visitor.py
Show resolved
Hide resolved
core/gui/src/app/workspace/component/code-editor-dialog/code-editor.component.ts
Show resolved
Hide resolved
core/gui/src/app/workspace/service/ai-assistant/ai-assistant.service.ts
Outdated
Show resolved
Hide resolved
… minchongWu-ai-feature2-new
PurelyBlank
pushed a commit
that referenced
this pull request
Dec 4, 2024
…thon UDF action (#2857) This PR introduces another AI feature call "Add All Type Annotation" that enhance the user experience of the Python UDF after integrating with the Pyright language server. You can refer to the related PR here: -PR for the "Add the pyright language server" : #2797. -PR for the "[1/3] Add AI Assistant Service - Ai Flag" : #2808 -PR for the "[2/3] Add AI Assistant Service - add the "Add Type Annotation" Python UDF action" : #2811 **Key change:** Added another Monaco action in the frontend Python UDF editor to allow users to automatically add all type annotations for the arguments within their selected code block. **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: https://github.com/user-attachments/assets/d70c1b02-b309-4359-a267-0a5eef831316
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces another AI feature call "Add All Type Annotation" that enhance the user experience of the Python UDF after integrating with the Pyright language server. You can refer to the related PR here:
-PR for the "Add the pyright language server" : #2797.
-PR for the "[1/3] Add AI Assistant Service - Ai Flag" : #2808
-PR for the "[2/3] Add AI Assistant Service - add the "Add Type Annotation" Python UDF action" : #2811
Key change:
Added another Monaco action in the frontend Python UDF editor to allow users to automatically add all type annotations for the arguments within their selected code block.
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