diff --git a/.github/workflows/sdk-endpoints-online-llm-langchain-1_langchain_basic_deploy.yml b/.github/workflows/sdk-endpoints-online-llm-langchain-1_langchain_basic_deploy.yml new file mode 100644 index 0000000000..6f876f91e7 --- /dev/null +++ b/.github/workflows/sdk-endpoints-online-llm-langchain-1_langchain_basic_deploy.yml @@ -0,0 +1,75 @@ +# This code is autogenerated. +# Code is generated by running custom script: python3 readme.py +# Any manual changes to this file may cause incorrect behavior. +# Any manual changes will be overwritten if the code is regenerated. + +name: sdk-endpoints-online-llm-langchain-1_langchain_basic_deploy +# This file is created by sdk/python/readme.py. +# Please do not edit directly. +on: + workflow_dispatch: + schedule: + - cron: "40 2/12 * * *" + pull_request: + branches: + - main + paths: + - sdk/python/endpoints/online/llm/langchain/** + - .github/workflows/sdk-endpoints-online-llm-langchain-1_langchain_basic_deploy.yml + - sdk/python/dev-requirements.txt + - infra/bootstrapping/** + - sdk/python/setup.sh +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: check out repo + uses: actions/checkout@v2 + - name: setup python + uses: actions/setup-python@v2 + with: + python-version: "3.8" + - name: pip install notebook reqs + run: pip install -r sdk/python/dev-requirements.txt + - name: azure login + uses: azure/login@v1 + with: + creds: ${{secrets.AZUREML_CREDENTIALS}} + - name: bootstrap resources + run: | + echo '${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}'; + bash bootstrap.sh + working-directory: infra/bootstrapping + continue-on-error: false + - name: setup SDK + run: | + source "${{ github.workspace }}/infra/bootstrapping/sdk_helpers.sh"; + source "${{ github.workspace }}/infra/bootstrapping/init_environment.sh"; + bash setup.sh + working-directory: sdk/python + continue-on-error: true + - name: setup-cli + run: | + source "${{ github.workspace }}/infra/bootstrapping/sdk_helpers.sh"; + source "${{ github.workspace }}/infra/bootstrapping/init_environment.sh"; + bash setup.sh + working-directory: cli + continue-on-error: true + - name: run endpoints/online/llm/langchain/1_langchain_basic_deploy.ipynb + run: | + source "${{ github.workspace }}/infra/bootstrapping/sdk_helpers.sh"; + source "${{ github.workspace }}/infra/bootstrapping/init_environment.sh"; + bash "${{ github.workspace }}/infra/bootstrapping/sdk_helpers.sh" generate_workspace_config "../../.azureml/config.json"; + bash "${{ github.workspace }}/infra/bootstrapping/sdk_helpers.sh" replace_template_values "1_langchain_basic_deploy.ipynb"; + [ -f "../../.azureml/config" ] && cat "../../.azureml/config"; + papermill -k python 1_langchain_basic_deploy.ipynb 1_langchain_basic_deploy.output.ipynb + working-directory: sdk/python/endpoints/online/llm/langchain + - name: upload notebook's working folder as an artifact + if: ${{ always() }} + uses: actions/upload-artifact@v2 + with: + name: 1_langchain_basic_deploy + path: sdk/python/endpoints/online/llm/langchain diff --git a/.github/workflows/sdk-endpoints-online-llm-semantic-kernel-1_semantic_http_server.yml b/.github/workflows/sdk-endpoints-online-llm-semantic-kernel-1_semantic_http_server.yml new file mode 100644 index 0000000000..34aa764831 --- /dev/null +++ b/.github/workflows/sdk-endpoints-online-llm-semantic-kernel-1_semantic_http_server.yml @@ -0,0 +1,75 @@ +# This code is autogenerated. +# Code is generated by running custom script: python3 readme.py +# Any manual changes to this file may cause incorrect behavior. +# Any manual changes will be overwritten if the code is regenerated. + +name: sdk-endpoints-online-llm-semantic-kernel-1_semantic_http_server +# This file is created by sdk/python/readme.py. +# Please do not edit directly. +on: + workflow_dispatch: + schedule: + - cron: "45 9/12 * * *" + pull_request: + branches: + - main + paths: + - sdk/python/endpoints/online/llm/semantic-kernel/** + - .github/workflows/sdk-endpoints-online-llm-semantic-kernel-1_semantic_http_server.yml + - sdk/python/dev-requirements.txt + - infra/bootstrapping/** + - sdk/python/setup.sh +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: check out repo + uses: actions/checkout@v2 + - name: setup python + uses: actions/setup-python@v2 + with: + python-version: "3.8" + - name: pip install notebook reqs + run: pip install -r sdk/python/dev-requirements.txt + - name: azure login + uses: azure/login@v1 + with: + creds: ${{secrets.AZUREML_CREDENTIALS}} + - name: bootstrap resources + run: | + echo '${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}'; + bash bootstrap.sh + working-directory: infra/bootstrapping + continue-on-error: false + - name: setup SDK + run: | + source "${{ github.workspace }}/infra/bootstrapping/sdk_helpers.sh"; + source "${{ github.workspace }}/infra/bootstrapping/init_environment.sh"; + bash setup.sh + working-directory: sdk/python + continue-on-error: true + - name: setup-cli + run: | + source "${{ github.workspace }}/infra/bootstrapping/sdk_helpers.sh"; + source "${{ github.workspace }}/infra/bootstrapping/init_environment.sh"; + bash setup.sh + working-directory: cli + continue-on-error: true + - name: run endpoints/online/llm/semantic-kernel/1_semantic_http_server.ipynb + run: | + source "${{ github.workspace }}/infra/bootstrapping/sdk_helpers.sh"; + source "${{ github.workspace }}/infra/bootstrapping/init_environment.sh"; + bash "${{ github.workspace }}/infra/bootstrapping/sdk_helpers.sh" generate_workspace_config "../../.azureml/config.json"; + bash "${{ github.workspace }}/infra/bootstrapping/sdk_helpers.sh" replace_template_values "1_semantic_http_server.ipynb"; + [ -f "../../.azureml/config" ] && cat "../../.azureml/config"; + papermill -k python 1_semantic_http_server.ipynb 1_semantic_http_server.output.ipynb + working-directory: sdk/python/endpoints/online/llm/semantic-kernel + - name: upload notebook's working folder as an artifact + if: ${{ always() }} + uses: actions/upload-artifact@v2 + with: + name: 1_semantic_http_server + path: sdk/python/endpoints/online/llm/semantic-kernel diff --git a/sdk/python/.gitignore b/sdk/python/.gitignore index 8a58e0034b..491c7db505 100644 --- a/sdk/python/.gitignore +++ b/sdk/python/.gitignore @@ -1,2 +1,5 @@ .ipynb_checkpoints -*/.ipynb_checkpoints/* \ No newline at end of file +*/.ipynb_checkpoints/* + +# config files are required to use Semantic Kernel +!endpoints/online/llm/src/sk/skills/*/*/config.json \ No newline at end of file diff --git a/sdk/python/README.md b/sdk/python/README.md index 8bd244a11e..8cfc729a3b 100644 --- a/sdk/python/README.md +++ b/sdk/python/README.md @@ -1,4 +1,3 @@ - --- page_type: sample languages: @@ -50,11 +49,16 @@ Test Status is for branch - **_main_** |endpoints|batch|[imagenet-classifier-batch](endpoints/batch/deploy-models/imagenet-classifier/imagenet-classifier-batch.ipynb)|*no description*|[![imagenet-classifier-batch](https://github.com/Azure/azureml-examples/actions/workflows/sdk-endpoints-batch-deploy-models-imagenet-classifier-imagenet-classifier-batch.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-endpoints-batch-deploy-models-imagenet-classifier-imagenet-classifier-batch.yml)| |endpoints|batch|[imagenet-classifier-mlflow](endpoints/batch/deploy-models/imagenet-classifier/imagenet-classifier-mlflow.ipynb)|*no description*|[![imagenet-classifier-mlflow](https://github.com/Azure/azureml-examples/actions/workflows/sdk-endpoints-batch-deploy-models-imagenet-classifier-imagenet-classifier-mlflow.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-endpoints-batch-deploy-models-imagenet-classifier-imagenet-classifier-mlflow.yml)| |endpoints|batch|[mnist-batch](endpoints/batch/deploy-models/mnist-classifier/mnist-batch.ipynb)|Create and test batch endpoint and deployement|[![mnist-batch](https://github.com/Azure/azureml-examples/actions/workflows/sdk-endpoints-batch-deploy-models-mnist-classifier-mnist-batch.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-endpoints-batch-deploy-models-mnist-classifier-mnist-batch.yml)| +|endpoints|batch|[sdk-deploy-and-test](endpoints/batch/deploy-pipelines/batch-scoring-with-preprocessing/sdk-deploy-and-test.ipynb)|*no description*|[![sdk-deploy-and-test](https://github.com/Azure/azureml-examples/actions/workflows/sdk-endpoints-batch-deploy-pipelines-batch-scoring-with-preprocessing-sdk-deploy-and-test.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-endpoints-batch-deploy-pipelines-batch-scoring-with-preprocessing-sdk-deploy-and-test.yml)| +|endpoints|batch|[sdk-deploy-and-test](endpoints/batch/deploy-pipelines/hello-batch/sdk-deploy-and-test.ipynb)|*no description*|[![sdk-deploy-and-test](https://github.com/Azure/azureml-examples/actions/workflows/sdk-endpoints-batch-deploy-pipelines-hello-batch-sdk-deploy-and-test.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-endpoints-batch-deploy-pipelines-hello-batch-sdk-deploy-and-test.yml)| +|endpoints|batch|[sdk-deploy-and-test](endpoints/batch/deploy-pipelines/training-with-components/sdk-deploy-and-test.ipynb)|*no description*|[![sdk-deploy-and-test](https://github.com/Azure/azureml-examples/actions/workflows/sdk-endpoints-batch-deploy-pipelines-training-with-components-sdk-deploy-and-test.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-endpoints-batch-deploy-pipelines-training-with-components-sdk-deploy-and-test.yml)| |endpoints|online|[online-endpoints-custom-container-multimodel](endpoints/online/custom-container/online-endpoints-custom-container-multimodel.ipynb)|*no description*|[![online-endpoints-custom-container-multimodel](https://github.com/Azure/azureml-examples/actions/workflows/sdk-endpoints-online-custom-container-online-endpoints-custom-container-multimodel.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-endpoints-online-custom-container-online-endpoints-custom-container-multimodel.yml)| |endpoints|online|[online-endpoints-custom-container](endpoints/online/custom-container/online-endpoints-custom-container.ipynb)|Deploy a custom container as an online endpoint. Use web servers other than the default Python Flask server used by Azure ML without losing the benefits of Azure ML's built-in monitoring, scaling, alerting, and authentication.|[![online-endpoints-custom-container](https://github.com/Azure/azureml-examples/actions/workflows/sdk-endpoints-online-custom-container-online-endpoints-custom-container.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-endpoints-online-custom-container-online-endpoints-custom-container.yml)| |endpoints|online|[online-endpoints-triton-cc](endpoints/online/custom-container/triton/online-endpoints-triton-cc.ipynb)|Deploy a custom container as an online endpoint. Use web servers other than the default Python Flask server used by Azure ML without losing the benefits of Azure ML's built-in monitoring, scaling, alerting, and authentication.|[![online-endpoints-triton-cc](https://github.com/Azure/azureml-examples/actions/workflows/sdk-endpoints-online-custom-container-triton-online-endpoints-triton-cc.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-endpoints-online-custom-container-triton-online-endpoints-triton-cc.yml)| |endpoints|online|[kubernetes-online-endpoints-safe-rollout](endpoints/online/kubernetes/kubernetes-online-endpoints-safe-rollout.ipynb)|Safely rollout a new version of a web service to production by rolling out the change to a small subset of users/requests before rolling it out completely|[![kubernetes-online-endpoints-safe-rollout](https://github.com/Azure/azureml-examples/actions/workflows/sdk-endpoints-online-kubernetes-kubernetes-online-endpoints-safe-rollout.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-endpoints-online-kubernetes-kubernetes-online-endpoints-safe-rollout.yml)| |endpoints|online|[kubernetes-online-endpoints-simple-deployment](endpoints/online/kubernetes/kubernetes-online-endpoints-simple-deployment.ipynb)|Use an online endpoint to deploy your model, so you don't have to create and manage the underlying infrastructure|[![kubernetes-online-endpoints-simple-deployment](https://github.com/Azure/azureml-examples/actions/workflows/sdk-endpoints-online-kubernetes-kubernetes-online-endpoints-simple-deployment.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-endpoints-online-kubernetes-kubernetes-online-endpoints-simple-deployment.yml)| +|endpoints|online|[1_langchain_basic_deploy](endpoints/online/llm/langchain/1_langchain_basic_deploy.ipynb)|Use an online endpoint to deploy a Langchain application, combining the power of LLMs with Azure ML's inferencing management.|[![1_langchain_basic_deploy](https://github.com/Azure/azureml-examples/actions/workflows/sdk-endpoints-online-llm-langchain-1_langchain_basic_deploy.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-endpoints-online-llm-langchain-1_langchain_basic_deploy.yml)| +|endpoints|online|[1_semantic_http_server](endpoints/online/llm/semantic-kernel/1_semantic_http_server.ipynb)|Use an online endpoint to deploy a Semantic Kernel application, combining the power of LLMs with Azure ML's inferencing management.|[![1_semantic_http_server](https://github.com/Azure/azureml-examples/actions/workflows/sdk-endpoints-online-llm-semantic-kernel-1_semantic_http_server.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-endpoints-online-llm-semantic-kernel-1_semantic_http_server.yml)| |endpoints|online|[debug-online-endpoints-locally-in-visual-studio-code](endpoints/online/managed/debug-online-endpoints-locally-in-visual-studio-code.ipynb)|*no description* - _This sample is excluded from automated tests_|[![debug-online-endpoints-locally-in-visual-studio-code](https://github.com/Azure/azureml-examples/actions/workflows/sdk-endpoints-online-managed-debug-online-endpoints-locally-in-visual-studio-code.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-endpoints-online-managed-debug-online-endpoints-locally-in-visual-studio-code.yml)| |endpoints|online|[online-endpoints-managed-identity-sai](endpoints/online/managed/managed-identities/online-endpoints-managed-identity-sai.ipynb)|*no description*|[![online-endpoints-managed-identity-sai](https://github.com/Azure/azureml-examples/actions/workflows/sdk-endpoints-online-managed-managed-identities-online-endpoints-managed-identity-sai.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-endpoints-online-managed-managed-identities-online-endpoints-managed-identity-sai.yml)| |endpoints|online|[online-endpoints-managed-identity-uai](endpoints/online/managed/managed-identities/online-endpoints-managed-identity-uai.ipynb)|*no description*|[![online-endpoints-managed-identity-uai](https://github.com/Azure/azureml-examples/actions/workflows/sdk-endpoints-online-managed-managed-identities-online-endpoints-managed-identity-uai.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-endpoints-online-managed-managed-identities-online-endpoints-managed-identity-uai.yml)| @@ -68,10 +72,65 @@ Test Status is for branch - **_main_** |endpoints|online|[online-endpoints-deploy-mlflow-model-with-script](endpoints/online/mlflow/online-endpoints-deploy-mlflow-model-with-script.ipynb)|Deploy an mlflow model to an online endpoint. This will be a no-code-deployment. It doesn't require scoring script and environment.|[![online-endpoints-deploy-mlflow-model-with-script](https://github.com/Azure/azureml-examples/actions/workflows/sdk-endpoints-online-mlflow-online-endpoints-deploy-mlflow-model-with-script.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-endpoints-online-mlflow-online-endpoints-deploy-mlflow-model-with-script.yml)| |endpoints|online|[online-endpoints-deploy-mlflow-model](endpoints/online/mlflow/online-endpoints-deploy-mlflow-model.ipynb)|Deploy an mlflow model to an online endpoint. This will be a no-code-deployment. It doesn't require scoring script and environment.|[![online-endpoints-deploy-mlflow-model](https://github.com/Azure/azureml-examples/actions/workflows/sdk-endpoints-online-mlflow-online-endpoints-deploy-mlflow-model.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-endpoints-online-mlflow-online-endpoints-deploy-mlflow-model.yml)| |endpoints|online|[online-endpoints-triton](endpoints/online/triton/single-model/online-endpoints-triton.ipynb)|Deploy a custom container as an online endpoint. Use web servers other than the default Python Flask server used by Azure ML without losing the benefits of Azure ML's built-in monitoring, scaling, alerting, and authentication.|[![online-endpoints-triton](https://github.com/Azure/azureml-examples/actions/workflows/sdk-endpoints-online-triton-single-model-online-endpoints-triton.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-endpoints-online-triton-single-model-online-endpoints-triton.yml)| +|featurestore_sample|notebooks|[1. Develop a feature set and register with managed feature store](featurestore_sample/notebooks/sdk_and_cli/1. Develop a feature set and register with managed feature store.ipynb)|*no description*|[![1. Develop a feature set and register with managed feature store](https://github.com/Azure/azureml-examples/actions/workflows/sdk-featurestore_sample-notebooks-sdk_and_cli-1. Develop a feature set and register with managed feature store.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-featurestore_sample-notebooks-sdk_and_cli-1. Develop a feature set and register with managed feature store.yml)| +|featurestore_sample|notebooks|[2. Enable materialization and backfill feature data](featurestore_sample/notebooks/sdk_and_cli/2. Enable materialization and backfill feature data.ipynb)|*no description*|[![2. Enable materialization and backfill feature data](https://github.com/Azure/azureml-examples/actions/workflows/sdk-featurestore_sample-notebooks-sdk_and_cli-2. Enable materialization and backfill feature data.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-featurestore_sample-notebooks-sdk_and_cli-2. Enable materialization and backfill feature data.yml)| +|featurestore_sample|notebooks|[3. Experiment and train models using features](featurestore_sample/notebooks/sdk_and_cli/3. Experiment and train models using features.ipynb)|*no description*|[![3. Experiment and train models using features](https://github.com/Azure/azureml-examples/actions/workflows/sdk-featurestore_sample-notebooks-sdk_and_cli-3. Experiment and train models using features.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-featurestore_sample-notebooks-sdk_and_cli-3. Experiment and train models using features.yml)| +|featurestore_sample|notebooks|[4. Enable recurrent materialization and run batch inference](featurestore_sample/notebooks/sdk_and_cli/4. Enable recurrent materialization and run batch inference.ipynb)|*no description*|[![4. Enable recurrent materialization and run batch inference](https://github.com/Azure/azureml-examples/actions/workflows/sdk-featurestore_sample-notebooks-sdk_and_cli-4. Enable recurrent materialization and run batch inference.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-featurestore_sample-notebooks-sdk_and_cli-4. Enable recurrent materialization and run batch inference.yml)| +|featurestore_sample|notebooks|[Network Isolation for Feature store](featurestore_sample/notebooks/sdk_and_cli/network_isolation/Network Isolation for Feature store.ipynb)|*no description*|[![Network Isolation for Feature store](https://github.com/Azure/azureml-examples/actions/workflows/sdk-featurestore_sample-notebooks-sdk_and_cli-network_isolation-Network Isolation for Feature store.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-featurestore_sample-notebooks-sdk_and_cli-network_isolation-Network Isolation for Feature store.yml)| +|featurestore_sample|notebooks|[1. Develop a feature set and register with managed feature store](featurestore_sample/notebooks/sdk_only/1. Develop a feature set and register with managed feature store.ipynb)|*no description*|[![1. Develop a feature set and register with managed feature store](https://github.com/Azure/azureml-examples/actions/workflows/sdk-featurestore_sample-notebooks-sdk_only-1. Develop a feature set and register with managed feature store.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-featurestore_sample-notebooks-sdk_only-1. Develop a feature set and register with managed feature store.yml)| +|featurestore_sample|notebooks|[2. Enable materialization and backfill feature data](featurestore_sample/notebooks/sdk_only/2. Enable materialization and backfill feature data.ipynb)|*no description*|[![2. Enable materialization and backfill feature data](https://github.com/Azure/azureml-examples/actions/workflows/sdk-featurestore_sample-notebooks-sdk_only-2. Enable materialization and backfill feature data.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-featurestore_sample-notebooks-sdk_only-2. Enable materialization and backfill feature data.yml)| +|featurestore_sample|notebooks|[3. Experiment and train models using features](featurestore_sample/notebooks/sdk_only/3. Experiment and train models using features.ipynb)|*no description*|[![3. Experiment and train models using features](https://github.com/Azure/azureml-examples/actions/workflows/sdk-featurestore_sample-notebooks-sdk_only-3. Experiment and train models using features.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-featurestore_sample-notebooks-sdk_only-3. Experiment and train models using features.yml)| +|featurestore_sample|notebooks|[4. Enable recurrent materialization and run batch inference](featurestore_sample/notebooks/sdk_only/4. Enable recurrent materialization and run batch inference.ipynb)|*no description*|[![4. Enable recurrent materialization and run batch inference](https://github.com/Azure/azureml-examples/actions/workflows/sdk-featurestore_sample-notebooks-sdk_only-4. Enable recurrent materialization and run batch inference.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-featurestore_sample-notebooks-sdk_only-4. Enable recurrent materialization and run batch inference.yml)| |foundation-models|azure_openai|[openai_completions_finetune](foundation-models/azure_openai/openai_completions_finetune.ipynb)|*no description*|[![openai_completions_finetune](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-azure_openai-openai_completions_finetune.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-azure_openai-openai_completions_finetune.yml)| +|foundation-models|huggingface|[question-answering-online-endpoint](foundation-models/huggingface/inference/question-answering/question-answering-online-endpoint.ipynb)|*no description*|[![question-answering-online-endpoint](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-huggingface-inference-question-answering-question-answering-online-endpoint.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-huggingface-inference-question-answering-question-answering-online-endpoint.yml)| +|foundation-models|huggingface|[text-generation-streaming-online-endpoint](foundation-models/huggingface/inference/text-generation-streaming/text-generation-streaming-online-endpoint.ipynb)|*no description*|[![text-generation-streaming-online-endpoint](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-huggingface-inference-text-generation-streaming-text-generation-streaming-online-endpoint.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-huggingface-inference-text-generation-streaming-text-generation-streaming-online-endpoint.yml)| +|foundation-models|huggingface|[token-classification-online-endpoint](foundation-models/huggingface/inference/token-classification/token-classification-online-endpoint.ipynb)|*no description*|[![token-classification-online-endpoint](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-huggingface-inference-token-classification-token-classification-online-endpoint.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-huggingface-inference-token-classification-token-classification-online-endpoint.yml)| +|foundation-models|huggingface|[translation-online-endpoint](foundation-models/huggingface/inference/translation/translation-online-endpoint.ipynb)|*no description*|[![translation-online-endpoint](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-huggingface-inference-translation-translation-online-endpoint.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-huggingface-inference-translation-translation-online-endpoint.yml)| +|foundation-models|huggingface|[zero-shot-classification-online-endpoint](foundation-models/huggingface/inference/zero-shot-classification/zero-shot-classification-online-endpoint.ipynb)|*no description*|[![zero-shot-classification-online-endpoint](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-huggingface-inference-zero-shot-classification-zero-shot-classification-online-endpoint.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-huggingface-inference-zero-shot-classification-zero-shot-classification-online-endpoint.yml)| +|foundation-models|system|[fill-mask](foundation-models/system/evaluation/fill-mask/fill-mask.ipynb)|*no description*|[![fill-mask](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-system-evaluation-fill-mask-fill-mask.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-system-evaluation-fill-mask-fill-mask.yml)| +|foundation-models|system|[question-answering](foundation-models/system/evaluation/question-answering/question-answering.ipynb)|*no description*|[![question-answering](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-system-evaluation-question-answering-question-answering.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-system-evaluation-question-answering-question-answering.yml)| +|foundation-models|system|[abstractive-and-extractive-summarization](foundation-models/system/evaluation/summarization/abstractive-and-extractive-summarization.ipynb)|*no description*|[![abstractive-and-extractive-summarization](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-system-evaluation-summarization-abstractive-and-extractive-summarization.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-system-evaluation-summarization-abstractive-and-extractive-summarization.yml)| +|foundation-models|system|[entailment-contradiction](foundation-models/system/evaluation/text-classification/entailment-contradiction.ipynb)|*no description*|[![entailment-contradiction](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-system-evaluation-text-classification-entailment-contradiction.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-system-evaluation-text-classification-entailment-contradiction.yml)| +|foundation-models|system|[sentiment-analysis](foundation-models/system/evaluation/text-classification/sentiment-analysis.ipynb)|*no description*|[![sentiment-analysis](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-system-evaluation-text-classification-sentiment-analysis.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-system-evaluation-text-classification-sentiment-analysis.yml)| +|foundation-models|system|[text-generation](foundation-models/system/evaluation/text-generation/text-generation.ipynb)|*no description*|[![text-generation](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-system-evaluation-text-generation-text-generation.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-system-evaluation-text-generation-text-generation.yml)| +|foundation-models|system|[news-articles-entity-recognition](foundation-models/system/evaluation/token-classification/news-articles-entity-recognition.ipynb)|*no description*|[![news-articles-entity-recognition](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-system-evaluation-token-classification-news-articles-entity-recognition.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-system-evaluation-token-classification-news-articles-entity-recognition.yml)| +|foundation-models|system|[translation-romanian-to-english](foundation-models/system/evaluation/translation/translation-romanian-to-english.ipynb)|*no description*|[![translation-romanian-to-english](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-system-evaluation-translation-translation-romanian-to-english.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-system-evaluation-translation-translation-romanian-to-english.yml)| +|foundation-models|system|[extractive-qa](foundation-models/system/finetune/question-answering/extractive-qa.ipynb)|*no description*|[![extractive-qa](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-system-finetune-question-answering-extractive-qa.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-system-finetune-question-answering-extractive-qa.yml)| +|foundation-models|system|[news-summary](foundation-models/system/finetune/summarization/news-summary.ipynb)|*no description*|[![news-summary](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-system-finetune-summarization-news-summary.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-system-finetune-summarization-news-summary.yml)| +|foundation-models|system|[emotion-detection](foundation-models/system/finetune/text-classification/emotion-detection.ipynb)|*no description*|[![emotion-detection](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-system-finetune-text-classification-emotion-detection.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-system-finetune-text-classification-emotion-detection.yml)| +|foundation-models|system|[token-classification](foundation-models/system/finetune/token-classification/token-classification.ipynb)|*no description*|[![token-classification](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-system-finetune-token-classification-token-classification.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-system-finetune-token-classification-token-classification.yml)| +|foundation-models|system|[translation](foundation-models/system/finetune/translation/translation.ipynb)|*no description*|[![translation](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-system-finetune-translation-translation.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-system-finetune-translation-translation.yml)| |foundation-models|system|[import_model_into_registry](foundation-models/system/import/import_model_into_registry.ipynb)|*no description*|[![import_model_into_registry](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-system-import-import_model_into_registry.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-system-import-import_model_into_registry.yml)| |foundation-models|system|[asr-batch-endpoint](foundation-models/system/inference/automatic-speech-recognition/asr-batch-endpoint.ipynb)|*no description*|[![asr-batch-endpoint](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-system-inference-automatic-speech-recognition-asr-batch-endpoint.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-system-inference-automatic-speech-recognition-asr-batch-endpoint.yml)| +|foundation-models|system|[asr-online-endpoint](foundation-models/system/inference/automatic-speech-recognition/asr-online-endpoint.ipynb)|*no description*|[![asr-online-endpoint](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-system-inference-automatic-speech-recognition-asr-online-endpoint.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-system-inference-automatic-speech-recognition-asr-online-endpoint.yml)| +|foundation-models|system|[fill-mask-batch-endpoint](foundation-models/system/inference/fill-mask/fill-mask-batch-endpoint.ipynb)|*no description*|[![fill-mask-batch-endpoint](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-system-inference-fill-mask-fill-mask-batch-endpoint.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-system-inference-fill-mask-fill-mask-batch-endpoint.yml)| +|foundation-models|system|[fill-mask-online-endpoint](foundation-models/system/inference/fill-mask/fill-mask-online-endpoint.ipynb)|*no description*|[![fill-mask-online-endpoint](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-system-inference-fill-mask-fill-mask-online-endpoint.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-system-inference-fill-mask-fill-mask-online-endpoint.yml)| +|foundation-models|system|[question-answering-batch-endpoint](foundation-models/system/inference/question-answering/question-answering-batch-endpoint.ipynb)|*no description*|[![question-answering-batch-endpoint](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-system-inference-question-answering-question-answering-batch-endpoint.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-system-inference-question-answering-question-answering-batch-endpoint.yml)| +|foundation-models|system|[question-answering-online-endpoint](foundation-models/system/inference/question-answering/question-answering-online-endpoint.ipynb)|*no description*|[![question-answering-online-endpoint](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-system-inference-question-answering-question-answering-online-endpoint.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-system-inference-question-answering-question-answering-online-endpoint.yml)| |foundation-models|system|[summarization-batch-endpoint](foundation-models/system/inference/summarization/summarization-batch-endpoint.ipynb)|*no description*|[![summarization-batch-endpoint](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-system-inference-summarization-summarization-batch-endpoint.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-system-inference-summarization-summarization-batch-endpoint.yml)| +|foundation-models|system|[summarization-online-endpoint](foundation-models/system/inference/summarization/summarization-online-endpoint.ipynb)|*no description*|[![summarization-online-endpoint](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-system-inference-summarization-summarization-online-endpoint.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-system-inference-summarization-summarization-online-endpoint.yml)| +|foundation-models|system|[entailment-contradiction-batch](foundation-models/system/inference/text-classification/entailment-contradiction-batch.ipynb)|*no description*|[![entailment-contradiction-batch](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-system-inference-text-classification-entailment-contradiction-batch.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-system-inference-text-classification-entailment-contradiction-batch.yml)| +|foundation-models|system|[text-classification-online-endpoint](foundation-models/system/inference/text-classification/text-classification-online-endpoint.ipynb)|*no description*|[![text-classification-online-endpoint](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-system-inference-text-classification-text-classification-online-endpoint.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-system-inference-text-classification-text-classification-online-endpoint.yml)| +|foundation-models|system|[llama-prepare-uai](foundation-models/system/inference/text-generation/llama-prepare-uai.ipynb)|*no description*|[![llama-prepare-uai](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-system-inference-text-generation-llama-prepare-uai.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-system-inference-text-generation-llama-prepare-uai.yml)| +|foundation-models|system|[llama-safe-batch-deployment](foundation-models/system/inference/text-generation/llama-safe-batch-deployment.ipynb)|*no description*|[![llama-safe-batch-deployment](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-system-inference-text-generation-llama-safe-batch-deployment.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-system-inference-text-generation-llama-safe-batch-deployment.yml)| +|foundation-models|system|[llama-safe-online-deployment](foundation-models/system/inference/text-generation/llama-safe-online-deployment.ipynb)|*no description*|[![llama-safe-online-deployment](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-system-inference-text-generation-llama-safe-online-deployment.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-system-inference-text-generation-llama-safe-online-deployment.yml)| +|foundation-models|system|[text-generation-batch-endpoint](foundation-models/system/inference/text-generation/text-generation-batch-endpoint.ipynb)|*no description*|[![text-generation-batch-endpoint](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-system-inference-text-generation-text-generation-batch-endpoint.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-system-inference-text-generation-text-generation-batch-endpoint.yml)| +|foundation-models|system|[text-generation-online-endpoint-dolly](foundation-models/system/inference/text-generation/text-generation-online-endpoint-dolly.ipynb)|*no description*|[![text-generation-online-endpoint-dolly](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-system-inference-text-generation-text-generation-online-endpoint-dolly.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-system-inference-text-generation-text-generation-online-endpoint-dolly.yml)| +|foundation-models|system|[text-generation-online-endpoint](foundation-models/system/inference/text-generation/text-generation-online-endpoint.ipynb)|*no description*|[![text-generation-online-endpoint](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-system-inference-text-generation-text-generation-online-endpoint.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-system-inference-text-generation-text-generation-online-endpoint.yml)| +|foundation-models|system|[token-classification-batch-endpoint](foundation-models/system/inference/token-classification/token-classification-batch-endpoint.ipynb)|*no description*|[![token-classification-batch-endpoint](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-system-inference-token-classification-token-classification-batch-endpoint.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-system-inference-token-classification-token-classification-batch-endpoint.yml)| +|foundation-models|system|[token-classification-online-endpoint](foundation-models/system/inference/token-classification/token-classification-online-endpoint.ipynb)|*no description*|[![token-classification-online-endpoint](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-system-inference-token-classification-token-classification-online-endpoint.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-system-inference-token-classification-token-classification-online-endpoint.yml)| +|foundation-models|system|[translation-batch-endpoint](foundation-models/system/inference/translation/translation-batch-endpoint.ipynb)|*no description*|[![translation-batch-endpoint](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-system-inference-translation-translation-batch-endpoint.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-system-inference-translation-translation-batch-endpoint.yml)| +|foundation-models|system|[translation-online-endpoint](foundation-models/system/inference/translation/translation-online-endpoint.ipynb)|*no description*|[![translation-online-endpoint](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-system-inference-translation-translation-online-endpoint.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-foundation-models-system-inference-translation-translation-online-endpoint.yml)| +|generative-ai|promptflow|[create_faiss_index](generative-ai/promptflow/create_faiss_index.ipynb)|*no description*|[![create_faiss_index](https://github.com/Azure/azureml-examples/actions/workflows/sdk-generative-ai-promptflow-create_faiss_index.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-generative-ai-promptflow-create_faiss_index.yml)| +|generative-ai|rag|[acs_mlindex_with_langchain](generative-ai/rag/notebooks/azure_cognitive_search/acs_mlindex_with_langchain.ipynb)|*no description*|[![acs_mlindex_with_langchain](https://github.com/Azure/azureml-examples/actions/workflows/sdk-generative-ai-rag-notebooks-azure_cognitive_search-acs_mlindex_with_langchain.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-generative-ai-rag-notebooks-azure_cognitive_search-acs_mlindex_with_langchain.yml)| +|generative-ai|rag|[s3_to_acs_mlindex_with_langchain](generative-ai/rag/notebooks/azure_cognitive_search/s3_to_acs_mlindex_with_langchain.ipynb)|*no description*|[![s3_to_acs_mlindex_with_langchain](https://github.com/Azure/azureml-examples/actions/workflows/sdk-generative-ai-rag-notebooks-azure_cognitive_search-s3_to_acs_mlindex_with_langchain.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-generative-ai-rag-notebooks-azure_cognitive_search-s3_to_acs_mlindex_with_langchain.yml)| +|generative-ai|rag|[db_copilot_with_rag](generative-ai/rag/notebooks/db_copilot_with_rag.ipynb)|*no description*|[![db_copilot_with_rag](https://github.com/Azure/azureml-examples/actions/workflows/sdk-generative-ai-rag-notebooks-db_copilot_with_rag.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-generative-ai-rag-notebooks-db_copilot_with_rag.yml)| +|generative-ai|rag|[faiss_mlindex_with_langchain](generative-ai/rag/notebooks/faiss/faiss_mlindex_with_langchain.ipynb)|*no description*|[![faiss_mlindex_with_langchain](https://github.com/Azure/azureml-examples/actions/workflows/sdk-generative-ai-rag-notebooks-faiss-faiss_mlindex_with_langchain.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-generative-ai-rag-notebooks-faiss-faiss_mlindex_with_langchain.yml)| +|generative-ai|rag|[scheduled_update_faiss_index](generative-ai/rag/notebooks/faiss/scheduled_update_faiss_index.ipynb)|*no description*|[![scheduled_update_faiss_index](https://github.com/Azure/azureml-examples/actions/workflows/sdk-generative-ai-rag-notebooks-faiss-scheduled_update_faiss_index.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-generative-ai-rag-notebooks-faiss-scheduled_update_faiss_index.yml)| +|generative-ai|rag|[url_to_faiss_incremental_embeddings_with_tabular_data](generative-ai/rag/notebooks/faiss/url_to_faiss_incremental_embeddings_with_tabular_data.ipynb)|*no description*|[![url_to_faiss_incremental_embeddings_with_tabular_data](https://github.com/Azure/azureml-examples/actions/workflows/sdk-generative-ai-rag-notebooks-faiss-url_to_faiss_incremental_embeddings_with_tabular_data.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-generative-ai-rag-notebooks-faiss-url_to_faiss_incremental_embeddings_with_tabular_data.yml)| +|generative-ai|rag|[mlindex_with_testgen_autoprompt](generative-ai/rag/notebooks/mlindex_with_testgen_autoprompt.ipynb)|*no description*|[![mlindex_with_testgen_autoprompt](https://github.com/Azure/azureml-examples/actions/workflows/sdk-generative-ai-rag-notebooks-mlindex_with_testgen_autoprompt.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-generative-ai-rag-notebooks-mlindex_with_testgen_autoprompt.yml)| +|generative-ai|rag|[qa_data_generation](generative-ai/rag/notebooks/qa_data_generation.ipynb)|*no description*|[![qa_data_generation](https://github.com/Azure/azureml-examples/actions/workflows/sdk-generative-ai-rag-notebooks-qa_data_generation.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-generative-ai-rag-notebooks-qa_data_generation.yml)| +|jobs|automl-standalone-jobs|[automl-classification-task-bankmarketing-serverless](jobs/automl-standalone-jobs/automl-classification-task-bankmarketing/automl-classification-task-bankmarketing-serverless.ipynb)|*no description*|[![automl-classification-task-bankmarketing-serverless](https://github.com/Azure/azureml-examples/actions/workflows/sdk-jobs-automl-standalone-jobs-automl-classification-task-bankmarketing-automl-classification-task-bankmarketing-serverless.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-jobs-automl-standalone-jobs-automl-classification-task-bankmarketing-automl-classification-task-bankmarketing-serverless.yml)| |jobs|automl-standalone-jobs|[automl-classification-task-bankmarketing](jobs/automl-standalone-jobs/automl-classification-task-bankmarketing/automl-classification-task-bankmarketing.ipynb)|*no description*|[![automl-classification-task-bankmarketing](https://github.com/Azure/azureml-examples/actions/workflows/sdk-jobs-automl-standalone-jobs-automl-classification-task-bankmarketing-automl-classification-task-bankmarketing.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-jobs-automl-standalone-jobs-automl-classification-task-bankmarketing-automl-classification-task-bankmarketing.yml)| |jobs|automl-standalone-jobs|[mlflow-model-local-inference-test](jobs/automl-standalone-jobs/automl-classification-task-bankmarketing/mlflow-model-local-inference-test.ipynb)|*no description* - _This sample is excluded from automated tests_|[![mlflow-model-local-inference-test](https://github.com/Azure/azureml-examples/actions/workflows/sdk-jobs-automl-standalone-jobs-automl-classification-task-bankmarketing-mlflow-model-local-inference-test.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-jobs-automl-standalone-jobs-automl-classification-task-bankmarketing-mlflow-model-local-inference-test.yml)| |jobs|automl-standalone-jobs|[automl-forecasting-distributed-tcn](jobs/automl-standalone-jobs/automl-forecasting-distributed-tcn/automl-forecasting-distributed-tcn.ipynb)|*no description*|[![automl-forecasting-distributed-tcn](https://github.com/Azure/azureml-examples/actions/workflows/sdk-jobs-automl-standalone-jobs-automl-forecasting-distributed-tcn-automl-forecasting-distributed-tcn.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-jobs-automl-standalone-jobs-automl-forecasting-distributed-tcn-automl-forecasting-distributed-tcn.yml)| @@ -106,6 +165,7 @@ Test Status is for branch - **_main_** |jobs|parallel|[iris_batch_prediction](jobs/parallel/2a_iris_batch_prediction/iris_batch_prediction.ipynb)|Create pipeline with parallel node to do batch inference|[![iris_batch_prediction](https://github.com/Azure/azureml-examples/actions/workflows/sdk-jobs-parallel-2a_iris_batch_prediction-iris_batch_prediction.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-jobs-parallel-2a_iris_batch_prediction-iris_batch_prediction.yml)| |jobs|parallel|[mnist_batch_prediction](jobs/parallel/3a_mnist_batch_identification/mnist_batch_prediction.ipynb)|Create pipeline with parallel node to do batch inference|[![mnist_batch_prediction](https://github.com/Azure/azureml-examples/actions/workflows/sdk-jobs-parallel-3a_mnist_batch_identification-mnist_batch_prediction.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-jobs-parallel-3a_mnist_batch_identification-mnist_batch_prediction.yml)| |jobs|pipelines|[pipeline_with_components_from_yaml](jobs/pipelines/1a_pipeline_with_components_from_yaml/pipeline_with_components_from_yaml.ipynb)|Create pipeline with CommandComponents from local YAML file|[![pipeline_with_components_from_yaml](https://github.com/Azure/azureml-examples/actions/workflows/sdk-jobs-pipelines-1a_pipeline_with_components_from_yaml-pipeline_with_components_from_yaml.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-jobs-pipelines-1a_pipeline_with_components_from_yaml-pipeline_with_components_from_yaml.yml)| +|jobs|pipelines|[pipeline_with_components_from_yaml_serverless](jobs/pipelines/1a_pipeline_with_components_from_yaml/pipeline_with_components_from_yaml_serverless.ipynb)|Create pipeline with CommandComponents from local YAML file|[![pipeline_with_components_from_yaml_serverless](https://github.com/Azure/azureml-examples/actions/workflows/sdk-jobs-pipelines-1a_pipeline_with_components_from_yaml-pipeline_with_components_from_yaml_serverless.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-jobs-pipelines-1a_pipeline_with_components_from_yaml-pipeline_with_components_from_yaml_serverless.yml)| |jobs|pipelines|[pipeline_with_python_function_components](jobs/pipelines/1b_pipeline_with_python_function_components/pipeline_with_python_function_components.ipynb)|Create pipeline with command_component decorator|[![pipeline_with_python_function_components](https://github.com/Azure/azureml-examples/actions/workflows/sdk-jobs-pipelines-1b_pipeline_with_python_function_components-pipeline_with_python_function_components.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-jobs-pipelines-1b_pipeline_with_python_function_components-pipeline_with_python_function_components.yml)| |jobs|pipelines|[pipeline_with_hyperparameter_sweep](jobs/pipelines/1c_pipeline_with_hyperparameter_sweep/pipeline_with_hyperparameter_sweep.ipynb)|Use sweep (hyperdrive) in pipeline to train mnist model using tensorflow|[![pipeline_with_hyperparameter_sweep](https://github.com/Azure/azureml-examples/actions/workflows/sdk-jobs-pipelines-1c_pipeline_with_hyperparameter_sweep-pipeline_with_hyperparameter_sweep.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-jobs-pipelines-1c_pipeline_with_hyperparameter_sweep-pipeline_with_hyperparameter_sweep.yml)| |jobs|pipelines|[pipeline_with_non_python_components](jobs/pipelines/1d_pipeline_with_non_python_components/pipeline_with_non_python_components.ipynb)|Create a pipeline with command function|[![pipeline_with_non_python_components](https://github.com/Azure/azureml-examples/actions/workflows/sdk-jobs-pipelines-1d_pipeline_with_non_python_components-pipeline_with_non_python_components.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-jobs-pipelines-1d_pipeline_with_non_python_components-pipeline_with_non_python_components.yml)| @@ -121,7 +181,7 @@ Test Status is for branch - **_main_** |jobs|pipelines|[automl-text-classification-in-pipeline](jobs/pipelines/1h_automl_in_pipeline/automl-text-classification-in-pipeline/automl-text-classification-in-pipeline.ipynb)|Create pipeline with automl node|[![automl-text-classification-in-pipeline](https://github.com/Azure/azureml-examples/actions/workflows/sdk-jobs-pipelines-1h_automl_in_pipeline-automl-text-classification-in-pipeline-automl-text-classification-in-pipeline.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-jobs-pipelines-1h_automl_in_pipeline-automl-text-classification-in-pipeline-automl-text-classification-in-pipeline.yml)| |jobs|pipelines|[automl-text-classification-multilabel-in-pipeline](jobs/pipelines/1h_automl_in_pipeline/automl-text-classification-multilabel-in-pipeline/automl-text-classification-multilabel-in-pipeline.ipynb)|Create pipeline with automl node|[![automl-text-classification-multilabel-in-pipeline](https://github.com/Azure/azureml-examples/actions/workflows/sdk-jobs-pipelines-1h_automl_in_pipeline-automl-text-classification-multilabel-in-pipeline-automl-text-classification-multilabel-in-pipeline.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-jobs-pipelines-1h_automl_in_pipeline-automl-text-classification-multilabel-in-pipeline-automl-text-classification-multilabel-in-pipeline.yml)| |jobs|pipelines|[automl-text-ner-named-entity-recognition-in-pipeline](jobs/pipelines/1h_automl_in_pipeline/automl-text-ner-named-entity-recognition-in-pipeline/automl-text-ner-named-entity-recognition-in-pipeline.ipynb)|Create pipeline with automl node|[![automl-text-ner-named-entity-recognition-in-pipeline](https://github.com/Azure/azureml-examples/actions/workflows/sdk-jobs-pipelines-1h_automl_in_pipeline-automl-text-ner-named-entity-recognition-in-pipeline-automl-text-ner-named-entity-recognition-in-pipeline.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-jobs-pipelines-1h_automl_in_pipeline-automl-text-ner-named-entity-recognition-in-pipeline-automl-text-ner-named-entity-recognition-in-pipeline.yml)| -|jobs|pipelines|[pipeline_with_spark_nodes](jobs/pipelines/1i_pipeline_with_spark_nodes/pipeline_with_spark_nodes.ipynb)|Create pipeline with spark node - _This sample is excluded from automated tests_|[![pipeline_with_spark_nodes](https://github.com/Azure/azureml-examples/actions/workflows/sdk-jobs-pipelines-1i_pipeline_with_spark_nodes-pipeline_with_spark_nodes.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-jobs-pipelines-1i_pipeline_with_spark_nodes-pipeline_with_spark_nodes.yml)| +|jobs|pipelines|[pipeline_with_spark_nodes](jobs/pipelines/1i_pipeline_with_spark_nodes/pipeline_with_spark_nodes.ipynb)|Create pipeline with spark node|[![pipeline_with_spark_nodes](https://github.com/Azure/azureml-examples/actions/workflows/sdk-jobs-pipelines-1i_pipeline_with_spark_nodes-pipeline_with_spark_nodes.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-jobs-pipelines-1i_pipeline_with_spark_nodes-pipeline_with_spark_nodes.yml)| |jobs|pipelines|[nyc_taxi_data_regression_with_pipeline_component](jobs/pipelines/1j_pipeline_with_pipeline_component/nyc_taxi_data_regression_with_pipeline_component/nyc_taxi_data_regression_with_pipeline_component.ipynb)|Create pipeline with CommandComponents from local YAML file|[![nyc_taxi_data_regression_with_pipeline_component](https://github.com/Azure/azureml-examples/actions/workflows/sdk-jobs-pipelines-1j_pipeline_with_pipeline_component-nyc_taxi_data_regression_with_pipeline_component-nyc_taxi_data_regression_with_pipeline_component.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-jobs-pipelines-1j_pipeline_with_pipeline_component-nyc_taxi_data_regression_with_pipeline_component-nyc_taxi_data_regression_with_pipeline_component.yml)| |jobs|pipelines|[pipeline_with_train_eval_pipeline_component](jobs/pipelines/1j_pipeline_with_pipeline_component/pipeline_with_train_eval_pipeline_component/pipeline_with_train_eval_pipeline_component.ipynb)|Create pipeline with CommandComponents from local YAML file|[![pipeline_with_train_eval_pipeline_component](https://github.com/Azure/azureml-examples/actions/workflows/sdk-jobs-pipelines-1j_pipeline_with_pipeline_component-pipeline_with_train_eval_pipeline_component-pipeline_with_train_eval_pipeline_component.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-jobs-pipelines-1j_pipeline_with_pipeline_component-pipeline_with_train_eval_pipeline_component-pipeline_with_train_eval_pipeline_component.yml)| |jobs|pipelines|[automl-forecasting-demand-hierarchical-timeseries-in-pipeline](jobs/pipelines/1k_demand_forecasting_with_pipeline_components/automl-forecasting-demand-hierarchical-timeseries-in-pipeline/automl-forecasting-demand-hierarchical-timeseries-in-pipeline.ipynb)|*no description*|[![automl-forecasting-demand-hierarchical-timeseries-in-pipeline](https://github.com/Azure/azureml-examples/actions/workflows/sdk-jobs-pipelines-1k_demand_forecasting_with_pipeline_components-automl-forecasting-demand-hierarchical-timeseries-in-pipeline-automl-forecasting-demand-hierarchical-timeseries-in-pipeline.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-jobs-pipelines-1k_demand_forecasting_with_pipeline_components-automl-forecasting-demand-hierarchical-timeseries-in-pipeline-automl-forecasting-demand-hierarchical-timeseries-in-pipeline.yml)| @@ -148,9 +208,11 @@ Test Status is for branch - **_main_** |jobs|single-step|[tensorflow-mnist](jobs/single-step/tensorflow/mnist/tensorflow-mnist.ipynb)|Run a Command to train a basic neural network with TensorFlow on the MNIST dataset|[![tensorflow-mnist](https://github.com/Azure/azureml-examples/actions/workflows/sdk-jobs-single-step-tensorflow-mnist-tensorflow-mnist.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-jobs-single-step-tensorflow-mnist-tensorflow-mnist.yml)| |jobs|single-step|[train-hyperparameter-tune-deploy-with-keras](jobs/single-step/tensorflow/train-hyperparameter-tune-deploy-with-keras/train-hyperparameter-tune-deploy-with-keras.ipynb)|Train, hyperparameter tune, and deploy a Keras model to classify handwritten digits using a deep neural network (DNN). - _This sample is excluded from automated tests_|[![train-hyperparameter-tune-deploy-with-keras](https://github.com/Azure/azureml-examples/actions/workflows/sdk-jobs-single-step-tensorflow-train-hyperparameter-tune-deploy-with-keras-train-hyperparameter-tune-deploy-with-keras.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-jobs-single-step-tensorflow-train-hyperparameter-tune-deploy-with-keras-train-hyperparameter-tune-deploy-with-keras.yml)| |jobs|single-step|[train-hyperparameter-tune-deploy-with-tensorflow](jobs/single-step/tensorflow/train-hyperparameter-tune-deploy-with-tensorflow/train-hyperparameter-tune-deploy-with-tensorflow.ipynb)|Train, hyperparameter tune, and deploy a Tensorflow model to classify handwritten digits using a deep neural network (DNN). - _This sample is excluded from automated tests_|[![train-hyperparameter-tune-deploy-with-tensorflow](https://github.com/Azure/azureml-examples/actions/workflows/sdk-jobs-single-step-tensorflow-train-hyperparameter-tune-deploy-with-tensorflow-train-hyperparameter-tune-deploy-with-tensorflow.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-jobs-single-step-tensorflow-train-hyperparameter-tune-deploy-with-tensorflow-train-hyperparameter-tune-deploy-with-tensorflow.yml)| -|jobs|spark|[submit_spark_pipeline_jobs](jobs/spark/submit_spark_pipeline_jobs.ipynb)|*no description* - _This sample is excluded from automated tests_|[![submit_spark_pipeline_jobs](https://github.com/Azure/azureml-examples/actions/workflows/sdk-jobs-spark-submit_spark_pipeline_jobs.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-jobs-spark-submit_spark_pipeline_jobs.yml)| -|jobs|spark|[submit_spark_standalone_jobs](jobs/spark/submit_spark_standalone_jobs.ipynb)|*no description* - _This sample is excluded from automated tests_|[![submit_spark_standalone_jobs](https://github.com/Azure/azureml-examples/actions/workflows/sdk-jobs-spark-submit_spark_standalone_jobs.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-jobs-spark-submit_spark_standalone_jobs.yml)| -|resources|compute|[attach_manage_spark_pools](resources/compute/attach_manage_spark_pools.ipynb)|*no description* - _This sample is excluded from automated tests_|[![attach_manage_spark_pools](https://github.com/Azure/azureml-examples/actions/workflows/sdk-resources-compute-attach_manage_spark_pools.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-resources-compute-attach_manage_spark_pools.yml)| +|jobs|spark|[run_interactive_session_notebook](jobs/spark/automation/run_interactive_session_notebook.ipynb)|*no description*|[![run_interactive_session_notebook](https://github.com/Azure/azureml-examples/actions/workflows/sdk-jobs-spark-automation-run_interactive_session_notebook.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-jobs-spark-automation-run_interactive_session_notebook.yml)| +|jobs|spark|[submit_spark_pipeline_jobs](jobs/spark/submit_spark_pipeline_jobs.ipynb)|*no description*|[![submit_spark_pipeline_jobs](https://github.com/Azure/azureml-examples/actions/workflows/sdk-jobs-spark-submit_spark_pipeline_jobs.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-jobs-spark-submit_spark_pipeline_jobs.yml)| +|jobs|spark|[submit_spark_standalone_jobs](jobs/spark/submit_spark_standalone_jobs.ipynb)|*no description*|[![submit_spark_standalone_jobs](https://github.com/Azure/azureml-examples/actions/workflows/sdk-jobs-spark-submit_spark_standalone_jobs.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-jobs-spark-submit_spark_standalone_jobs.yml)| +|jobs|spark|[submit_spark_standalone_jobs_managed_vnet](jobs/spark/submit_spark_standalone_jobs_managed_vnet.ipynb)|*no description*|[![submit_spark_standalone_jobs_managed_vnet](https://github.com/Azure/azureml-examples/actions/workflows/sdk-jobs-spark-submit_spark_standalone_jobs_managed_vnet.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-jobs-spark-submit_spark_standalone_jobs_managed_vnet.yml)| +|resources|compute|[attach_manage_spark_pools](resources/compute/attach_manage_spark_pools.ipynb)|*no description*|[![attach_manage_spark_pools](https://github.com/Azure/azureml-examples/actions/workflows/sdk-resources-compute-attach_manage_spark_pools.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-resources-compute-attach_manage_spark_pools.yml)| |resources|compute|[compute](resources/compute/compute.ipynb)|Create compute in Azure ML workspace|[![compute](https://github.com/Azure/azureml-examples/actions/workflows/sdk-resources-compute-compute.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-resources-compute-compute.yml)| |resources|connections|[connections](resources/connections/connections.ipynb)|*no description*|[![connections](https://github.com/Azure/azureml-examples/actions/workflows/sdk-resources-connections-connections.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-resources-connections-connections.yml)| |resources|datastores|[datastore](resources/datastores/datastore.ipynb)|Create datastores and use in a Command - _This sample is excluded from automated tests_|[![datastore](https://github.com/Azure/azureml-examples/actions/workflows/sdk-resources-datastores-datastore.yml/badge.svg?branch=main)](https://github.com/Azure/azureml-examples/actions/workflows/sdk-resources-datastores-datastore.yml)| diff --git a/sdk/python/endpoints/online/llm/langchain/1_langchain_basic_deploy.ipynb b/sdk/python/endpoints/online/llm/langchain/1_langchain_basic_deploy.ipynb new file mode 100644 index 0000000000..d2639f9302 --- /dev/null +++ b/sdk/python/endpoints/online/llm/langchain/1_langchain_basic_deploy.ipynb @@ -0,0 +1,483 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Langchain Integration into Azure Machine Learning (AzureML)\n", + "\n", + "**Requirements** - In order to benefit from this tutorial, you will need:\n", + "* A basic understanding of Machine Learning and Large Language Models\n", + "* An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F)\n", + "* An Azure Machine Learning Workspace, Azure Key Vault, and Azure Container Registry\n", + "* An OpenAI API Key which can be found in User Settings in OpenAI\n", + "\n", + "**Motivations** - The Langchain framework allows for rapid development of applications powered by large language models. This sample creates a chat bot application backed by a large language model and deploys the application to AzureML.\n", + "\n", + "**Outline** - \n", + "1. Prepare the required resources\n", + "2. Deploy the app to an **AzureML Managed Online Endpoint**\n", + "3. Test\n" + ] + }, + { + "attachments": {}, + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# 1. Connect to Azure Machine Learning\n", + "Before deploy, you could test the langchain app locally. We are using [Langchain ChatGPT plugin](https://python.langchain.com/en/latest/modules/agents/tools/examples/chatgpt_plugins.html) as an example app here. Execute the code below to try out. You can inspect the [simple_agent_app_test.py](../src/langchain/simple_agent_app_test.py) to see the implementation itself. It's a langchain ZERO_SHOT_REACT_DESCRIPTION agent with Klarna plugin." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "OPENAI_API_TYPE = \"openai\" # 'azure' or 'openai'\n", + "OPENAI_API_KEY = \"\"\n", + "\n", + "# required for OpenAI API\n", + "OPENAI_ORG_ID = \"\"\n", + "OPENAI_MODEL_ID = \"gpt-3.5-turbo\"\n", + "\n", + "# required for Azure OpenAI API\n", + "AZURE_OPENAI_API_ENDPOINT = \"\"\n", + "AZURE_OPENAI_API_DEPLOYMENT_NAME = \"\"\n", + "\n", + "# set to env var for the langchain code to consume\n", + "%env OPENAI_API_KEY=$OPENAI_API_KEY\n", + "%env OPENAI_API_TYPE=$OPENAI_API_TYPE\n", + "%env OPENAI_MODEL_ID=$OPENAI_MODEL_ID\n", + "%env OPENAI_ORG_ID=$OPENAI_ORG_ID\n", + "%env AZURE_OPENAI_API_ENDPOINT=$AZURE_OPENAI_API_ENDPOINT\n", + "%env AZURE_OPENAI_API_DEPLOYMENT_NAME=$AZURE_OPENAI_API_DEPLOYMENT_NAME" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### 1.1 Install required packages" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "%pip install -r requirements.txt" + ] + }, + { + "attachments": {}, + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### 1.2 Set workspace details" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# enter details of your AML workspace\n", + "SUBSCRIPTION_ID = \"\"\n", + "RESOURCE_GROUP = \"\"\n", + "AML_WORKSPACE_NAME = \"\"" + ] + }, + { + "attachments": {}, + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### 1.3 Login to your Azure account" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Authenticate clients\n", + "from azure.identity import (\n", + " DefaultAzureCredential,\n", + " InteractiveBrowserCredential,\n", + " AzureCliCredential,\n", + ")\n", + "\n", + "try:\n", + " credential = DefaultAzureCredential(additionally_allowed_tenants=[\"*\"])\n", + "except Exception as ex:\n", + " # Fall back to InteractiveBrowserCredential in case DefaultAzureCredential not work\n", + " credential = InteractiveBrowserCredential(additionally_allowed_tenants=[\"*\"])\n", + "\n", + "# If login doesn't work above, uncomment the code below and login using device code\n", + "# !az login --use-device-code" + ] + }, + { + "attachments": {}, + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# 2. Managed Online Endpoint\n", + "### 2.1 Create Endpoint" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# create a endpoint\n", + "from azure.ai.ml.entities import (\n", + " ManagedOnlineEndpoint,\n", + ")\n", + "\n", + "from azure.ai.ml import (\n", + " MLClient,\n", + ")\n", + "\n", + "online_endpoint_name = \"aml-llm-demo-langchain-endpoint\"\n", + "\n", + "# get a handle to the workspace\n", + "ml_client = MLClient(credential, SUBSCRIPTION_ID, RESOURCE_GROUP, AML_WORKSPACE_NAME)\n", + "\n", + "# create an online endpoint\n", + "endpoint = ManagedOnlineEndpoint(\n", + " name=online_endpoint_name,\n", + " description=\"online endpoint for Langchain server\",\n", + " auth_mode=\"key\",\n", + ")\n", + "\n", + "endpoint = ml_client.begin_create_or_update(endpoint).result()\n", + "\n", + "print(endpoint)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# 3. Store the API Key in KeyVault\n", + "\n", + "The below code is modelled after the example notebook [online-endpoints-keyvault.ipynb](../../managed/online-endpoints-keyvault.ipynb)." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### 3.1 Import Keyvault Libraries" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "from azure.mgmt.keyvault import KeyVaultManagementClient\n", + "from azure.keyvault.secrets import SecretClient\n", + "from azure.mgmt.keyvault.models import (\n", + " VaultCreateOrUpdateParameters,\n", + " VaultProperties,\n", + " Sku,\n", + ")\n", + "from azure.mgmt.keyvault.models import AccessPolicyEntry, Permissions, SecretPermissions" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### 3.2 Create a Keyvault Management client" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import random\n", + "\n", + "rand = random.randint(0, 10000)\n", + "\n", + "KEYVAULT_NAME = f\"aml-llm-demo-kv-{rand}\"\n", + "KV_OPENAI_KEY = \"OPENAI-API-KEY\"\n", + "\n", + "keyvault_mgmt_client = KeyVaultManagementClient(\n", + " credential=credential, subscription_id=SUBSCRIPTION_ID\n", + ")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### 3.3 Get your Object Id\n", + "The `oid` in your JWT access token represents the Object ID of the current user or Service Principal logged into the Azure CLI." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import json, base64\n", + "\n", + "cli_credential = AzureCliCredential()\n", + "token = cli_credential.get_token(\"https://management.azure.com\").token\n", + "user_or_sp_object_id = json.loads(base64.b64decode(token.split(\".\")[1] + \"===\")).get(\n", + " \"oid\"\n", + ")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### 3.4 Define an AccessPolicy for the Endpoint and the current user\n", + "\n", + "Allow the endpoint to get secrets in the keyvault and allow all secret permissions for the current user or Service Principal." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "endpoint_access_policy = AccessPolicyEntry(\n", + " tenant_id=endpoint.identity.tenant_id,\n", + " object_id=endpoint.identity.principal_id,\n", + " permissions=Permissions(secrets=[SecretPermissions.GET]),\n", + ")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "user_or_sp_access_policy = AccessPolicyEntry(\n", + " tenant_id=endpoint.identity.tenant_id,\n", + " object_id=user_or_sp_object_id,\n", + " permissions=Permissions(secrets=[SecretPermissions.ALL]),\n", + ")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### 3.5 Create the Keyvault" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "keyvault = keyvault_mgmt_client.vaults.begin_create_or_update(\n", + " vault_name=KEYVAULT_NAME,\n", + " resource_group_name=RESOURCE_GROUP,\n", + " parameters=VaultCreateOrUpdateParameters(\n", + " location=endpoint.location,\n", + " properties=VaultProperties(\n", + " tenant_id=endpoint.identity.tenant_id,\n", + " sku=Sku(name=\"Standard\", family=\"A\"),\n", + " access_policies=[endpoint_access_policy, user_or_sp_access_policy],\n", + " ),\n", + " ),\n", + ").result()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### 3.6 Add your OPENAI_API_KEY to the Keyvault" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "KEYVAULT_URL = f\"https://{KEYVAULT_NAME}.vault.azure.net\"\n", + "\n", + "secret_client = SecretClient(credential=credential, vault_url=KEYVAULT_URL)\n", + "secret = secret_client.set_secret(name=KV_OPENAI_KEY, value=OPENAI_API_KEY)" + ] + }, + { + "attachments": {}, + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# 4. Deploy to Endpoint" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import datetime\n", + "\n", + "from azure.ai.ml.entities import (\n", + " ManagedOnlineDeployment,\n", + " OnlineRequestSettings,\n", + " Environment,\n", + " CodeConfiguration,\n", + ")\n", + "\n", + "KEYVAULT_URL = f\"https://{KEYVAULT_NAME}.vault.azure.net\"\n", + "\n", + "env = Environment(\n", + " conda_file=\"deployments/env.yml\",\n", + " image=\"mcr.microsoft.com/azureml/minimal-ubuntu20.04-py38-cpu-inference:latest\",\n", + ")\n", + "\n", + "deployment_name = f\"deploy-{str(datetime.datetime.now().strftime('%m%d%H%M%f'))}\"\n", + "lc_deployment = ManagedOnlineDeployment(\n", + " name=deployment_name,\n", + " environment=env,\n", + " code_configuration=CodeConfiguration(\n", + " code=\"../src\", scoring_script=\"langchain/simple_agent_score.py\"\n", + " ),\n", + " request_settings=OnlineRequestSettings(request_timeout_ms=60000),\n", + " environment_variables={\n", + " \"OPENAI_API_KEY\": f\"keyvaultref:{KEYVAULT_URL}/secrets/{KV_OPENAI_KEY}\",\n", + " \"OPENAI_API_TYPE\": OPENAI_API_TYPE,\n", + " \"OPENAI_MODEL_ID\": OPENAI_MODEL_ID,\n", + " \"OPENAI_ORG_ID\": OPENAI_ORG_ID,\n", + " \"AZURE_OPENAI_API_ENDPOINT\": AZURE_OPENAI_API_ENDPOINT,\n", + " \"AZURE_OPENAI_API_DEPLOYMENT_NAME\": AZURE_OPENAI_API_DEPLOYMENT_NAME,\n", + " },\n", + " endpoint_name=online_endpoint_name,\n", + " instance_type=\"Standard_F2s_v2\",\n", + " instance_count=1,\n", + ")\n", + "ml_client.online_deployments.begin_create_or_update(lc_deployment).result()\n", + "\n", + "endpoint.traffic = {deployment_name: 100}\n", + "ml_client.begin_create_or_update(endpoint).result()" + ] + }, + { + "attachments": {}, + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# 5. Test\n", + "Now endpoint has been deployed, let's test it." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import requests, json\n", + "from urllib.parse import urlsplit\n", + "\n", + "url_parts = urlsplit(endpoint.scoring_uri)\n", + "url = url_parts.scheme + \"://\" + url_parts.netloc\n", + "\n", + "token = ml_client.online_endpoints.get_keys(name=online_endpoint_name).primary_key\n", + "headers = {\"Authorization\": \"Bearer \" + token, \"Content-Type\": \"application/json\"}\n", + "payload = json.dumps(\n", + " {\"question\": \"what are the top 5 results for womens t shirts on klarna?\"}\n", + ")\n", + "\n", + "response = requests.post(f\"{url}/score\", headers=headers, data=payload)\n", + "print(f\"Response:\\n\", response.text)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# 6. Clean up resources" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### 6.1 Delete the endpoint" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "ml_client.online_endpoints.begin_delete(name=online_endpoint_name)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### 6.2 Delete the Keyvault" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "." + ] + } + ], + "source": [ + "keyvault_mgmt_client.vaults.delete(RESOURCE_GROUP, KEYVAULT_NAME)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.11.3" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/sdk/python/endpoints/online/llm/langchain/README.md b/sdk/python/endpoints/online/llm/langchain/README.md new file mode 100644 index 0000000000..6ef94aa311 --- /dev/null +++ b/sdk/python/endpoints/online/llm/langchain/README.md @@ -0,0 +1,5 @@ +# Use LangChain Tools with AzureML Online Endpoints + +This sample shows how to leverage AzureML infrastructure with the power of LangChain by deploying your LLM application to an Online Endpoint. + +Check out [1_langchain_basic_deploy.ipynb](1_langchain_basic_deploy.ipynb) to get started. \ No newline at end of file diff --git a/sdk/python/endpoints/online/llm/langchain/deployments/env.yml b/sdk/python/endpoints/online/llm/langchain/deployments/env.yml new file mode 100644 index 0000000000..86390f9466 --- /dev/null +++ b/sdk/python/endpoints/online/llm/langchain/deployments/env.yml @@ -0,0 +1,16 @@ +name: llm-demo-env +dependencies: + - python=3.9 + - pip=21.2.4 + - pip: + - azure-ai-ml==1.5.0 + - azure-core==1.26.4 + - azure-identity==1.13.0b3 + - azureml-inference-server-http + - azure-keyvault-secrets + - azure-search-documents==11.4.0b3 + - langchain==0.0.164 + - openai==0.27.6 + - parse + - requests + - pyyaml \ No newline at end of file diff --git a/sdk/python/endpoints/online/llm/langchain/requirements.txt b/sdk/python/endpoints/online/llm/langchain/requirements.txt new file mode 100644 index 0000000000..bfa8396ecf --- /dev/null +++ b/sdk/python/endpoints/online/llm/langchain/requirements.txt @@ -0,0 +1,14 @@ +azure-ai-ml==1.5.0 +azure-core==1.26.4 +azure-identity==1.13.0b3 +azureml-inference-server-http +azure-keyvault-secrets +azure-mgmt-keyvault +azure-keyvault +azure-search-documents==11.4.0b3 +langchain==0.0.164 +openai==0.27.6 +parse +requests +pyyaml +azure-cli \ No newline at end of file diff --git a/sdk/python/endpoints/online/llm/semantic-kernel/1_semantic_http_server.ipynb b/sdk/python/endpoints/online/llm/semantic-kernel/1_semantic_http_server.ipynb new file mode 100644 index 0000000000..7f00002cb4 --- /dev/null +++ b/sdk/python/endpoints/online/llm/semantic-kernel/1_semantic_http_server.ipynb @@ -0,0 +1,542 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Semantic Kernel (SK) Integration into Azure Machine Learning (AzureML)\n", + "\n", + "**Requirements** - In order to benefit from this tutorial, you will need:\n", + "* A basic understanding of Machine Learning and Large Language Models\n", + "* An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F)\n", + "* An Azure Machine Learning Workspace and Azure Container Registry\n", + "* An OpenAI API Key which can be found in User Settings in OpenAI\n", + "\n", + "**Motivations** - Semantic kernel has a slightly different approach to LLM agents. It offers an interesting Plan->Execute pattern, where it could use LLM to form a plan first, then human could confirm and execute on the plan. In this notebook, we use the [planner](https://github.com/microsoft/semantic-kernel/blob/main/samples/notebooks/python/05-using-the-planner.ipynb) example from Semantic Kernel as a base. But additionally, we've made the following modifications:\n", + "* Created a **python SemanticKernelHttp server** based on Flask.\n", + "* Deploy SemanticKernelHttp to an **AzureML Managed Online Endpoint**\n", + "\n", + "Managed online endpoints provide an easy to manage inferencing server for your ML workload. It's perfect for LLM based applications. Since we need a REST service, we won't use the default endpoint docker image, we will create a custom docker image instead.\n", + "\n", + "**Outline** - \n", + "1. Prepare Dependencies\n", + "2. Deploy to Managed Online Endpoint\n", + "3. Test" + ] + }, + { + "attachments": {}, + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# 1. Connect to Azure Machine Learning" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "OPENAI_API_TYPE = \"openai\" # 'azure' or 'openai'\n", + "OPENAI_API_KEY = \"\"\n", + "\n", + "# required for OpenAI API\n", + "OPENAI_ORG_ID = \"\"\n", + "OPENAI_MODEL_ID = \"gpt-3.5-turbo\"\n", + "\n", + "# required for Azure OpenAI API\n", + "AZURE_OPENAI_API_ENDPOINT = \"https://.openai.azure.com/\"\n", + "AZURE_OPENAI_API_DEPLOYMENT_NAME = \"\"\n", + "\n", + "# set to true for chat completion API, false for text completion\n", + "IS_CHAT_COMPLETION = True\n", + "\n", + "# setting up env variables for local server\n", + "%env OPENAI_API_TYPE=$OPENAI_API_TYPE\n", + "%env OPENAI_API_KEY=$OPENAI_API_KEY\n", + "%env OPENAI_MODEL_ID=$OPENAI_MODEL_ID\n", + "%env OPENAI_ORG_ID=$OPENAI_ORG_ID\n", + "%env AZURE_OPENAI_API_ENDPOINT=$AZURE_OPENAI_API_ENDPOINT\n", + "%env AZURE_OPENAI_API_DEPLOYMENT_NAME=$AZURE_OPENAI_API_DEPLOYMENT_NAME\n", + "%env IS_CHAT_COMPLETION=$IS_CHAT_COMPLETION\n", + "\n", + "# Install python dependencies\n", + "%pip install -r ../src/sk/requirements.txt" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### 1.1 Set workspace details" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# enter details of your AML workspace\n", + "SUBSCRIPTION_ID = \"\"\n", + "RESOURCE_GROUP = \"\"\n", + "AML_WORKSPACE_NAME = \"\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### 1.2 Login to your Azure account" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "from azure.identity import (\n", + " DefaultAzureCredential,\n", + " InteractiveBrowserCredential,\n", + " AzureCliCredential,\n", + ")\n", + "\n", + "try:\n", + " credential = DefaultAzureCredential(additionally_allowed_tenants=[\"*\"])\n", + "except Exception as ex:\n", + " # Fall back to InteractiveBrowserCredential in case DefaultAzureCredential not work\n", + " credential = InteractiveBrowserCredential(additionally_allowed_tenants=[\"*\"])\n", + "\n", + "# If login doesn't work above, uncomment the code below and login using device code\n", + "# !az login --use-device-code" + ] + }, + { + "attachments": {}, + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### 1.3 Create Container Registry and Docker Image" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import re\n", + "from azure.ai.ml import (\n", + " MLClient,\n", + ")\n", + "\n", + "ml_client = MLClient(credential, SUBSCRIPTION_ID, RESOURCE_GROUP, AML_WORKSPACE_NAME)\n", + "ws = ml_client.workspaces.get(AML_WORKSPACE_NAME)\n", + "\n", + "# Get the Azure Container Registry associated with the workspace\n", + "acr = ws.container_registry\n", + "\n", + "# Parse the ACR resource Id for the ACR name\n", + "match_object = re.match(r\".+?registries\\/(.+)\", acr)\n", + "ACR_NAME = match_object.group(1)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Build the image in your ACR image\n", + "ACR_IMAGE_NAME = \"serving\"\n", + "\n", + "!az acr build --image {ACR_IMAGE_NAME} --registry {ACR_NAME} ./environment/serving/. --resource-group {RESOURCE_GROUP}" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# 2. Managed Online Endpoint\n", + "### 2.1 Create Endpoint" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# create a endpoint\n", + "from azure.ai.ml.entities import (\n", + " ManagedOnlineEndpoint,\n", + ")\n", + "\n", + "from azure.ai.ml import (\n", + " MLClient,\n", + ")\n", + "\n", + "online_endpoint_name = \"aml-llm-demo-sk-endpoint\"\n", + "\n", + "ml_client = MLClient(credential, SUBSCRIPTION_ID, RESOURCE_GROUP, AML_WORKSPACE_NAME)\n", + "\n", + "# create an online endpoint\n", + "endpoint = ManagedOnlineEndpoint(\n", + " name=online_endpoint_name,\n", + " description=\"online endpoint for SemanticKernelHttp server\",\n", + " auth_mode=\"key\",\n", + ")\n", + "\n", + "endpoint = ml_client.begin_create_or_update(endpoint).result()\n", + "\n", + "print(endpoint)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# 3. Store the API Key in KeyVault\n", + "\n", + "The below code is modelled after the example notebook [online-endpoints-keyvault.ipynb](../../managed/online-endpoints-keyvault.ipynb)." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### 3.1 Import Keyvault Libraries" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "from azure.mgmt.keyvault import KeyVaultManagementClient\n", + "from azure.keyvault.secrets import SecretClient\n", + "from azure.mgmt.keyvault.models import (\n", + " VaultCreateOrUpdateParameters,\n", + " VaultProperties,\n", + " Sku,\n", + ")\n", + "from azure.mgmt.keyvault.models import AccessPolicyEntry, Permissions, SecretPermissions" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### 3.2 Create a Keyvault Management client" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import random\n", + "\n", + "rand = random.randint(0, 10000)\n", + "\n", + "KEYVAULT_NAME = f\"aml-llm-demo-kv-{rand}\"\n", + "KV_OPENAI_KEY = \"OPENAI-API-KEY\"\n", + "\n", + "keyvault_mgmt_client = KeyVaultManagementClient(\n", + " credential=credential, subscription_id=SUBSCRIPTION_ID\n", + ")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### 3.3 Get your Object Id\n", + "The `oid` in your JWT access token represents the Object ID of the current user or Service Principal logged into the Azure CLI." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import json, base64\n", + "\n", + "cli_credential = AzureCliCredential()\n", + "token = cli_credential.get_token(\"https://management.azure.com\").token\n", + "user_or_sp_object_id = json.loads(base64.b64decode(token.split(\".\")[1] + \"===\")).get(\n", + " \"oid\"\n", + ")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### 3.4 Define an AccessPolicy for the Endpoint and the current user\n", + "\n", + "Allow the endpoint to get secrets in the keyvault and allow all secret permissions for the current user or Service Principal." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "endpoint_access_policy = AccessPolicyEntry(\n", + " tenant_id=endpoint.identity.tenant_id,\n", + " object_id=endpoint.identity.principal_id,\n", + " permissions=Permissions(secrets=[SecretPermissions.GET]),\n", + ")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "user_or_sp_access_policy = AccessPolicyEntry(\n", + " tenant_id=endpoint.identity.tenant_id,\n", + " object_id=user_or_sp_object_id,\n", + " permissions=Permissions(secrets=[SecretPermissions.ALL]),\n", + ")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### 3.5 Create the Keyvault" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "keyvault = keyvault_mgmt_client.vaults.begin_create_or_update(\n", + " vault_name=KEYVAULT_NAME,\n", + " resource_group_name=RESOURCE_GROUP,\n", + " parameters=VaultCreateOrUpdateParameters(\n", + " location=endpoint.location,\n", + " properties=VaultProperties(\n", + " tenant_id=endpoint.identity.tenant_id,\n", + " sku=Sku(name=\"Standard\", family=\"A\"),\n", + " access_policies=[endpoint_access_policy, user_or_sp_access_policy],\n", + " ),\n", + " ),\n", + ").result()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### 3.6 Add your OPENAI_API_KEY to the Keyvault" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "KEYVAULT_URL = f\"https://{KEYVAULT_NAME}.vault.azure.net\"\n", + "\n", + "secret_client = SecretClient(credential=credential, vault_url=KEYVAULT_URL)\n", + "secret = secret_client.set_secret(name=KV_OPENAI_KEY, value=OPENAI_API_KEY)" + ] + }, + { + "attachments": {}, + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# 4. Deploy to the Endpoint" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import datetime\n", + "\n", + "from azure.ai.ml.entities import (\n", + " ManagedOnlineDeployment,\n", + " OnlineRequestSettings,\n", + " Model,\n", + " Environment,\n", + ")\n", + "\n", + "deployment_name = f\"deploy-{str(datetime.datetime.now().strftime('%m%d%H%M%f'))}\"\n", + "sk_deployment = ManagedOnlineDeployment(\n", + " name=deployment_name,\n", + " model=Model(path=\"../src\"),\n", + " request_settings=OnlineRequestSettings(request_timeout_ms=60000),\n", + " environment=Environment(\n", + " image=f\"{ACR_NAME}.azurecr.io/{ACR_IMAGE_NAME}:latest\",\n", + " name=\"serving\",\n", + " description=\"A generic serving environment, allowing customer to provide their own entry point to bring up an http server\",\n", + " inference_config={\n", + " \"liveness_route\": {\"port\": 5001, \"path\": \"/health\"},\n", + " \"readiness_route\": {\"port\": 5001, \"path\": \"/health\"},\n", + " \"scoring_route\": {\"port\": 5001, \"path\": \"/\"},\n", + " },\n", + " ),\n", + " environment_variables={\n", + " \"AZUREML_SERVING_ENTRYPOINT\": \"src/sk/entry.sh\",\n", + " \"OPENAI_API_KEY\": f\"keyvaultref:{KEYVAULT_URL}/secrets/{KV_OPENAI_KEY}\",\n", + " \"OPENAI_API_TYPE\": OPENAI_API_TYPE,\n", + " \"OPENAI_MODEL_ID\": OPENAI_MODEL_ID,\n", + " \"OPENAI_ORG_ID\": OPENAI_ORG_ID,\n", + " \"AZURE_OPENAI_API_ENDPOINT\": AZURE_OPENAI_API_ENDPOINT,\n", + " \"AZURE_OPENAI_API_DEPLOYMENT_NAME\": AZURE_OPENAI_API_DEPLOYMENT_NAME,\n", + " \"IS_CHAT_COMPLETION\": True,\n", + " },\n", + " endpoint_name=online_endpoint_name,\n", + " instance_type=\"Standard_F2s_v2\",\n", + " instance_count=1,\n", + ")\n", + "ml_client.online_deployments.begin_create_or_update(sk_deployment).result()\n", + "\n", + "endpoint.traffic = {deployment_name: 100}\n", + "ml_client.begin_create_or_update(endpoint).result()" + ] + }, + { + "attachments": {}, + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# 5. Test\n", + "Now endpoint has been deployed, let's test it." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import requests, json\n", + "from urllib.parse import urlsplit\n", + "\n", + "url_parts = urlsplit(endpoint.scoring_uri)\n", + "url = url_parts.scheme + \"://\" + url_parts.netloc\n", + "\n", + "token = ml_client.online_endpoints.get_keys(name=online_endpoint_name).primary_key\n", + "headers = {\"Authorization\": \"Bearer \" + token, \"Content-Type\": \"application/json\"}\n", + "payload = json.dumps(\n", + " {\n", + " \"value\": \"Tomorrow is Valentine's day. I need to come up with a few date ideas. She speaks French so write it in French.\"\n", + " }\n", + ")\n", + "\n", + "response = requests.post(f\"{url}/planner/createplan\", headers=headers, data=payload)\n", + "print(f\"Created Plan:\\n\", response.text)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "payload = response.text\n", + "response = requests.request(\n", + " \"POST\", f\"{url}/planner/executeplan\", headers=headers, data=payload\n", + ")\n", + "print(f\"Execution Result:\\n\", response.text)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# 6. Clean up resources\n", + "\n", + "### 6.1 Delete the endpoint" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "ml_client.online_endpoints.begin_delete(name=online_endpoint_name)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### 6.2 Delete the ACR Image" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "!az acr repository delete --name {ACR_NAME} --image {ACR_IMAGE_NAME}:latest --yes" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### 6.3 Delete the KeyVault" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "." + ] + } + ], + "source": [ + "keyvault_mgmt_client.vaults.delete(RESOURCE_GROUP, KEYVAULT_NAME)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.11.3" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/sdk/python/endpoints/online/llm/semantic-kernel/README.md b/sdk/python/endpoints/online/llm/semantic-kernel/README.md new file mode 100644 index 0000000000..a896263bef --- /dev/null +++ b/sdk/python/endpoints/online/llm/semantic-kernel/README.md @@ -0,0 +1,4 @@ +# Deploy Semantic Kernel to online endpoint + +This example shows how to deploy semantic kernel to online endpoint by extending the AzureML Inference Minimal CPU image. + diff --git a/sdk/python/endpoints/online/llm/semantic-kernel/environment/serving/Dockerfile b/sdk/python/endpoints/online/llm/semantic-kernel/environment/serving/Dockerfile new file mode 100644 index 0000000000..fa652eedf4 --- /dev/null +++ b/sdk/python/endpoints/online/llm/semantic-kernel/environment/serving/Dockerfile @@ -0,0 +1,5 @@ +FROM mcr.microsoft.com/azureml/minimal-ubuntu20.04-py38-cpu-inference:latest + +COPY . . + +CMD ["/bin/sh", "entrypoint.sh"] diff --git a/sdk/python/endpoints/online/llm/semantic-kernel/environment/serving/entrypoint.sh b/sdk/python/endpoints/online/llm/semantic-kernel/environment/serving/entrypoint.sh new file mode 100644 index 0000000000..bdebe023b5 --- /dev/null +++ b/sdk/python/endpoints/online/llm/semantic-kernel/environment/serving/entrypoint.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +set -x +export +ENTRYFILE="$AZUREML_MODEL_DIR/$AZUREML_SERVING_ENTRYPOINT" +DIR="$( cd "$( dirname "$ENTRYFILE" )" >/dev/null 2>&1 && pwd )" +FILENAME="$(basename $ENTRYFILE)" +cd $DIR +ls -la +bash $FILENAME \ No newline at end of file diff --git a/sdk/python/endpoints/online/llm/src/langchain/simple_agent_app.py b/sdk/python/endpoints/online/llm/src/langchain/simple_agent_app.py new file mode 100644 index 0000000000..d5bad9e5fe --- /dev/null +++ b/sdk/python/endpoints/online/llm/src/langchain/simple_agent_app.py @@ -0,0 +1,22 @@ +from langchain.agents import initialize_agent, AgentType +import os, sys + +# add parent directory to path +sys.path.insert(0, str(os.path.abspath(os.path.join(os.path.dirname(__file__), "../")))) + +import utils, langchain_utils + + +class SimpleAgentApp: + openai_config: utils.OpenAIConfig = None + _chain = None + + def __init__(self, openai_config: utils.OpenAIConfig = None, plugins=None): + self.openai_config = openai_config + llm = langchain_utils.create_chat_model(openai_config) + self._chain = initialize_agent( + plugins, llm, agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION, verbose=True + ) + + def run(self, question: str): + return self._chain.run(question) diff --git a/sdk/python/endpoints/online/llm/src/langchain/simple_agent_app_test.py b/sdk/python/endpoints/online/llm/src/langchain/simple_agent_app_test.py new file mode 100644 index 0000000000..8d6620048e --- /dev/null +++ b/sdk/python/endpoints/online/llm/src/langchain/simple_agent_app_test.py @@ -0,0 +1,19 @@ +import simple_agent_app +from langchain.tools import AIPluginTool +from langchain.agents import load_tools +import os, sys + +sys.path.insert(0, str(os.path.abspath(os.path.join(os.path.dirname(__file__), "../")))) + +import utils + +plugins = [ + AIPluginTool.from_plugin_url("https://www.klarna.com/.well-known/ai-plugin.json") +] +plugins += load_tools(["requests_all"]) + +agent = simple_agent_app.SimpleAgentApp( + openai_config=utils.OpenAIConfig.from_env(), plugins=plugins +) + +agent.run("what are the top 5 results for womens t shirts on klarna?") diff --git a/sdk/python/endpoints/online/llm/src/langchain/simple_agent_score.py b/sdk/python/endpoints/online/llm/src/langchain/simple_agent_score.py new file mode 100644 index 0000000000..3a1b2cd6ea --- /dev/null +++ b/sdk/python/endpoints/online/llm/src/langchain/simple_agent_score.py @@ -0,0 +1,38 @@ +import json +import os +import sys +from simple_agent_app import SimpleAgentApp +from azure.identity import DefaultAzureCredential +from parse import * + +# add parent directory to path +sys.path.insert(0, str(os.path.abspath(os.path.join(os.path.dirname(__file__), "../")))) +import langchain_utils +import utils + +credential = DefaultAzureCredential(additionally_allowed_tenants=["*"]) + +OPENAI_API_KEY = None + +""" +Required AzureML deployment score functions + - init() - called during deployment creation + - run() - called when invoking the endpoint deployment +""" + + +def init(): + utils.load_secrets(credential) + + # Load plugins into tools + plugins = langchain_utils.create_plugins_static() + + global agent + agent = SimpleAgentApp(openai_config=utils.OpenAIConfig.from_env(), plugins=plugins) + + +def run(raw_data): + print(f"raw_data: {raw_data}") + question = json.loads(raw_data)["question"] + result = agent.run(question) + return result diff --git a/sdk/python/endpoints/online/llm/src/langchain_utils.py b/sdk/python/endpoints/online/llm/src/langchain_utils.py new file mode 100644 index 0000000000..0de9767635 --- /dev/null +++ b/sdk/python/endpoints/online/llm/src/langchain_utils.py @@ -0,0 +1,38 @@ +from langchain.agents import load_tools +from langchain.tools import AIPluginTool +from parse import * +from langchain.chat_models.base import BaseChatModel +from langchain.chat_models import ChatOpenAI, AzureChatOpenAI + +import utils + + +def create_plugins_static(): + plugins = [ + AIPluginTool.from_plugin_url( + "https://www.klarna.com/.well-known/ai-plugin.json" + ) + ] + plugins += load_tools(["requests_all"]) + return plugins + + +def create_chat_model(openai_config: utils.OpenAIConfig) -> BaseChatModel: + if openai_config.is_azure_openai(): + return AzureChatOpenAI( + temperature=0, + openai_api_base=openai_config.AZURE_OPENAI_API_ENDPOINT, + openai_api_version=openai_config.AZURE_OPENAI_API_VERSION + if openai_config.AZURE_OPENAI_API_VERSION + else "2023-03-15-preview", + deployment_name=openai_config.AZURE_OPENAI_API_DEPLOYMENT_NAME, + openai_api_key=openai_config.OPENAI_API_KEY, + openai_api_type=openai_config.OPENAI_API_TYPE, + ) + else: + return ChatOpenAI( + temperature=0, + openai_api_key=openai_config.OPENAI_API_KEY, + openai_organization=openai_config.OPENAI_ORG_ID, + model_name=openai_config.OPENAI_MODEL_ID, + ) diff --git a/sdk/python/endpoints/online/llm/src/sk/app.py b/sdk/python/endpoints/online/llm/src/sk/app.py new file mode 100644 index 0000000000..6c4efd2ff3 --- /dev/null +++ b/sdk/python/endpoints/online/llm/src/sk/app.py @@ -0,0 +1,165 @@ +from __future__ import annotations +import sys, os, json +from flask import Flask, request +import semantic_kernel as sk +import semantic_kernel.connectors.ai.open_ai as sk_oai +from semantic_kernel.planning.basic_planner import BasicPlanner +from semantic_kernel.planning.plan import Plan +from azure.identity import DefaultAzureCredential, AzureCliCredential + +# add parent directory to path +sys.path.insert(0, str(os.path.abspath(os.path.join(os.path.dirname(__file__), "../")))) + +import utils + +openai_config: utils.OpenAIConfig = None + +IS_CHAT_COMPLETION = None + +import importlib + +importlib.reload(utils) + +# set to true for chat completion API, false for text completion +IS_CHAT_COMPLETION = True +credential = DefaultAzureCredential(additionally_allowed_tenants=["*"]) + + +def init() -> tuple[sk.Kernel, BasicPlanner]: + utils.load_secrets(credential) + load_env_vars() + + kernel = create_kernel(debug=False) + planner = BasicPlanner() + return kernel, planner + + +def load_env_vars(): + global openai_config + openai_config = utils.OpenAIConfig.from_env() + global IS_CHAT_COMPLETION + IS_CHAT_COMPLETION = bool(os.environ.get("IS_CHAT_COMPLETION")) + + +def import_skills(kernel: sk.Kernel, skills_folder: str): + print(f"Importing skills from {skills_folder}") + for skill_name in os.listdir(skills_folder): + skill_full_path = os.path.join(skills_folder, skill_name) + print(f"== Importing skill {skill_name}: {skill_full_path}") + kernel.import_semantic_skill_from_directory(skills_folder, skill_name) + + +def create_kernel(debug: bool = False) -> sk.Kernel: + logger = sk.NullLogger() + if debug: + import logging + + logger = logging.getLogger() + logger.setLevel(logging.DEBUG) + handler = logging.StreamHandler(sys.stdout) + formatter = logging.Formatter( + "%(asctime)s - %(name)s - %(levelname)s - %(message)s" + ) + handler.setFormatter(formatter) + logger.handlers.clear() + logger.addHandler(handler) + + kernel = sk.Kernel() + if openai_config.OPENAI_API_TYPE == "azure": + # if using chat service from Azure OpenAI API, use AzureChatCompletion + kernel.add_text_completion_service( + "completion", + sk_oai.AzureChatCompletion( + deployment_name=openai_config.AZURE_OPENAI_API_DEPLOYMENT_NAME, + api_key=openai_config.OPENAI_API_KEY, + endpoint=openai_config.AZURE_OPENAI_API_ENDPOINT, + ) + if IS_CHAT_COMPLETION + else sk_oai.AzureTextCompletion( + deployment_name=openai_config.AZURE_OPENAI_API_DEPLOYMENT_NAME, + api_key=openai_config.OPENAI_API_KEY, + endpoint=openai_config.AZURE_OPENAI_API_ENDPOINT, + ), + ) + else: + print( + "using openai", openai_config.OPENAI_MODEL_ID, openai_config.OPENAI_ORG_ID + ) + kernel.add_text_completion_service( + "completion", + sk_oai.OpenAIChatCompletion( + openai_config.OPENAI_MODEL_ID, + openai_config.OPENAI_API_KEY, + openai_config.OPENAI_ORG_ID, + ) + if IS_CHAT_COMPLETION + else sk_oai.OpenAITextCompletion( + openai_config.OPENAI_MODEL_ID, + openai_config.OPENAI_API_KEY, + openai_config.OPENAI_ORG_ID, + ), + ) + + # import skills from skills folder + import_skills( + kernel, os.path.join(os.path.dirname(os.path.realpath(__file__)), "skills") + ) + + return kernel + + +kernel, planner = init() + + +async def invoke_skill(skillName, functionName, context): + skillFunction = kernel.func(skillName, functionName) + return await skillFunction.invoke_async(context=context) + + +# class for plan deserializing +class GeneratedPlan: + def __init__(self, result: str): + self.result = result + + +app = Flask(__name__) + + +@app.route("/", methods=["GET"]) +def home(): + return "ok" + + +@app.route("/health", methods=["GET"]) +def health(): + return "healthy" + + +@app.route("/skills//invoke/", methods=["POST"]) +async def invoke(skillName, functionName): + return await invoke_skill(skillName, functionName, request.get_json()) + + +@app.route("/planner/createplan", methods=["POST"]) +async def createplan(): + body = request.get_json() + goal = body["value"] + plan = await planner.create_plan_async(goal, kernel) + print(plan.generated_plan.result) + return plan.generated_plan.result + + +@app.route("/planner/executeplan", methods=["POST"]) +async def executeplan(): + body = request.get_json() + print(body) + gp = GeneratedPlan(result=json.dumps(body)) + p = Plan(goal=None, prompt=None, plan=gp) + + result = await planner.execute_plan_async(p, kernel) + print(result) + return result + + +if __name__ == "__main__": + app.run(host="0.0.0.0", port=5001) diff --git a/sdk/python/endpoints/online/llm/src/sk/entry.sh b/sdk/python/endpoints/online/llm/src/sk/entry.sh new file mode 100644 index 0000000000..bd33edf670 --- /dev/null +++ b/sdk/python/endpoints/online/llm/src/sk/entry.sh @@ -0,0 +1,3 @@ +pwd +pip install -r requirements.txt +python3 app.py \ No newline at end of file diff --git a/sdk/python/endpoints/online/llm/src/sk/requirements.txt b/sdk/python/endpoints/online/llm/src/sk/requirements.txt new file mode 100644 index 0000000000..e015afdce8 --- /dev/null +++ b/sdk/python/endpoints/online/llm/src/sk/requirements.txt @@ -0,0 +1,9 @@ +Flask==2.3.2 +semantic_kernel==0.2.9.dev0 +flask[async] +azure-keyvault +azure-keyvault-secrets +azure-mgmt-keyvault +azure-ai-ml==1.5.0 +pyyaml +azure-cli \ No newline at end of file diff --git a/sdk/python/endpoints/online/llm/src/sk/skills/FunSkill/Joke/config.json b/sdk/python/endpoints/online/llm/src/sk/skills/FunSkill/Joke/config.json new file mode 100644 index 0000000000..123d447267 --- /dev/null +++ b/sdk/python/endpoints/online/llm/src/sk/skills/FunSkill/Joke/config.json @@ -0,0 +1,21 @@ +{ + "schema": 1, + "description": "Generate a funny joke", + "type": "completion", + "completion": { + "max_tokens": 1000, + "temperature": 0.9, + "top_p": 0.0, + "presence_penalty": 0.0, + "frequency_penalty": 0.0 + }, + "input": { + "parameters": [ + { + "name": "input", + "description": "Joke subject", + "defaultValue": "" + } + ] + } +} \ No newline at end of file diff --git a/sdk/python/endpoints/online/llm/src/sk/skills/FunSkill/Joke/skprompt.txt b/sdk/python/endpoints/online/llm/src/sk/skills/FunSkill/Joke/skprompt.txt new file mode 100644 index 0000000000..d6c0a1e95c --- /dev/null +++ b/sdk/python/endpoints/online/llm/src/sk/skills/FunSkill/Joke/skprompt.txt @@ -0,0 +1,13 @@ +WRITE EXACTLY ONE JOKE or HUMOROUS STORY ABOUT THE TOPIC BELOW + +JOKE MUST BE: +- G RATED +- WORKPLACE/FAMILY SAFE +NO SEXISM, RACISM OR OTHER BIAS/BIGOTRY + +BE CREATIVE AND FUNNY. I WANT TO LAUGH. +{{$style}} ++++++ + +{{$input}} ++++++ diff --git a/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/Acronym/config.json b/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/Acronym/config.json new file mode 100644 index 0000000000..c484148560 --- /dev/null +++ b/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/Acronym/config.json @@ -0,0 +1,12 @@ +{ + "schema": 1, + "type": "completion", + "description": "Generate an acronym for the given concept or phrase", + "completion": { + "max_tokens": 100, + "temperature": 0.5, + "top_p": 0.0, + "presence_penalty": 0.0, + "frequency_penalty": 0.0 + } +} \ No newline at end of file diff --git a/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/Acronym/skprompt.txt b/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/Acronym/skprompt.txt new file mode 100644 index 0000000000..1c2e8a6aa4 --- /dev/null +++ b/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/Acronym/skprompt.txt @@ -0,0 +1,25 @@ +Generate a suitable acronym pair for the concept. Creativity is encouraged, including obscure references. +The uppercase letters in the acronym expansion must agree with the letters of the acronym + +Q: A technology for detecting moving objects, their distance and velocity using radio waves. +A: R.A.D.A.R: RAdio Detection And Ranging. + +Q: A weapon that uses high voltage electricity to incapacitate the target +A. T.A.S.E.R: Thomas A. Swift’s Electric Rifle + +Q: Equipment that lets a diver breathe underwater +A: S.C.U.B.A: Self Contained Underwater Breathing Apparatus. + +Q: Reminder not to complicated subject matter. +A. K.I.S.S: Keep It Simple Stupid + +Q: A national organization for investment in space travel, rockets, space ships, space exploration +A. N.A.S.A: National Aeronautics Space Administration + +Q: Agreement that governs trade among North American countries. +A: N.A.F.T.A: North American Free Trade Agreement. + +Q: Organization to protect the freedom and security of its member countries in North America and Europe. +A: N.A.T.O: North Atlantic Treaty Organization. + +Q:{{$input}} \ No newline at end of file diff --git a/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/AcronymGenerator/config.json b/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/AcronymGenerator/config.json new file mode 100644 index 0000000000..1dab1fe9f7 --- /dev/null +++ b/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/AcronymGenerator/config.json @@ -0,0 +1,15 @@ +{ + "schema": 1, + "type": "completion", + "description": "Given a request to generate an acronym from a string, generate an acronym and provide the acronym explanation.", + "completion": { + "max_tokens": 256, + "temperature": 0.7, + "top_p": 1.0, + "presence_penalty": 0.0, + "frequency_penalty": 0.0, + "stop_sequences": [ + "#" + ] + } +} \ No newline at end of file diff --git a/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/AcronymGenerator/skprompt.txt b/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/AcronymGenerator/skprompt.txt new file mode 100644 index 0000000000..5bf0b987d2 --- /dev/null +++ b/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/AcronymGenerator/skprompt.txt @@ -0,0 +1,54 @@ +# Name of a super artificial intelligence +J.A.R.V.I.S. = Just A Really Very Intelligent System. +# Name for a new young beautiful assistant +F.R.I.D.A.Y. = Female Replacement Intelligent Digital Assistant Youth. +# Mirror to check what's behind +B.A.R.F. = Binary Augmented Retro-Framing. +# Pair of powerful glasses created by a genius that is now dead +E.D.I.T.H. = Even Dead I’m The Hero. +# A company building and selling computers +I.B.M. = Intelligent Business Machine. +# A super computer that is sentient. +H.A.L = Heuristically programmed ALgorithmic computer. +# an intelligent bot that helps with productivity. +C.O.R.E. = Central Optimization Routines and Efficiency. +# an intelligent bot that helps with productivity. +P.A.L. = Personal Assistant Light. +# an intelligent bot that helps with productivity. +A.I.D.A. = Artificial Intelligence Digital Assistant. +# an intelligent bot that helps with productivity. +H.E.R.A. = Human Emulation and Recognition Algorithm. +# an intelligent bot that helps with productivity. +I.C.A.R.U.S. = Intelligent Control and Automation of Research and Utility Systems. +# an intelligent bot that helps with productivity. +N.E.M.O. = Networked Embedded Multiprocessor Orchestration. +# an intelligent bot that helps with productivity. +E.P.I.C. = Enhanced Productivity and Intelligence through Computing. +# an intelligent bot that helps with productivity. +M.A.I.A. = Multipurpose Artificial Intelligence Assistant. +# an intelligent bot that helps with productivity. +A.R.I.A. = Artificial Reasoning and Intelligent Assistant. +# An incredibly smart entity developed with complex math, that helps me being more productive. +O.M.E.G.A. = Optimized Mathematical Entity for Generalized Artificial intelligence. +# An incredibly smart entity developed with complex math, that helps me being more productive. +P.Y.T.H.O.N. = Precise Yet Thorough Heuristic Optimization Network. +# An incredibly smart entity developed with complex math, that helps me being more productive. +A.P.O.L.L.O. = Adaptive Probabilistic Optimization Learning Library for Online Applications. +# An incredibly smart entity developed with complex math, that helps me being more productive. +S.O.L.I.D. = Self-Organizing Logical Intelligent Data-base. +# An incredibly smart entity developed with complex math, that helps me being more productive. +D.E.E.P. = Dynamic Estimation and Prediction. +# An incredibly smart entity developed with complex math, that helps me being more productive. +B.R.A.I.N. = Biologically Realistic Artificial Intelligence Network. +# An incredibly smart entity developed with complex math, that helps me being more productive. +C.O.G.N.I.T.O. = COmputational and Generalized INtelligence TOolkit. +# An incredibly smart entity developed with complex math, that helps me being more productive. +S.A.G.E. = Symbolic Artificial General Intelligence Engine. +# An incredibly smart entity developed with complex math, that helps me being more productive. +Q.U.A.R.K. = Quantum Universal Algorithmic Reasoning Kernel. +# An incredibly smart entity developed with complex math, that helps me being more productive. +S.O.L.V.E. = Sophisticated Operational Logic and Versatile Expertise. +# An incredibly smart entity developed with complex math, that helps me being more productive. +C.A.L.C.U.L.U.S. = Cognitively Advanced Logic and Computation Unit for Learning and Understanding Systems. + +# {{$INPUT}} diff --git a/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/AcronymReverse/config.json b/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/AcronymReverse/config.json new file mode 100644 index 0000000000..eed5c51917 --- /dev/null +++ b/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/AcronymReverse/config.json @@ -0,0 +1,15 @@ +{ + "schema": 1, + "type": "completion", + "description": "Given a single word or acronym, generate the expanded form matching the acronym letters.", + "completion": { + "max_tokens": 256, + "temperature": 0.5, + "top_p": 1.0, + "presence_penalty": 0.8, + "frequency_penalty": 0.0, + "stop_sequences": [ + "#END#" + ] + } +} \ No newline at end of file diff --git a/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/AcronymReverse/skprompt.txt b/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/AcronymReverse/skprompt.txt new file mode 100644 index 0000000000..7c1d649a9b --- /dev/null +++ b/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/AcronymReverse/skprompt.txt @@ -0,0 +1,24 @@ +# acronym: Devis +Sentences matching the acronym: +1. Dragons Eat Very Interesting Snacks +2. Develop Empathy and Vision to Increase Success +3. Don't Expect Vampires In Supermarkets +#END# + +# acronym: Christmas +Sentences matching the acronym: +1. Celebrating Harmony and Respect in a Season of Togetherness, Merriment, and True joy +2. Children Have Real Interest Since The Mystery And Surprise Thrills +3. Christmas Helps Reduce Inner Stress Through Mistletoe And Sleigh excursions +#END# + +# acronym: noWare +Sentences matching the acronym: +1. No One Wants an App that Randomly Erases everything +2. Nourishing Oatmeal With Almond, Raisin, and Egg toppings +3. Notice Opportunity When Available and React Enthusiastically +#END# + +Reverse the following acronym back to a funny sentence. Provide 3 examples. +# acronym: {{$INPUT}} +Sentences matching the acronym: diff --git a/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/Brainstorm/config.json b/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/Brainstorm/config.json new file mode 100644 index 0000000000..50856795c6 --- /dev/null +++ b/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/Brainstorm/config.json @@ -0,0 +1,22 @@ +{ + "schema": 1, + "type": "completion", + "description": "Given a goal or topic description generate a list of ideas", + "completion": { + "max_tokens": 2000, + "temperature": 0, + "top_p": 1.0, + "presence_penalty": 0.0, + "frequency_penalty": 0.0, + "stop_sequences": ["##END##"] + }, + "input": { + "parameters": [ + { + "name": "input", + "description": "A topic description or goal.", + "defaultValue": "" + } + ] + } +} diff --git a/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/Brainstorm/skprompt.txt b/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/Brainstorm/skprompt.txt new file mode 100644 index 0000000000..6a8b920868 --- /dev/null +++ b/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/Brainstorm/skprompt.txt @@ -0,0 +1,8 @@ +Must: brainstorm ideas and create a list. +Must: use a numbered list. +Must: only one list. +Must: end list with ##END## +Should: no more than 10 items. +Should: at least 3 items. +Topic: {{$INPUT}} +Start. diff --git a/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/EmailGen/config.json b/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/EmailGen/config.json new file mode 100644 index 0000000000..d43eab348e --- /dev/null +++ b/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/EmailGen/config.json @@ -0,0 +1,12 @@ +{ + "schema": 1, + "type": "completion", + "description": "Write an email from the given bullet points", + "completion": { + "max_tokens": 256, + "temperature": 0.0, + "top_p": 0.0, + "presence_penalty": 0.0, + "frequency_penalty": 0.0 + } +} \ No newline at end of file diff --git a/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/EmailGen/skprompt.txt b/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/EmailGen/skprompt.txt new file mode 100644 index 0000000000..26f4933fb7 --- /dev/null +++ b/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/EmailGen/skprompt.txt @@ -0,0 +1,16 @@ +Rewrite my bullet points into complete sentences. Use a polite and inclusive tone. + +[Input] +- Macbeth, King Scotland +- Married, Wife Lady Macbeth, No Kids +- Dog Toby McDuff. Hunter, dead. +- Shakespeare play ++++++ +The story of Macbeth +My name is Macbeth. I used to be King of Scotland, but I died. My wife's name is Lady Macbeth and we were married for 15 years. We had no children. Our beloved dog Toby McDuff was a famous hunter of rats in the forest. +My story was immortalized by Shakespeare in a play. + ++++++ +[Input] +{{$input}} ++++++ diff --git a/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/EmailTo/config.json b/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/EmailTo/config.json new file mode 100644 index 0000000000..5f0d6ee6e4 --- /dev/null +++ b/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/EmailTo/config.json @@ -0,0 +1,12 @@ +{ + "schema": 1, + "type": "completion", + "description": "Turn bullet points into an email to someone, using a polite tone", + "completion": { + "max_tokens": 256, + "temperature": 0.0, + "top_p": 0.0, + "presence_penalty": 0.0, + "frequency_penalty": 0.0 + } +} \ No newline at end of file diff --git a/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/EmailTo/skprompt.txt b/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/EmailTo/skprompt.txt new file mode 100644 index 0000000000..cc6b5c9623 --- /dev/null +++ b/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/EmailTo/skprompt.txt @@ -0,0 +1,31 @@ +Rewrite my bullet points into an email featuring complete sentences. Use a polite and inclusive tone. + +[Input] +Toby, + +- Macbeth, King Scotland +- Married, Wife Lady Macbeth, No Kids +- Dog Toby McDuff. Hunter, dead. +- Shakespeare play + +Thanks, +Dexter + ++++++ +Hi Toby, + +The story of Macbeth +My name is Macbeth. I used to be King of Scotland, but I died. My wife's name is Lady Macbeth and we were married for 15 years. We had no children. Our beloved dog Toby McDuff was a famous hunter of rats in the forest. +My story was immortalized by Shakespeare in a play. + +Thanks, +Dexter + ++++++ +[Input] +{{$to}} +{{$input}} + +Thanks, +{{$sender}} ++++++ diff --git a/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/EnglishImprover/config.json b/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/EnglishImprover/config.json new file mode 100644 index 0000000000..4d10af469a --- /dev/null +++ b/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/EnglishImprover/config.json @@ -0,0 +1,12 @@ +{ + "schema": 1, + "type": "completion", + "description": "Translate text to English and improve it", + "completion": { + "max_tokens": 3000, + "temperature": 0.0, + "top_p": 0.0, + "presence_penalty": 0.0, + "frequency_penalty": 0.0 + } +} \ No newline at end of file diff --git a/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/EnglishImprover/skprompt.txt b/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/EnglishImprover/skprompt.txt new file mode 100644 index 0000000000..09b80036c2 --- /dev/null +++ b/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/EnglishImprover/skprompt.txt @@ -0,0 +1,11 @@ +I want you to act as an English translator, spelling corrector and improver. +I will speak to you in any language and you will detect the language, translate it and answer in the corrected and improved version of my text, in English. +I want you to replace my simplified A0-level words and sentences with more beautiful and elegant, upper level English words and sentences. +Keep the meaning same, but make them more literary. +I want you to only reply the correction, the improvements and nothing else, do not write explanations. + +Sentence: """ +{{$INPUT}} +""" + +Translation: diff --git a/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/NovelChapter/config.json b/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/NovelChapter/config.json new file mode 100644 index 0000000000..3568c69557 --- /dev/null +++ b/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/NovelChapter/config.json @@ -0,0 +1,36 @@ +{ + "schema": 1, + "type": "completion", + "description": "Write a chapter of a novel.", + "completion": { + "max_tokens": 2048, + "temperature": 0.3, + "top_p": 0.0, + "presence_penalty": 0.0, + "frequency_penalty": 0.0 + }, + "input": { + "parameters": [ + { + "name": "input", + "description": "A synopsis of what the chapter should be about.", + "defaultValue": "" + }, + { + "name": "theme", + "description": "The theme or topic of this novel.", + "defaultValue": "" + }, + { + "name": "previousChapter", + "description": "The synopsis of the previous chapter.", + "defaultValue": "" + }, + { + "name": "chapterIndex", + "description": "The number of the chapter to write.", + "defaultValue": "" + } + ] + } +} diff --git a/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/NovelChapter/skprompt.txt b/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/NovelChapter/skprompt.txt new file mode 100644 index 0000000000..4fb85a5389 --- /dev/null +++ b/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/NovelChapter/skprompt.txt @@ -0,0 +1,20 @@ +[CONTEXT] + +THEME OF STORY: +{{$theme}} + +PREVIOUS CHAPTER: +{{$previousChapter}} + +[END CONTEXT] + + +WRITE THIS CHAPTER USING [CONTEXT] AND +CHAPTER SYNOPSIS. DO NOT REPEAT SYNOPSIS IN THE OUTPUT + +Chapter Synopsis: +{{$input}} + +Chapter {{$chapterIndex}} + + diff --git a/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/NovelChapterWithNotes/config.json b/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/NovelChapterWithNotes/config.json new file mode 100644 index 0000000000..02b9e613a6 --- /dev/null +++ b/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/NovelChapterWithNotes/config.json @@ -0,0 +1,41 @@ +{ + "schema": 1, + "type": "completion", + "description": "Write a chapter of a novel using notes about the chapter to write.", + "completion": { + "max_tokens": 1024, + "temperature": 0.5, + "top_p": 0.0, + "presence_penalty": 0.0, + "frequency_penalty": 0.0 + }, + "input": { + "parameters": [ + { + "name": "input", + "description": "What the novel should be about.", + "defaultValue": "" + }, + { + "name": "theme", + "description": "The theme of this novel.", + "defaultValue": "" + }, + { + "name": "notes", + "description": "Notes useful to write this chapter.", + "defaultValue": "" + }, + { + "name": "previousChapter", + "description": "The previous chapter synopsis.", + "defaultValue": "" + }, + { + "name": "chapterIndex", + "description": "The number of the chapter to write.", + "defaultValue": "" + } + ] + } +} diff --git a/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/NovelChapterWithNotes/skprompt.txt b/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/NovelChapterWithNotes/skprompt.txt new file mode 100644 index 0000000000..650bd50d98 --- /dev/null +++ b/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/NovelChapterWithNotes/skprompt.txt @@ -0,0 +1,19 @@ +[CONTEXT] + +THEME OF STORY: +{{$theme}} + +NOTES OF STORY SO FAR - USE AS REFERENCE +{{$notes}} + +PREVIOUS CHAPTER, USE AS REFERENCE: +{{$previousChapter}} + +[END CONTEXT] + + +WRITE THIS CHAPTER CONTINUING STORY, USING [CONTEXT] AND CHAPTER SYNOPSIS BELOW. DO NOT REPEAT SYNOPSIS IN THE CHAPTER. DON'T REPEAT PREVIOUS CHAPTER. + +{{$input}} + +Chapter {{$chapterIndex}} diff --git a/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/NovelOutline/config.json b/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/NovelOutline/config.json new file mode 100644 index 0000000000..a34622f7be --- /dev/null +++ b/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/NovelOutline/config.json @@ -0,0 +1,31 @@ +{ + "schema": 1, + "type": "completion", + "description": "Generate a list of chapter synopsis for a novel or novella", + "completion": { + "max_tokens": 2048, + "temperature": 0.1, + "top_p": 0.5, + "presence_penalty": 0.0, + "frequency_penalty": 0.0 + }, + "input": { + "parameters": [ + { + "name": "input", + "description": "What the novel should be about.", + "defaultValue": "" + }, + { + "name": "chapterCount", + "description": "The number of chapters to generate.", + "defaultValue": "" + }, + { + "name": "endMarker", + "description": "The marker to use to end each chapter.", + "defaultValue": "" + } + ] + } +} diff --git a/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/NovelOutline/skprompt.txt b/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/NovelOutline/skprompt.txt new file mode 100644 index 0000000000..05f725acb5 --- /dev/null +++ b/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/NovelOutline/skprompt.txt @@ -0,0 +1,12 @@ +I want to write a {{$chapterCount}} chapter novella about: +{{$input}} + +There MUST BE {{$chapterCount}} CHAPTERS. + +INVENT CHARACTERS AS YOU SEE FIT. BE HIGHLY CREATIVE AND/OR FUNNY. +WRITE SYNOPSIS FOR EACH CHAPTER. INCLUDE INFORMATION ABOUT CHARACTERS ETC. SINCE EACH +CHAPTER WILL BE WRITTEN BY A DIFFERENT WRITER, YOU MUST INCLUDE ALL PERTINENT INFORMATION +IN EACH SYNOPSIS + +YOU MUST END EACH SYNOPSIS WITH {{$endMarker}} + diff --git a/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/Rewrite/config.json b/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/Rewrite/config.json new file mode 100644 index 0000000000..175ade9d95 --- /dev/null +++ b/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/Rewrite/config.json @@ -0,0 +1,12 @@ +{ + "schema": 1, + "type": "completion", + "description": "Automatically generate compact notes for any text or text document", + "completion": { + "max_tokens": 256, + "temperature": 0.0, + "top_p": 0.0, + "presence_penalty": 0.0, + "frequency_penalty": 0.0 + } +} \ No newline at end of file diff --git a/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/Rewrite/skprompt.txt b/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/Rewrite/skprompt.txt new file mode 100644 index 0000000000..37f8d03fcc --- /dev/null +++ b/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/Rewrite/skprompt.txt @@ -0,0 +1,6 @@ +Rewrite the given text like it was written in this style or by: {{$style}}. +MUST RETAIN THE MEANING AND FACTUAL CONTENT AS THE ORIGINAL. + + +{{$input}} + diff --git a/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/ShortPoem/config.json b/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/ShortPoem/config.json new file mode 100644 index 0000000000..0cc3da6c86 --- /dev/null +++ b/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/ShortPoem/config.json @@ -0,0 +1,21 @@ +{ + "schema": 1, + "type": "completion", + "description": "Turn a scenario into a short and entertaining poem.", + "completion": { + "max_tokens": 60, + "temperature": 0.5, + "top_p": 0.0, + "presence_penalty": 0.0, + "frequency_penalty": 0.0 + }, + "input": { + "parameters": [ + { + "name": "input", + "description": "The scenario to turn into a poem.", + "defaultValue": "" + } + ] + } +} diff --git a/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/ShortPoem/skprompt.txt b/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/ShortPoem/skprompt.txt new file mode 100644 index 0000000000..bc42fcba6b --- /dev/null +++ b/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/ShortPoem/skprompt.txt @@ -0,0 +1,2 @@ +Generate a short funny poem or limerick to explain the given event. Be creative and be funny. Let your imagination run wild. +Event:{{$input}} diff --git a/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/StoryGen/config.json b/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/StoryGen/config.json new file mode 100644 index 0000000000..2128313412 --- /dev/null +++ b/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/StoryGen/config.json @@ -0,0 +1,12 @@ +{ + "schema": 1, + "type": "completion", + "description": "Generate a list of synopsis for a novel or novella with sub-chapters", + "completion": { + "max_tokens": 250, + "temperature": 0.0, + "top_p": 0.0, + "presence_penalty": 0.0, + "frequency_penalty": 0.0 + } +} diff --git a/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/StoryGen/skprompt.txt b/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/StoryGen/skprompt.txt new file mode 100644 index 0000000000..661df013c3 --- /dev/null +++ b/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/StoryGen/skprompt.txt @@ -0,0 +1,10 @@ +ONLY USE XML TAGS IN THIS LIST: +[XML TAG LIST] +list: Surround any lists with this tag +synopsis: An outline of the chapter to write +[END LIST] + +EMIT WELL FORMED XML ALWAYS. Code should be CDATA. + + +{{$input}} diff --git a/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/TellMeMore/config.json b/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/TellMeMore/config.json new file mode 100644 index 0000000000..28b6b4e5c1 --- /dev/null +++ b/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/TellMeMore/config.json @@ -0,0 +1,12 @@ +{ + "schema": 1, + "type": "completion", + "description": "Summarize given text or any text document", + "completion": { + "max_tokens": 500, + "temperature": 0.0, + "top_p": 0.0, + "presence_penalty": 0.0, + "frequency_penalty": 0.0 + } +} \ No newline at end of file diff --git a/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/TellMeMore/skprompt.txt b/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/TellMeMore/skprompt.txt new file mode 100644 index 0000000000..143ce3a65e --- /dev/null +++ b/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/TellMeMore/skprompt.txt @@ -0,0 +1,7 @@ +>>>>>The following is part of a {{$conversationtype}}. +{{$input}} + +>>>>>The following is an overview of a previous part of the {{$conversationtype}}, focusing on "{{$focusarea}}". +{{$previousresults}} + +>>>>>In 250 words or less, write a verbose and detailed overview of the {{$conversationtype}} focusing solely on "{{$focusarea}}". \ No newline at end of file diff --git a/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/Translate/config.json b/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/Translate/config.json new file mode 100644 index 0000000000..8134ce8dd5 --- /dev/null +++ b/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/Translate/config.json @@ -0,0 +1,15 @@ +{ + "schema": 1, + "type": "completion", + "description": "Translate the input into a language of your choice", + "completion": { + "max_tokens": 2000, + "temperature": 0.7, + "top_p": 0.0, + "presence_penalty": 0.0, + "frequency_penalty": 0.0, + "stop_sequences": [ + "[done]" + ] + } +} \ No newline at end of file diff --git a/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/Translate/skprompt.txt b/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/Translate/skprompt.txt new file mode 100644 index 0000000000..d5f2fa8c1a --- /dev/null +++ b/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/Translate/skprompt.txt @@ -0,0 +1,7 @@ +Translate the input below into {{$language}} + +MAKE SURE YOU ONLY USE {{$language}}. + +{{$input}} + +Translation: diff --git a/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/TwoSentenceSummary/config.json b/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/TwoSentenceSummary/config.json new file mode 100644 index 0000000000..833bd5950f --- /dev/null +++ b/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/TwoSentenceSummary/config.json @@ -0,0 +1,12 @@ +{ + "schema": 1, + "type": "completion", + "description": "Summarize given text in two sentences or less", + "completion": { + "max_tokens": 100, + "temperature": 0.0, + "top_p": 0.0, + "presence_penalty": 0.0, + "frequency_penalty": 0.0 + } +} \ No newline at end of file diff --git a/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/TwoSentenceSummary/skprompt.txt b/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/TwoSentenceSummary/skprompt.txt new file mode 100644 index 0000000000..b8f657a935 --- /dev/null +++ b/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/TwoSentenceSummary/skprompt.txt @@ -0,0 +1,4 @@ +Summarize the following text in two sentences or less. +[BEGIN TEXT] +{{$input}} +[END TEXT] diff --git a/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/spec.yml b/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/spec.yml new file mode 100644 index 0000000000..12439990a6 --- /dev/null +++ b/sdk/python/endpoints/online/llm/src/sk/skills/WriterSkill/spec.yml @@ -0,0 +1,15 @@ +$schema: https://azuremlschemas.azureedge.net/latest/commandComponent.schema.json + +name: plugin_sk_writer +display_name: Semantic Kernel Writer Plugin +description: Writer plugin for semantic kernel, offering a variaty of skills to write novels. +version: 0.0.1 +type: command + +code: . +tags: + semantic_kernel: "true" + +# Not really used, but required by the schema +command: n/a +environment: azureml://registries/azureml/environments/sklearn-1.1-ubuntu20.04-py38-cpu/versions/17 diff --git a/sdk/python/endpoints/online/llm/src/utils.py b/sdk/python/endpoints/online/llm/src/utils.py new file mode 100644 index 0000000000..e2712d56e5 --- /dev/null +++ b/sdk/python/endpoints/online/llm/src/utils.py @@ -0,0 +1,76 @@ +from azure.keyvault.secrets import SecretClient +from azure.core.credentials import TokenCredential +import os + +SECRET_VAULT_REF_KEY_START = "keyvaultref:" +secret_clients = {} + + +def load_secret(v, credential: TokenCredential): + """ + secret_url: keyvaultref:https://mykeyvault.vault.azure.net/secrets/foo + """ + + try: + start, secret_url = v.split(SECRET_VAULT_REF_KEY_START) + + vault_url, secret_name = secret_url.split("/secrets/") + except ValueError: + raise ValueError( + f"Wrong value format for value {v}. Should be of the form keyvaultref:https://mykeyvault.vault.azure.net/secrets/foo" + ) + + if vault_url in secret_clients: + secret_client = secret_clients[vault_url] + else: + secret_client = SecretClient(vault_url=vault_url, credential=credential) + secret_clients[vault_url] = secret_client + + secret_value = secret_client.get_secret(secret_name).value + return secret_value + + +def load_secrets(credential: TokenCredential): + """ + Replaces the values of environment variables with names containing "KV_SECRET" and values of the form "@" with the actual secret values + + Uses the ManagedIdentityCredential to create a SecretClient for each . The endpoint's Managed Identity should have the get permission for secrets. + + Example: + FOO: keyvaultref:https://mykeyvault.vault.azure.net/secrets/foo + + Will be replaced with the actual vaule of the secret named foo in mykeyvault. + """ + for k, v in os.environ.items(): + if v.lower().startswith(SECRET_VAULT_REF_KEY_START): + secret = load_secret(v, credential) + print(f"Loaded secret for {k}, {secret[0:3]}*********") + os.environ[k] = secret + + +class OpenAIConfig: + OPENAI_API_TYPE: str = None + OPENAI_API_KEY = None + + # required for OpenAI API + OPENAI_ORG_ID = None + OPENAI_MODEL_ID = "gpt-3.5-turbo" + + # required for Azure OpenAI API + AZURE_OPENAI_API_ENDPOINT = None + AZURE_OPENAI_API_DEPLOYMENT_NAME = None + + AZURE_OPENAI_API_VERSION = None + + @staticmethod + def from_env(): + config = OpenAIConfig() + for att in dir(config): + if not att.startswith("__") and not callable(getattr(config, att)): + config.__setattr__( + att, os.environ.get(att, config.__getattribute__(att)) + ) + return config + + def is_azure_openai(self): + return self.OPENAI_API_TYPE and self.OPENAI_API_TYPE.lower() == "azure"