Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into feature/telemetry
Browse files Browse the repository at this point in the history
  • Loading branch information
ralph-msft committed Feb 9, 2024
2 parents 10e7292 + 772892a commit b2d6f3e
Show file tree
Hide file tree
Showing 244 changed files with 11,387 additions and 1,723 deletions.
156 changes: 154 additions & 2 deletions .azure/pipelines/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,160 @@ stages:
docker tag acrbn.azurecr.io/azure-ai-cli:bookworm-$(AICLIVersion) acrbn.azurecr.io/azure-ai-cli:latest
docker push acrbn.azurecr.io/azure-ai-cli:latest
- stage: ManualApproval
- stage: TestStage
dependsOn: [SetupStage, BuildStage]
condition: and(succeeded(), or(eq(variables['IsRelease'], 'true'), eq(variables['TestDevBuild'], 'true')))
variables:
AICLIVersion: $[ stageDependencies.SetupStage.SetupJob.outputs['Variables.AICLIVersion']]
AICLISemVerVersion: $[ stageDependencies.SetupStage.SetupJob.outputs['Variables.AICLISemVerVersion']]
AICLINuPkgFileName: $[ stageDependencies.SetupStage.SetupJob.outputs['Variables.AICLINuPkgFileName']]
BuildConfiguration: 'ReleaseUnixOS'
LocalBinOutputPath: '$(Build.SourcesDirectory)/tests/build/bin'
LocalInputPath: '$(Build.SourcesDirectory)/tests'
TargetFolder: '$(System.DefaultWorkingDirectory)'
TestFilter: 'cli=ai&tag!=skip'
TestResultsPath: '$(Build.SourcesDirectory)/testresults'
TestRunTitle: 'Azure AI CLI $(AICLIVersion) ($(BuildConfiguration)-$(Build.BuildNumber))'
TestRunTrxFileName: '$(TestResultsPath)/ai-cli-test-results-$(BuildConfiguration)-$(Build.BuildNumber).trx'
TestBackupArtifactFile: '$(Build.ArtifactStagingDirectory)/ai-cli-test-run-backup-artifact-$(BuildConfiguration)-$(Build.BuildNumber).zip'
jobs:
- job: TestJob
steps:

# -----------------------------------------------------------------------------
# Download the ai CLI artifacts
# -----------------------------------------------------------------------------
- task: DownloadPipelineArtifact@2
displayName: Download ai-cli-artifacts
inputs:
artifact: 'ai-cli-artifacts'
targetPath: '$(Build.ArtifactStagingDirectory)/ai-cli-artifacts'
- task: CopyFiles@2
displayName: Copy downloaded ai-cli-artifacts
inputs:
Contents: '**/*'
SourceFolder: $(Build.ArtifactStagingDirectory)/ai-cli-artifacts
TargetFolder: $(TargetFolder)
FlattenFolders: true
- task: Bash@3
displayName: List files...
inputs:
targetType: 'inline'
script: |
echo listing for $(System.DefaultWorkingDirectory)
ls -la $(System.DefaultWorkingDirectory)
echo listing for $(Build.ArtifactStagingDirectory)
ls -la $(Build.ArtifactStagingDirectory)
# -----------------------------------------------------------------------------
# Install the ai CLI
# -----------------------------------------------------------------------------
- task: DotNetCoreCLI@2
displayName: INSTALL AI - Installing ai CLI via `dotnet tool install`
inputs:
includeNuGetOrg: false
command: custom
custom: tool
version: '8.0.x'
arguments: install
--ignore-failed-sources
--add-source "$(System.DefaultWorkingDirectory)"
--global Azure.AI.CLI
--version "$(AICLIVersion)"

# -----------------------------------------------------------------------------
# Finish job prep (mkdir, config cli)
# -----------------------------------------------------------------------------
- bash: |
env | sort
which dotnet
dotnet --version
echo "TestResultsPath: $(TestResultsPath)"
mkdir $(TestResultsPath)
echo "LocalInputPath: $(LocalInputPath)"
ls -la $(LocalInputPath)
ai config system --set input.path $(LocalInputPath)
ai config --find
echo "DefaultWorkingDirectory: $(System.DefaultWorkingDirectory)"
ls -la $(System.DefaultWorkingDirectory)
displayName: Finish job prep (mkdir, config cli)
workingDirectory: '$(System.DefaultWorkingDirectory)'
# -----------------------------------------------------------------------------
# Build the YamlTestAdapter
# -----------------------------------------------------------------------------
- task: DotNetCoreCLI@2
displayName: Build YamlTestAdapter
inputs:
includeNuGetOrg: false
command: build
version: '8.0.x'
projects: '**/testadapter/YamlTestAdapter.csproj'
arguments:
-c $(BuildConfiguration)
/p:Platform=x64
/p:LocalBinOutputPath="$(LocalBinOutputPath)"

# -----------------------------------------------------------------------------
# Run the tests
# -----------------------------------------------------------------------------
- task: AzureCLI@2
displayName: Run ai-cli tests
continueOnError: true
inputs:
azureSubscription: 'AI_CLI_TestAdapter'
scriptType: 'bash'
scriptLocation: 'inlineScript'
inlineScript: |
az --version
az account show
cd $(TestResultsPath)
echo dotnet test --logger trx --results-directory "$(Agent.TempDirectory)" --logger:"trx;LogFileName=$(TestRunTrxFileName)" --logger:"console;verbosity=normal" --filter "$(TestFilter)" "$(LocalBinOutputPath)/$(BuildConfiguration)/net8.0/Azure.AI.CLI.TestAdapter.dll"
dotnet test --logger trx --results-directory "$(Agent.TempDirectory)" --logger:"trx;LogFileName=$(TestRunTrxFileName)" --logger:"console;verbosity=normal" --filter "$(TestFilter)" "$(LocalBinOutputPath)/$(BuildConfiguration)/net8.0/Azure.AI.CLI.TestAdapter.dll"
# -----------------------------------------------------------------------------
# Archive and publish the test run backup artifact
# -----------------------------------------------------------------------------
- task: ArchiveFiles@2
displayName: Archive ai-cli-test run backup artifact (build/bin)
continueOnError: true
inputs:
rootFolderOrFile: '$(LocalBinOutputPath)'
includeRootFolder: false
archiveFile: '$(TestBackupArtifactFile)'
replaceExistingArchive: false

- task: ArchiveFiles@2
displayName: Archive ai-cli-test run backup artifact (testresults)
continueOnError: true
inputs:
rootFolderOrFile: '$(TestResultsPath)'
includeRootFolder: false
archiveFile: '$(TestBackupArtifactFile)'
replaceExistingArchive: false

- task: PublishBuildArtifacts@1
displayName: Publish ai-cli-test run backup artifact
continueOnError: true
retryCountOnTaskFailure: 5
inputs:
parallel: true
pathToPublish: '$(TestBackupArtifactFile)'
artifactName: TestRunBackup

# -----------------------------------------------------------------------------
# Publish the test results
# -----------------------------------------------------------------------------
- task: PublishTestResults@2
displayName: Publish ai-cli test results
inputs:
testRunner: VSTest
testResultsFiles: '$(TestRunTrxFileName)'
testRunTitle: '$(TestRunTitle)'
failTaskOnFailedTests: true

- stage: ManualApproval
dependsOn: [SetupStage, BuildStage, TestStage]
condition: and(succeeded(), or(eq(stageDependencies.SetupStage.outputs['SetupJob.Variables.IsRelease'], 'true'), eq(variables['PublishDevBuild'], 'true')))
variables:
AICLIVersion: $[ stageDependencies.SetupStage.SetupJob.outputs['Variables.AICLIVersion']]
Expand All @@ -238,7 +390,7 @@ stages:
onTimeout: reject

- stage: PublishPublic
dependsOn: [SetupStage, BuildStage, ManualApproval]
dependsOn: [SetupStage, BuildStage, TestStage, ManualApproval]
condition: and(succeeded(), or(eq(stageDependencies.SetupStage.outputs['SetupJob.Variables.IsRelease'], 'true'), eq(variables['PublishDevBuild'], 'true')))
variables:
AICLIVersion: $[ stageDependencies.SetupStage.SetupJob.outputs['Variables.AICLIVersion']]
Expand Down
6 changes: 6 additions & 0 deletions .github/compliance/inventory.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
inventory:
- source: DirectOwners
isProduction: false
items:
- id: [email protected]
- id: [email protected]
2 changes: 1 addition & 1 deletion .github/workflows/build-package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Set up .NET Core
uses: actions/setup-dotnet@v2
with:
dotnet-version: '7.0.x' # Set the desired .NET version
dotnet-version: '8.0.x' # Set the desired .NET version

- name: Set up environment variables
run: |
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
**/.vscode/**
**/bin/*/net6.0/*
**/bin/*/net7.0/*
**/bin/*/net8.0/*
**/obj/*
**/Properties/launchSettings.json
ideas/website/node_modules/**
testresults/**
*.user
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
Status: Draft in Progress
Status: Draft in Progress
Owner: Rob Chambers

# Using the Azure AI CLI

The Azure `AI` Command-Line Interface (CLI) is a cross-platform command-line tool to connect to Azure AI services and execute control-plane and data-plane operations without having to write any code. The CLI allows the execution of commands through a terminal using interactive command-line prompts or via script.
The Azure `AI` Command-Line Interface (CLI) is a cross-platform command-line tool to connect to Azure AI services and execute control-plane and data-plane operations without having to write any code. The CLI allows the execution of commands through a terminal using interactive command-line prompts or via script.

You can easily use the `AI` CLI to experiment with key Azure AI service features and see how they work with your use cases. Within minutes, you can setup all the required Azure resources needed, and build a customized Copilot using OpenAI's chat completions APIs and your own data. You can try it out interactively, or script larger processes to automate your own workflows and evaluations as part of your CI/CD system.

In the future, you'll even be able to use the `AI` CLI to dynamically create code in the programming language of your choice to integrate with your own applications.

## **STEP 1**: Setup your development environment

You can install the Azure `AI` CLI locally on Linux, Mac, or Windows computers, or use it thru an internet browser or Docker container.
You can install the Azure `AI` CLI locally on Linux, Mac, or Windows computers, or use it thru an internet browser or Docker container.

During this public preview, we recommend using the Azure `AI` CLI thru GitHub Codespaces. This will allow you to quickly get started without having to install anything locally.

Expand Down Expand Up @@ -82,12 +82,12 @@ ai chat --system @prompt.txt --user "Tell me about Azure AI Studio"
```
USAGE: ai chat [...]
CONNECTION (see: ai help connection)
CONNECTION (see: ai help connection)
--deployment DEPLOYMENT (see: ai help chat deployment)
--endpoint ENDPOINT (see: ai help chat endpoint)
--key KEY (see: ai help chat key)
--endpoint ENDPOINT (see: ai help chat endpoint)
--key KEY (see: ai help chat key)
INPUT (see: ai help chat input)
INPUT (see: ai help chat input)
--interactive (see: ai help chat interactive)
--system PROMPT (see: ai help chat system prompt)
* --file FILE (see: ai help chat history file)
Expand Down Expand Up @@ -118,7 +118,7 @@ ai search index update --files "../../data/3-product-info/*.md" --index-name "pr

```
AI - Azure AI CLI, Version 1.0.0
Copyright (c) 2023 Microsoft Corporation. All Rights Reserved.
Copyright (c) 2024 Microsoft Corporation. All Rights Reserved.
This PUBLIC PREVIEW version may change at any time.
See: https://aka.ms/azure-ai-cli-public-preview
Expand Down Expand Up @@ -187,4 +187,4 @@ ai chat --interactive --system @prompt.txt --index-name "product-info"

```bash
ai chat --system @prompt.txt --index-name "product-info" --user "Which tent has the highest rainfly waterproof rating?"
```
```
23 changes: 23 additions & 0 deletions ai-cli.sln
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "test_helper_functions_exten
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "template_extension", "src\extensions\template_extension\template_extension.csproj", "{023B4F9C-E2B3-4CCD-A993-87E337C16EDE}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "YamlTestAdapter", "tests\testadapter\YamlTestAdapter.csproj", "{7C3F1355-B679-487D-904D-7E5FEBA9E75C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "YamlTestFramework", "tests\testframework\YamlTestFramework.csproj", "{B0B3437F-1828-4A13-866F-1CF7C924015E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "YamlTestRunner", "tests\testrunner\YamlTestRunner.csproj", "{39876475-2D98-40CF-8B08-CD423A5EB4E8}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{C8AFF891-D6AA-4B8F-BC21-10404DF4B355}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "telemetry.aria", "src\telemetry\telemetry.aria.csproj", "{306A3CD6-91C2-450B-9995-79701CE63FE2}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{68834003-CCC2-44D7-9EA4-F9B6C65CFC99}"
Expand Down Expand Up @@ -48,6 +56,18 @@ Global
{023B4F9C-E2B3-4CCD-A993-87E337C16EDE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{023B4F9C-E2B3-4CCD-A993-87E337C16EDE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{023B4F9C-E2B3-4CCD-A993-87E337C16EDE}.Release|Any CPU.Build.0 = Release|Any CPU
{7C3F1355-B679-487D-904D-7E5FEBA9E75C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7C3F1355-B679-487D-904D-7E5FEBA9E75C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7C3F1355-B679-487D-904D-7E5FEBA9E75C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7C3F1355-B679-487D-904D-7E5FEBA9E75C}.Release|Any CPU.Build.0 = Release|Any CPU
{B0B3437F-1828-4A13-866F-1CF7C924015E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B0B3437F-1828-4A13-866F-1CF7C924015E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B0B3437F-1828-4A13-866F-1CF7C924015E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B0B3437F-1828-4A13-866F-1CF7C924015E}.Release|Any CPU.Build.0 = Release|Any CPU
{39876475-2D98-40CF-8B08-CD423A5EB4E8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{39876475-2D98-40CF-8B08-CD423A5EB4E8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{39876475-2D98-40CF-8B08-CD423A5EB4E8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{39876475-2D98-40CF-8B08-CD423A5EB4E8}.Release|Any CPU.Build.0 = Release|Any CPU
{306A3CD6-91C2-450B-9995-79701CE63FE2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{306A3CD6-91C2-450B-9995-79701CE63FE2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{306A3CD6-91C2-450B-9995-79701CE63FE2}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand All @@ -60,6 +80,9 @@ Global
{272E0B1B-6C05-428E-BF64-E30B1E5F603A} = {644B75F1-C768-4DB3-BAF2-C69A1F36DD28}
{7BD6EF67-BA75-478D-9721-C1B2AB6DE3FF} = {644B75F1-C768-4DB3-BAF2-C69A1F36DD28}
{023B4F9C-E2B3-4CCD-A993-87E337C16EDE} = {644B75F1-C768-4DB3-BAF2-C69A1F36DD28}
{7C3F1355-B679-487D-904D-7E5FEBA9E75C} = {C8AFF891-D6AA-4B8F-BC21-10404DF4B355}
{B0B3437F-1828-4A13-866F-1CF7C924015E} = {C8AFF891-D6AA-4B8F-BC21-10404DF4B355}
{39876475-2D98-40CF-8B08-CD423A5EB4E8} = {C8AFF891-D6AA-4B8F-BC21-10404DF4B355}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {002655B1-E1E1-4F2A-8D53-C9CD55136AE2}
Expand Down
2 changes: 1 addition & 1 deletion ideas/azure-ai-cli-installation-spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Customer Requirements:
- Support Debian 10, 11, and 12
- Support Ubunutu 20.04 and 22.04
- Check and install Azure CLI if not present
- Check and install dotnet 7.0 if not present
- Check and install dotnet 8.0 if not present
- Check and install Python azure.ai.generative SDK if not present
- Update user's shell rc file (e.g. `$HOME/.bashrc` and/or `$HOME/.zshrc`)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<EnableDefaultCompileItems>true</EnableDefaultCompileItems>
<AICLIExtensionReferencePath Condition="'$(AICLIExtensionReferencePath)' == ''">D:\src\ai-cli\src\ai\bin\Debug\net7.0</AICLIExtensionReferencePath>
<AICLIExtensionReferencePath Condition="'$(AICLIExtensionReferencePath)' == ''">D:\src\ai-cli\src\ai\bin\Debug\net8.0</AICLIExtensionReferencePath>
</PropertyGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions ideas/template-generator/system.prompt.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ Are comprised of multiple project template files:

## `_.json` project template file:

`"_Name"` is the long descriptive name of the project template. This is required.
`"_LongName"` is the long descriptive name of the project template. This is required.

Example:

```json
{
"_Name": "OpenAI Chat Completions Class Library",
"_LongName": "OpenAI Chat Completions Class Library",
"ClassName": "OpenAIChatCompletionsClass",
"AICLIExtensionReferencePath": ""
}
Expand Down
13 changes: 7 additions & 6 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
# other app dependencies
ipykernel

# generative ai SDK dependencies
azure-ai-generative[evaluate,index,promptflow]
openai>1.0

azure_ai_resources @https://pkgs.dev.azure.com/azure-sdk/29ec6040-b234-4e31-b139-33dc4287b756/_packaging/3572dbf9-b5ef-433b-9137-fc4d7768e7cc/pypi/download/azure-ai-resources/1a20240207004/azure_ai_resources-1.0.0a20240207004-py3-none-any.whl
azure-ai-generative[evaluate,index,promptflow] @https://pkgs.dev.azure.com/azure-sdk/29ec6040-b234-4e31-b139-33dc4287b756/_packaging/3572dbf9-b5ef-433b-9137-fc4d7768e7cc/pypi/download/azure-ai-generative/1a20240207004/azure_ai_generative-1.0.0a20240207004-py3-none-any.whl
keyrings.alt # This is for promptflow

# hardcoded the version of azureml-mlflow here for faster Docker image building speed
azureml-mlflow==1.53.0
pytest

# langchain dependencies, these should be optional in the future
# langchain moved Embeddings from langchain.embeddings.base to langchain.schema.embeddings while azureml-rag is still referencing it.
# once azureml-rag fixes, we should remove the langchain reference from this file
langchain==0.0.324
langchain==0.1.1
langchain-openai==0.0.2.post1
semantic-kernel
Loading

0 comments on commit b2d6f3e

Please sign in to comment.