Repository navigation
[2/3] Add AI Assistant Service - add the “Add Type Annotation" Python UDF action - #2811
Merged
Merged
Conversation
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 <[email protected]>
chenlica
approved these changes
Sep 3, 2024
chenlica
left a comment
Contributor
There was a problem hiding this comment.
I revised the description of the PR.
Yicong-Huang
requested changes
Sep 3, 2024
Yicong-Huang
left a comment
Contributor
There was a problem hiding this comment.
A major comment is that we should push prompt generation to backend. Also frontend logic please use Observables and Subscription to implement as Angular's recommendation. more to read https://stackoverflow.com/questions/37364973/what-is-the-difference-between-promises-and-observables
…#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 <[email protected]> Co-authored-by: Yicong Huang <[email protected]>
Yicong-Huang
force-pushed
the
master
branch
from
September 10, 2024 07:16
240b068 to
2b3e779
Compare
Yicong-Huang
requested changes
Sep 19, 2024
Yicong-Huang
left a comment
Contributor
There was a problem hiding this comment.
I left some comments. The frontend would require major changes.
Yicong-Huang
approved these changes
Sep 20, 2024
Yicong-Huang
left a comment
Contributor
There was a problem hiding this comment.
LGTM. Left minor comments.
IamtherealBrian
added a commit
that referenced
this pull request
Oct 2, 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
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 <[email protected]>
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 <[email protected]> Co-authored-by: Yicong Huang <[email protected]>
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
SarahAsad23
pushed a commit
to madisonmlin/texera
that referenced
this pull request
May 20, 2026
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" : apache#2811 -PR for the "[3/3] Add AI Assistant Service - add the "Add All Type Annotation" Python UDF action" : apache#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 <[email protected]>
SarahAsad23
pushed a commit
to madisonmlin/texera
that referenced
this pull request
May 20, 2026
… UDF action (apache#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" : apache#2797. -PR for the "[1/3] Add AI Assistant Service - Ai Flag" : apache#2808 -PR for the "[3/3] Add AI Assistant Service - add the "Add All Type Annotation" Python UDF action" : apache#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 <[email protected]> Co-authored-by: Yicong Huang <[email protected]>
SarahAsad23
pushed a commit
to madisonmlin/texera
that referenced
this pull request
May 20, 2026
…thon UDF action (apache#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" : apache#2797. -PR for the "[1/3] Add AI Assistant Service - Ai Flag" : apache#2808 -PR for the "[2/3] Add AI Assistant Service - add the "Add Type Annotation" Python UDF action" : apache#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
yangzhang75
pushed a commit
to yangzhang75/texera
that referenced
this pull request
Jun 22, 2026
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" : apache#2811 -PR for the "[3/3] Add AI Assistant Service - add the "Add All Type Annotation" Python UDF action" : apache#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 <[email protected]>
yangzhang75
pushed a commit
to yangzhang75/texera
that referenced
this pull request
Jun 22, 2026
… UDF action (apache#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" : apache#2797. -PR for the "[1/3] Add AI Assistant Service - Ai Flag" : apache#2808 -PR for the "[3/3] Add AI Assistant Service - add the "Add All Type Annotation" Python UDF action" : apache#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 <[email protected]> Co-authored-by: Yicong Huang <[email protected]>
yangzhang75
pushed a commit
to yangzhang75/texera
that referenced
this pull request
Jun 22, 2026
…thon UDF action (apache#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" : apache#2797. -PR for the "[1/3] Add AI Assistant Service - Ai Flag" : apache#2808 -PR for the "[2/3] Add AI Assistant Service - add the "Add Type Annotation" Python UDF action" : apache#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
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
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 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:
7879e394439dc30d2e09baaf36062bf1.mp4