Skip to content
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

[Interactive] Integrate Recommendation capability into interactive #5950

Merged
merged 158 commits into from
May 30, 2023
Merged
Show file tree
Hide file tree
Changes from 156 commits
Commits
Show all changes
158 commits
Select commit Hold shift + click to select a range
69ec809
display command recommendation in completer
Nov 18, 2022
c44ad4b
should not sort command recommendation
Nov 18, 2022
f4b3418
prepare recommendation while prev command execution
Nov 18, 2022
3ab962d
complete using recommendation with user's input
Nov 25, 2022
054f41a
add recommendation feedback through telemetry
Nov 28, 2022
1a95347
recommend next and init when no input
Nov 30, 2022
1c2bbab
fix ^J
Dec 6, 2022
3fe0217
scenario recommendation layout
Dec 6, 2022
1aa754e
Scenario Recommendation and Procession
Dec 22, 2022
8e255d5
Update Recommend path with error info
Dec 28, 2022
985207d
Disable scenario recommendation in scenario execution
Dec 28, 2022
952ff46
recover recommendation feedback
Dec 28, 2022
ad59383
Update scenario recommendation style
Dec 29, 2022
fae609b
Add Recommendation Enable Config
Dec 30, 2022
282a956
Add config to control recommender in interactive
Dec 30, 2022
296f1e7
Add hint about how close recommender
Dec 30, 2022
6985a2a
Update code owener
Jan 3, 2023
95b522a
Add Feedback Info
Jan 4, 2023
59d8f95
Update comment
Jan 4, 2023
3cd44a4
Update comment
Jan 4, 2023
fe27250
Merge branch 'main' into interactive-next
Jan 4, 2023
9abcb4f
Update version
Jan 5, 2023
8cb5e9f
Update comment
Jan 5, 2023
4857f4e
Fix license
Jan 5, 2023
a5946ef
Fix style
Jan 5, 2023
db8dec7
Disable recommender when test command completion
Jan 5, 2023
acac613
Fix test_gather
Jan 5, 2023
f39dff6
Refactor
Jan 9, 2023
c755bd0
Apply suggestions from code review
ReaNAiveD Jan 10, 2023
baf7a42
Refactor
Jan 10, 2023
eb338d5
Apply suggestions from code review
ReaNAiveD Jan 10, 2023
21ee2f0
Add some comments and refactor
Jan 10, 2023
cc440f1
Update src/interactive/azext_interactive/azclishell/app.py
ReaNAiveD Jan 10, 2023
97ed38e
Add finish msg on scenario execution
Jan 10, 2023
a88d9f4
Add some comments
Jan 10, 2023
42b015c
Apply suggestions from code review
ReaNAiveD Jan 10, 2023
a53cbec
Some refactor
Jan 10, 2023
603f3bc
Merge remote-tracking branch 'origin/interactive-next' into interacti…
Jan 10, 2023
4b43533
Update src/interactive/azext_interactive/azclishell/recommendation.py
ReaNAiveD Jan 11, 2023
098ce28
Update src/interactive/azext_interactive/azclishell/recommendation.py
ReaNAiveD Jan 11, 2023
5bfdc1b
Some refactor
Jan 11, 2023
24f8f86
Merge remote-tracking branch 'origin/interactive-next' into interacti…
Jan 11, 2023
466a02a
Some refactor
Jan 11, 2023
6ecf237
Add comments
Jan 12, 2023
74f6bf7
Apply suggestions from code review
ReaNAiveD Jan 12, 2023
794121f
Update comments
Jan 12, 2023
7806242
Update src/interactive/azext_interactive/azclishell/scenario_suggest.py
ReaNAiveD Jan 12, 2023
a13f128
Add comment
Jan 12, 2023
bd2b584
Merge branch 'interactive-next' of https://github.com/ReaNAiveD/azure…
wu5bocheng Feb 22, 2023
9648608
[Fix] fix CryptographyDeprecationWarning by ignoring it.
wu5bocheng Feb 28, 2023
5c12cc0
[Feature] recommend one param for the scenario at a time
wu5bocheng Mar 1, 2023
a0719ab
[Feature] give notice to users that they can skip a command or quit t…
wu5bocheng Mar 1, 2023
379bde6
[Update] update notice to users that they can skip a command or quit …
wu5bocheng Mar 1, 2023
3ba7136
[Update] update notice to users that they can skip a command or quit …
wu5bocheng Mar 1, 2023
4e80631
[Update] crypto already fixed
wu5bocheng Mar 6, 2023
a821ea9
Merge pull request #1 from wu5bocheng/main
wu5bocheng Mar 6, 2023
327e5c4
Merge branch 'interactive-main' into interactive-next
wu5bocheng Mar 6, 2023
b1767c3
Update scenario_suggest.py
wu5bocheng Mar 6, 2023
ebc9030
[Add] Load command table before display the shell
wu5bocheng Mar 6, 2023
55524ff
[Add] auto complete param value in scenario
wu5bocheng Mar 6, 2023
db1e640
[Add] auto complete param value in scenario
wu5bocheng Mar 6, 2023
2e89078
[Fix] fix double print of notice for recommendation
wu5bocheng Mar 7, 2023
2604a2e
[Add] Optimize loading table using processing bar
wu5bocheng Mar 9, 2023
3fba464
[Add] Optimize loading table using processing bar
wu5bocheng Mar 9, 2023
2767657
Update src/interactive/azext_interactive/azclishell/app.py
wu5bocheng Mar 9, 2023
2e4be77
Update src/interactive/azext_interactive/azclishell/app.py
wu5bocheng Mar 9, 2023
5a67e63
Merge remote-tracking branch 'origin/interactive-next' into interacti…
wu5bocheng Mar 10, 2023
c7feb0e
[Add] Optimize loading table using processing bar
wu5bocheng Mar 11, 2023
8bb883c
[Add] Optimize loading table using processing bar
wu5bocheng Mar 13, 2023
1c648b4
Merge pull request #3 from wu5bocheng/interactive-autocomplete
wu5bocheng Mar 14, 2023
5817d18
[Update] fix loading logic to Xing recommend
wu5bocheng Mar 15, 2023
9c7b5a2
Merge remote-tracking branch 'origin/interactive-next' into interacti…
wu5bocheng Mar 15, 2023
46c742b
[Update] Use dictionaries instead of strings to store feedback inform…
wu5bocheng Mar 16, 2023
ffd4b6e
[Update] Use dictionaries instead of strings to store feedback inform…
wu5bocheng Mar 18, 2023
0ac9860
Revert "[Update] Use dictionaries instead of strings to store feedbac…
wu5bocheng Mar 18, 2023
784c84b
Revert "[Update] Use dictionaries instead of strings to store feedbac…
wu5bocheng Mar 18, 2023
5337408
[Update] Optimize some variable names(rec-->recommendation)
wu5bocheng Mar 18, 2023
eb3e52b
[Update] Optimize feedback function
wu5bocheng Mar 20, 2023
7ad2376
Update src/interactive/azext_interactive/azclishell/scenario_suggest.py
wu5bocheng Mar 20, 2023
0169eb3
[Update] Optimize param value and add notes
wu5bocheng Mar 20, 2023
1c9221e
[Update] optimize param value and add some notes
wu5bocheng Mar 20, 2023
b3deb0f
Update src/interactive/azext_interactive/azclishell/recommendation.py
wu5bocheng Mar 20, 2023
5bc63d9
[Update] Optimize feedback property name to parallel with doc
wu5bocheng Mar 20, 2023
d5b4e54
[Update] Optimize feedback property name to parallel with doc
wu5bocheng Mar 20, 2023
9a69737
[Update] Optimize feedback initialize
wu5bocheng Mar 20, 2023
a0330ae
Update src/interactive/azext_interactive/azclishell/recommendation.py
wu5bocheng Mar 21, 2023
e4a8ef3
Update src/interactive/azext_interactive/azclishell/app.py
wu5bocheng Mar 21, 2023
1b920ae
Update src/interactive/azext_interactive/azclishell/app.py
wu5bocheng Mar 21, 2023
913c7d5
Update src/interactive/azext_interactive/azclishell/app.py
wu5bocheng Mar 21, 2023
ba749b9
Update src/interactive/azext_interactive/azclishell/app.py
wu5bocheng Mar 21, 2023
f92b355
[Update] optimize param values
wu5bocheng Mar 21, 2023
70cdd9c
[Update] Optimize feedback function and scenario suggestion
wu5bocheng Mar 22, 2023
bd0efe8
Update src/interactive/azext_interactive/azclishell/app.py
wu5bocheng Mar 22, 2023
06cfd09
[Update] Optimize feedback function and scenario suggestion
wu5bocheng Mar 22, 2023
9d6ab82
[Update] Optimize param names
wu5bocheng Mar 22, 2023
1ad7742
Update src/interactive/azext_interactive/azclishell/recommendation.py
wu5bocheng Mar 24, 2023
203168e
Update src/interactive/azext_interactive/azclishell/recommendation.py
wu5bocheng Mar 24, 2023
d3a4cf3
[Fix] fix CryptographyDeprecationWarning by ignoring it.
wu5bocheng Feb 28, 2023
9c13df1
Merge pull request #5 from wu5bocheng/temp-commit
wu5bocheng Mar 25, 2023
7605fa8
Revert "[Fix] fix CryptographyDeprecationWarning by ignoring it."
wu5bocheng Mar 25, 2023
0f75e52
Merge pull request #6 from wu5bocheng/revert-5-temp-commit
wu5bocheng Mar 25, 2023
608bdd0
Merge pull request #4 from wu5bocheng/telemetry_update
wu5bocheng Mar 27, 2023
13e8ff7
[Update] Update readme file of az interactive to describe the recomme…
wu5bocheng Mar 27, 2023
8834dee
[Fix] fix bug in loading commands
wu5bocheng Mar 27, 2023
86dcec9
[Fix] fix bug in telemetry feedback
wu5bocheng Mar 27, 2023
174edce
[Breaking Change] Add scenario search function to az interactive
wu5bocheng Mar 27, 2023
5264c2b
[Breaking Change] Add scenario search function to az interactive
wu5bocheng Mar 27, 2023
cf62a6d
[Fix] fix telemetry bug
wu5bocheng Mar 28, 2023
5194737
[Update] fix scenario autocomplete bugs
wu5bocheng Mar 28, 2023
5bd5380
[Update] fix warning bugs
wu5bocheng Mar 28, 2023
9dc1d32
[Fix] fix scenario recommend for bool params
wu5bocheng Mar 28, 2023
ef2dfbb
[Update] update telemetry function name
wu5bocheng Mar 28, 2023
2d99b1b
[Update] update scenario search
wu5bocheng Mar 29, 2023
99f9280
[Update] update example output format
wu5bocheng Mar 30, 2023
b225a28
[Update] update version
wu5bocheng Apr 4, 2023
e60a00f
[Update] Update README.md and README.rst
wu5bocheng Apr 7, 2023
889b165
Update src/interactive/README.md
wu5bocheng Apr 11, 2023
5f62201
Update src/interactive/azext_interactive/azclishell/app.py
wu5bocheng Apr 11, 2023
d9541cf
Update src/interactive/azext_interactive/azclishell/recommendation.py
wu5bocheng Apr 11, 2023
7696917
Update src/interactive/azext_interactive/azclishell/recommendation.py
wu5bocheng Apr 11, 2023
7accab6
Update src/interactive/README.md
wu5bocheng Apr 11, 2023
92f3926
[Update] Update to support ctrl C
wu5bocheng Apr 11, 2023
5e4c1e0
[Update] Update to support ctrl C to clear screen
wu5bocheng Apr 11, 2023
7d16473
[Delete] delete timeout in scenario search
wu5bocheng Apr 11, 2023
65dbc33
Merge pull request #7 from wu5bocheng/scenario-search
wu5bocheng Apr 12, 2023
7365e1b
[Update] Update to support ctrl C to clear screen
wu5bocheng Apr 12, 2023
5c165e0
[Update] Update some notes
wu5bocheng Apr 12, 2023
4472932
Optimize some notes
wu5bocheng Apr 12, 2023
704229e
Update src/interactive/azext_interactive/azclishell/app.py
wu5bocheng Apr 12, 2023
aa5e2fb
[Update] Update HISTORY.rst
wu5bocheng Apr 13, 2023
788eac9
[Update] Update feedback logistic
wu5bocheng Apr 13, 2023
2119d41
[Update] Update feedback function
wu5bocheng Apr 14, 2023
5c717c5
[Update] Update notes
wu5bocheng Apr 14, 2023
09f8ba0
[Optimize] let uncustomized values such as -o tsv be completed automa…
wu5bocheng Apr 15, 2023
c43fcb7
Update src/interactive/HISTORY.rst
wu5bocheng Apr 26, 2023
9b9ba59
Merge pull request #2 from wu5bocheng/interactive-next
wu5bocheng Apr 26, 2023
c72c6db
[Add] add loading table config to az interactive
wu5bocheng May 8, 2023
6bf0358
[Update] fix format of the code
wu5bocheng May 8, 2023
41a530f
[Update] fix format of the code
wu5bocheng May 11, 2023
50c1fc6
Update _azclierror.py
wu5bocheng May 11, 2023
3d35f92
Update src/interactive/HISTORY.rst
wu5bocheng May 26, 2023
6d7cbc0
Update src/interactive/HISTORY.rst
wu5bocheng May 26, 2023
d7ee0b7
Update src/interactive/README.md
wu5bocheng May 26, 2023
9f2e8c4
[Add] add description and notes to some classes
wu5bocheng May 26, 2023
127f75b
[Update] update irregular notes param -> parameter
wu5bocheng May 30, 2023
ca0dc63
[Add] add gif and video to readme file
wu5bocheng May 30, 2023
3f341e4
[Add] add gif and video to readme file
wu5bocheng May 30, 2023
375c16b
[Add] add gif and video to readme file
wu5bocheng May 30, 2023
b7dfb8c
[Add] add gif and video to readme file
wu5bocheng May 30, 2023
09a6890
[Add] add gif and video to readme file
wu5bocheng May 30, 2023
dbe7777
Update src/interactive/README.md
wu5bocheng May 30, 2023
8699c85
Update src/interactive/README.md
wu5bocheng May 30, 2023
5b0e5f7
Update src/interactive/README.md
wu5bocheng May 30, 2023
ecb65ec
Update src/interactive/README.md
wu5bocheng May 30, 2023
e595896
Update src/interactive/README.md
wu5bocheng May 30, 2023
81c2f7e
Update src/interactive/README.md
wu5bocheng May 30, 2023
bf0b238
Update src/interactive/README.md
wu5bocheng May 30, 2023
615411e
Update src/interactive/README.md
wu5bocheng May 30, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@

/src/front-door/ @pichandwork

/src/interactive/ @jiasli
/src/interactive/ @jiasli @zhoxing-ms @ReaNAiveD

/src/aks-preview/ @andyzhangx @andyliuliming @fumingzhang

Expand Down
11 changes: 11 additions & 0 deletions src/interactive/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@
Release History
===============

0.5.0
+++++
* Support command recommendations that predicts the next commands users might need.
* Support scenario recommendations to help users complete the complex scenarios more smoothly and simply.
* Support new config `az config set interactive.enable_recommender=False` to disable these new recommenders.
* Fix display offset in toolbar.
* Add loading bar to avoid command execution errors caused by uncompleted command loading and param update. User can use CTRL+C to cancel the loading bar.
* Add value completion mechanism for parameter value in scenarios
* Support searching ability for scenarios
* Optimize parameter completion mechanism to recommend one parameter at a time

0.4.6
+++++
* Compatible with argcomplete 2.0.0
Expand Down
72 changes: 72 additions & 0 deletions src/interactive/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## The interactive mode for Microsoft Azure CLI (Command Line Interface)

- Recommend Commands and Scenarios Based on Previous Commands
- Search for Scenarios
- Value Completion in Scenario Mode
- Interactive Tutorials
- Lightweight Drop Down Completions
- Auto Cached Suggestions
Expand Down Expand Up @@ -63,6 +66,12 @@ To undefault a value
$ %% ..
```

To Search for a scenario

```bash
$ /[keywords]
```

## Use Examples

Type a command, for example:
Expand Down Expand Up @@ -104,3 +113,66 @@ Only clears the appended suggestion when you restart the interactive shell
```

The color option will be saved.

# Intelligent AZ Interactive (Revolutionary Change)
## Recommendation

We have integrated the cli recommendation to make the completion ability more intelligent and provide the scenario completion. This is a revolutionary change. Users can enable or disable the recommendation feature by running the following commands:

```
$ az config set interactive.enable_recommender=True # Default, try the new recommendation feature
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it enabled by default?

$ az config set interactive.enable_recommender=False # Disable the recommendation feature
```
Here is a demo video demonstrating the main features of the new az interactive:

[![intelligent_az_interactive](docs/intelligent_az_interactive.png)](docs/intelligent_az_interactive.mp4 "intelligent_az_interactive")

### Command Recommendation

Command recommendation uses an intelligent algorithm to suggest the most relevant and frequently used command for the user based on their historical command inputs. By analyzing the user's input history and matching it with the highest relevant commands, Intelligent Az Interactive can assist Azure CLI beginners in making quick and informed decisions, saving them time and effort.

The command recommendation feature can also be a good way to broaden users' knowledge boundaries and help them recognize and learn commands that are related to their common commands but never used before.

**Usage**: When you don't know what to do next, you can try entering only `Space` first, it will recommend the next command which is most used in other similar sessions.

<img align=center src="docs/command_recommendation.gif" width = "70%" alt="command_recommendation">

### Scenario Identification

Scenario identification is another powerful feature that automatically recognizes the user's current scenario and recommends a set of commands that are most relevant to the user's needs. This feature is based on our extensive knowledge base which cover a wide range of use cases across various scenes. By analyzing the user's input history, Intelligent Az Interactive can identify the relevant scenario and suggest the most appropriate command set, helping new CLI users to quickly accomplish their tasks with confidence and ease.

**Usage**: You can enter `Space` and select the scenario *(the options with prefix `command set`)* you want to use. It will automatically execute the commands in the scenario and help you complete the task.

<img align=center src="docs/scenario_recommendation.gif" width = "70%" alt="scenario_recommendation">

## Search for Scenarios
wu5bocheng marked this conversation as resolved.
Show resolved Hide resolved

We have added the ability to help users search for scenarios based on keywords. When the user enters some keywords or descriptions, we will recommend the scenarios that are most likely to be used based on the keywords and descriptions of the functions the user wants to implement.

**Usage**: You can use the natural language keywords with prefix `/` to search for the commands and usage scenarios you need, and smoothly create and execute corresponding CLI tasks.

<img align=center src="docs/scenario_search.gif" width = "70%" alt="scenario_search">


## Loading Bar

The loading bar is a feature that we have implemented to provide users with a more stable and predictable experience while using our platform. Its primary function is to prevent command parameter detection errors that may occur due to incomplete loading. By displaying the progress of initialization through the loading bar, users can be assured that the initialization process is ongoing and they can expect to see a fully loaded interface once the bar reaches 100%.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • How long will it usually take to load all commands/parameters?
  • Do we have a configure to be able to disable the loading bar if customers don't want it?
  • Is it enabled by default?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Our loading bar feature is automatically enabled, and users can turn it off by az config set enable_preloading=False. The average time for preloading is 30-40s, depending on the machine's memory strength.
Our preloading feature does not increase the loading time compared to the original case, but it will give the user the perception of increased loading time. Although preloading will avoid many command run errors due to incomplete command loading, further optimization of loading time can be done in the future.


Additionally, the loading bar helps prevent user interface lagging or freezing due to insufficient memory. By preloading the necessary resources and data, users can avoid encountering these issues when inputting commands. The loading bar is an essential tool that improves the user experience by ensuring that all necessary components have been loaded before usage, thereby reducing the risk of encountering errors and providing a smoother, more stable platform.

If you want to disable the loading bar, you can run the following command:
```bash
$ az config set enable_preloading=False
```
Please refer to the following gif to see the loading bar in action:

<img src="docs/loading_bar.gif" width = "70%" alt="loading_bar" align=center>


## Value Completion in Scenarios

We added a completion mechanism for parameter values in scenarios to improve the completion ability of param value in
scenarios. In multiple commands of the same scenario, once the user enters a parameter value, we store the value entered by
wu5bocheng marked this conversation as resolved.
Show resolved Hide resolved
the user based on the scenario sample value and some special global parameters, and automatically recommend the completion
of these parameter values in subsequent commands.

110 changes: 0 additions & 110 deletions src/interactive/README.rst

This file was deleted.

2 changes: 1 addition & 1 deletion src/interactive/azext_interactive/azclishell/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

VERSION = '0.4.6'
VERSION = '0.5.0'
12 changes: 12 additions & 0 deletions src/interactive/azext_interactive/azclishell/_azclierror.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

from azure.cli.core.azclierror import ClientRequestError


# pylint: disable=unnecessary-pass
class ScenarioSearchError(ClientRequestError):
""" The client error raised by `Scenario Search`. """
pass
Comment on lines +10 to +12
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure whether it's necessary to save some error messages here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The purpose of defining the ScenarioSearchError class is to be to create a specific error type that can be raised when encountering errors related to the "Scenario Search" functionality. By defining a custom error class, it allows us to quickly identify errors caused by our recommendation service, thereby improving the clarity of the error handling process.

Loading