-
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 #2812
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
Closed
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
This was referenced Aug 31, 2024
IamtherealBrian
added a commit
that referenced
this pull request
Sep 2, 2024
This is the first PR of the "Add AI Assistant Service" series, which will consist of 3 PRs in total. -PR for the "[2/3] Add AI Assistant Service - add the "Add Type Annotation" Python UDF action" : #2811 -PR for the "[3/3] Add AI Assistant Service - add the "Add All Type Annotation" Python UDF action" : #2812 This PR introduces an AI Assistant flag that allows users to switch between "none" (disabling the AI assistant) and "openai" (using OpenAI as the AI assistant). If the 'none' flag is selected, all AI features will be hidden and unavailable to the user. If the 'openai' flag is selected, AI features will be enabled and accessible in the Python UDF editor. (The implementation of these AI features will be covered in PR2 of 3 and PR3 of 3). **Key idea of each new file:** (1) AiAssistantManager.scala: Handling results corresponding to the two cases obtained from the flag. (2) AiAssistantResource.scala: Implement three RESTful API endpoints to manage AI flag. **Notice:** Since the AI features are in the second and third PRs, the RESTful API functionality in this PR cannot be tested yet, as it will only be used in the second and third PRs. However, if you just want to test the result, you can print the result of the boolean for the testing purpose by calling the frontend method `checkAiAssistantEnabled()`. --------- Co-authored-by: Xudong Wu <2373025856w@gmail.com>
…#2823) Use `main.ts` which done by `Typefox` to start pyright instead of `startPyright.mjs`. The work done by `Typefox` can be referred to: https://github.com/TypeFox/monaco-languageclient/tree/main/packages/examples/src/python --------- Co-authored-by: Yicong Huang <17627829+Yicong-Huang@users.noreply.github.com> Co-authored-by: Yicong Huang <yicong.huang@observeinc.com>
240b068 to
2b3e779
Compare
IamtherealBrian
added a commit
that referenced
this pull request
Sep 20, 2024
… UDF action (#2811) This PR introduces a new AI-based feature called "Add Type Annotation" that enhances the user experience of the Python UDF on top of the Pyright language server. The following are related PR's: -PR for the "Add the pyright language server" : #2797. -PR for the "[1/3] Add AI Assistant Service - Ai Flag" : #2808 -PR for the "[3/3] Add AI Assistant Service - add the "Add All Type Annotation" Python UDF action" : #2812 **Key changes:** Added a Monaco action in the frontend Python UDF editor to allow users to automatically add type annotations for an argument each time they select a single argument in their code. **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: https://github.com/user-attachments/assets/29cee6c8-c793-4d83-8b27-db64bcc636ae --------- Co-authored-by: Yicong Huang <17627829+Yicong-Huang@users.noreply.github.com> Co-authored-by: Yicong Huang <yicong.huang@observeinc.com>
PurelyBlank
pushed a commit
that referenced
this pull request
Dec 4, 2024
This is the first PR of the "Add AI Assistant Service" series, which will consist of 3 PRs in total. -PR for the "[2/3] Add AI Assistant Service - add the "Add Type Annotation" Python UDF action" : #2811 -PR for the "[3/3] Add AI Assistant Service - add the "Add All Type Annotation" Python UDF action" : #2812 This PR introduces an AI Assistant flag that allows users to switch between "none" (disabling the AI assistant) and "openai" (using OpenAI as the AI assistant). If the 'none' flag is selected, all AI features will be hidden and unavailable to the user. If the 'openai' flag is selected, AI features will be enabled and accessible in the Python UDF editor. (The implementation of these AI features will be covered in PR2 of 3 and PR3 of 3). **Key idea of each new file:** (1) AiAssistantManager.scala: Handling results corresponding to the two cases obtained from the flag. (2) AiAssistantResource.scala: Implement three RESTful API endpoints to manage AI flag. **Notice:** Since the AI features are in the second and third PRs, the RESTful API functionality in this PR cannot be tested yet, as it will only be used in the second and third PRs. However, if you just want to test the result, you can print the result of the boolean for the testing purpose by calling the frontend method `checkAiAssistantEnabled()`. --------- Co-authored-by: Xudong Wu <2373025856w@gmail.com>
PurelyBlank
pushed a commit
that referenced
this pull request
Dec 4, 2024
… UDF action (#2811) This PR introduces a new AI-based feature called "Add Type Annotation" that enhances the user experience of the Python UDF on top of the Pyright language server. The following are related PR's: -PR for the "Add the pyright language server" : #2797. -PR for the "[1/3] Add AI Assistant Service - Ai Flag" : #2808 -PR for the "[3/3] Add AI Assistant Service - add the "Add All Type Annotation" Python UDF action" : #2812 **Key changes:** Added a Monaco action in the frontend Python UDF editor to allow users to automatically add type annotations for an argument each time they select a single argument in their code. **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: https://github.com/user-attachments/assets/29cee6c8-c793-4d83-8b27-db64bcc636ae --------- Co-authored-by: Yicong Huang <17627829+Yicong-Huang@users.noreply.github.com> Co-authored-by: Yicong Huang <yicong.huang@observeinc.com>
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