Texera / texera

Collaborative Machine-Learning-Centric Data Analytics Using Workflows
https://texera.github.io
Apache License 2.0
163 stars 72 forks source link

[2/3] Add AI Assistant Service - add the “Add Type Annotation" Python UDF action #2811

Closed IamtherealBrian closed 1 month ago

IamtherealBrian commented 2 months ago

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" : https://github.com/Texera/texera/pull/2797. -PR for the "[1/3] Add AI Assistant Service - Ai Flag" : https://github.com/Texera/texera/pull/2808 -PR for the "[3/3] Add AI Assistant Service - add the "Add All Type Annotation" Python UDF action" : https://github.com/Texera/texera/pull/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