Skip to content

Conversation

@sulixu
Copy link
Contributor

@sulixu sulixu commented Aug 10, 2023

The az aks ai command initiates a chat with an Azure Kubernetes Service AI Expert, providing scripts for az commands along with instructions ('re-prompt', 'run', 'quit') for interactive use.

Summary of changes in each file:

  • _help.py: Added help text for the new aks ai command.
  • _openai_wrapper.py: Added a new file that contains the implementation of the OpenAI chat assistant.
  • commands.py: Added the aks ai command to the command table.
  • custom.py: Added the start_chat function that launches the OpenAI interactive shell.
  • tests/latest/test_aks_commands.py: Added tests for the aks ai command.
  • setup.py: Updated the version number and dependencies

demo

This checklist is used to make sure that common guidelines for a pull request are followed.

Related command

az extension update --name aks-preview
az aks copilot

General Guidelines

  • Have you run azdev style <YOUR_EXT> locally? (pip install azdev required)
  • Have you run python scripts/ci/test_index.py -q locally?

For new extensions:

About Extension Publish

There is a pipeline to automatically build, upload and publish extension wheels.
Once your pull request is merged into main branch, a new pull request will be created to update src/index.json automatically.
You only need to update the version information in file setup.py and historical information in file HISTORY.rst in your PR but do not modify src/index.json.

@azure-client-tools-bot-prd
Copy link

azure-client-tools-bot-prd bot commented Aug 10, 2023

⚠️Azure CLI Extensions Breaking Change Test
⚠️aks-preview
rule cmd_name rule_message suggest_message
⚠️ 1001 - CmdAdd aks copilot cmd aks copilot added

@azure-client-tools-bot-prd
Copy link

Hi @sulixu,
Please write the description of changes which can be perceived by customers into HISTORY.rst.
If you want to release a new extension version, please update the version in setup.py as well.

@yonzhan
Copy link
Collaborator

yonzhan commented Aug 10, 2023

Thank you for your contribution! We will review the pull request and get back to you soon.

Copy link
Member

Choose a reason for hiding this comment

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

As far as I know, cli command does not accept positional arguments. May be set an option for this?

Comment on lines 27 to 28
Copy link
Member

Choose a reason for hiding this comment

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

Better pin the dependency to a fixed version

@sulixu sulixu force-pushed the dev-aks-preview-ai branch from 749599e to 619aa54 Compare August 14, 2023 23:36
Copy link
Member

@FumingZhang FumingZhang left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

Choose a reason for hiding this comment

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

Can you leave a note (or a link) about where/how to acquire these keys in the command help message?

Copy link
Member

@jsntcy jsntcy Aug 23, 2023

Choose a reason for hiding this comment

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

Maybe "copilot" is better than "ai"?

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
long-summary: This command initiates a chat assistant with expertise in Azure Kubernetes Service, offering guidance on troubleshooting issues using az commands.
long-summary: |-
This command initiates a chat assistant with expertise in Azure Kubernetes Service, offering guidance on troubleshooting issues using az commands.

Maybe we could use |- to preserves the newlines in long-summary?

Copy link
Contributor

Choose a reason for hiding this comment

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

How about naming it as aks assistant or aks copilot?

Comment on lines +919 to +926
Copy link
Contributor

Choose a reason for hiding this comment

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

Using general name instead of professional terminology may be more user-friendly, especially for some customers who may not be familiar with ChatGPT related fields

Suggested change
c.argument('prompt', options_list=['--prompt', '-p'], validator=validate_prompt_input,
help='The question you want to ask, e.g: How to create a AKS cluster')
c.argument('question', options_list=['--question', '-q'], validator=validate_prompt_input,
help='The question you want to ask, e.g: How to create a AKS cluster')

Copy link
Contributor

@zhoxing-ms zhoxing-ms Aug 23, 2023

Choose a reason for hiding this comment

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

Please note that the colorama is already defined in core CLI code link , so there is no need for duplicate definitions to avoid dependency conflicts in the future

@sulixu sulixu force-pushed the dev-aks-preview-ai branch from f9f5591 to 754331d Compare August 28, 2023 18:42
…vice expert

Summary of changes in each file:
- `_help.py`: Added help text for the new `aks ai` command.
- `_openai_wrapper.py`: Added a new file that contains the implementation of the OpenAI chat assistant.
- `commands.py`: Added the `aks ai` command to the command table.
- `custom.py`: Added the `start_chat` function that launches the OpenAI interactive shell.
- `tests/latest/test_aks_commands.py`: Added tests for the `aks ai` command.
- `setup.py`: Updated the version number and dependencies
Summary of changes in each file:
- `_help.py`: Renamed the command 'aks ai' to 'aks copilot' in the help text.
- `_params.py`: Renamed the command 'aks ai' to 'aks copilot' in the argument context.
- `commands.py`: Renamed the command 'aks ai' to 'aks copilot' in the command group.
- `test_aks_commands.py`: Updated the test case to use the new command 'aks copilot' instead of 'aks ai'.
@sulixu sulixu force-pushed the dev-aks-preview-ai branch from e56bb8d to 71b95d6 Compare August 30, 2023 17:28
@zhoxing-ms
Copy link
Contributor

Please take a look at this comment #6629 (comment) You need to add the description of PR change into the HISTORY.rst

# Handle user input
user_input = getch()
if user_input in ('p', 'P'):
scripts, messages = prompt_chat_gpt(messages, params, insist=False, scripts=scripts)
Copy link
Member

Choose a reason for hiding this comment

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

Could you please help explain the purpose of passing insist=False for prompt_char_gpt?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

at the very beginning of the session, we need to start with a user mission/task
"Prompt: I need to create a aks cluster"

If user just press enter without entering anything, we have so objective, so insist is default to True to prompt the user until they supply to task to work with

for example, user might hit enter by mistake multiple times until typed "Create a AKS cluster", so I only show "Prompt:"
image

Once that is started, user can always re-prompt the LLM to refine their objectives or add more requirements by re-prompting. But they would trigger that by mistake or they change their mind, so insist=False allow the user to not enter anything (= cancel out of the prompt)

image

@zhoxing-ms zhoxing-ms merged commit e1e186d into Azure:main Sep 6, 2023
@azclibot
Copy link
Collaborator

azclibot commented Sep 6, 2023

[Release] Update index.json for extension [ aks-preview ] : https://dev.azure.com/azclitools/internal/_build/results?buildId=88397&view=results

@sulixu sulixu mentioned this pull request Sep 19, 2023
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AKS Auto-Assign Auto assign by bot

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants