Skip to content

Commit

Permalink
[Interactive] Integrate Recommendation capability into interactive (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
wu5bocheng authored May 30, 2023
1 parent a230a09 commit 1a82058
Show file tree
Hide file tree
Showing 28 changed files with 1,409 additions and 224 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,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
$ 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 Scenario Knowledge

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%.

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 scenario execution *(corresponding to scenario identification or searching scenario knowledge)* 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
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
Loading

0 comments on commit 1a82058

Please sign in to comment.