Skip to content

Commit

Permalink
Merge pull request #6 from Azure-Samples/odaibert/postman-client
Browse files Browse the repository at this point in the history
Odaibert/postman client
  • Loading branch information
odaibert authored Apr 17, 2024
2 parents 4969ca1 + 0cdad86 commit afa3385
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 19 deletions.
60 changes: 43 additions & 17 deletions labs/backend-circuit-breaking/backend-circuit-breaking.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"metadata": {}
},
"outputs": [],
"source": [
"import os\n",
Expand All @@ -49,9 +51,9 @@
"mock_webapps = [{\"name\": \"openaimock1\"}] # ensure that the names are not being used within Azure\n",
"resource_group = \"lab-ai-gateway\"\n",
"apim_resource_name = lab_prefix + \"-aigw-apim\"\n",
"apim_resource_location = \"swedencentral\"\n",
"apim_resource_location = \"eastus\"\n",
"apim_resource_sku = \"Consumption\"\n",
"openai_resources = [ {\"name\": lab_prefix + \"-aigw-openai1\", \"location\": \"swedencentral\"}]\n",
"openai_resources = [ {\"name\": lab_prefix + \"-aigw-openai1\", \"location\": \"eastus\"}]\n",
"openai_resource_sku = \"S0\"\n",
"openai_model_name = \"gpt-35-turbo\"\n",
"openai_model_version = \"0613\"\n",
Expand All @@ -71,7 +73,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"metadata": {}
},
"outputs": [],
"source": [
"resource_group_stdout = ! az group create --name {resource_group} --location {apim_resource_location}\n",
Expand All @@ -93,7 +97,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"metadata": {}
},
"outputs": [],
"source": [
"if mock_disabled:\n",
Expand All @@ -120,7 +126,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"metadata": {}
},
"outputs": [],
"source": [
"if mock_disabled:\n",
Expand All @@ -147,7 +155,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"metadata": {}
},
"outputs": [],
"source": [
"apim_resource_stdout = ! az apim create -g {resource_group} -n {apim_resource_name} -l {apim_resource_location} \\\n",
Expand All @@ -169,7 +179,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"metadata": {}
},
"outputs": [],
"source": [
"apim_resource_stdout = ! az apim show -g {resource_group} -n {apim_resource_name}\n",
Expand All @@ -193,7 +205,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"metadata": {}
},
"outputs": [],
"source": [
"if mock_disabled:\n",
Expand Down Expand Up @@ -224,7 +238,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"metadata": {}
},
"outputs": [],
"source": [
"if mock_disabled:\n",
Expand Down Expand Up @@ -322,7 +338,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"metadata": {}
},
"outputs": [],
"source": [
"if mock_disabled:\n",
Expand Down Expand Up @@ -356,7 +374,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"metadata": {}
},
"outputs": [],
"source": [
"if mock_disabled:\n",
Expand Down Expand Up @@ -386,7 +406,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"metadata": {}
},
"outputs": [],
"source": [
"url = apim_resource_gateway_url + \"/openai/deployments/\" + openai_deployment_name + \"/chat/completions?api-version=\" + openai_api_version\n",
Expand Down Expand Up @@ -431,7 +453,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"metadata": {}
},
"outputs": [],
"source": [
"from openai import AzureOpenAI\n",
Expand Down Expand Up @@ -472,10 +496,12 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"metadata": {}
},
"outputs": [],
"source": [
"run_cell = False\n",
"run_cell = True\n",
"if run_cell:\n",
" ! az group delete --name {resource_group} -y\n",
" ! az apim deletedservice purge --service-name {apim_resource_name} --location {apim_resource_location}\n",
Expand All @@ -501,7 +527,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.9"
"version": "3.12.3"
}
},
"nbformat": 4,
Expand Down
1 change: 1 addition & 0 deletions labs/built-in-logging/README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Playground to try the [buil-in logging capabilities of API Management](https://l

### Prerequisites
- [Python 3.8 or later version](https://www.python.org/) installed
- [Pandas Library](https://pandas.pydata.org) installed
- [VS Code](https://code.visualstudio.com/) installed with the [Jupyter notebook extension](https://marketplace.visualstudio.com/items?itemName=ms-toolsai.jupyter) enabled
- [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli) installed
- [An Azure Subscription](https://azure.microsoft.com/en-us/free/) with Contributor permissions
Expand Down
9 changes: 7 additions & 2 deletions labs/built-in-logging/built-in-logging.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"\n",
"### Prerequisites\n",
"- [Python 3.8 or later version](https://www.python.org/) installed\n",
"- [Pandas Library](https://pandas.pydata.org/) installed\n",
"- [VS Code](https://code.visualstudio.com/) installed with the [Jupyter notebook extension](https://marketplace.visualstudio.com/items?itemName=ms-toolsai.jupyter) enabled\n",
"- [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli) installed\n",
"- [An Azure Subscription](https://azure.microsoft.com/en-us/free/) with Contributor permissions\n",
Expand All @@ -40,7 +41,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"metadata": {}
},
"outputs": [],
"source": [
"import os\n",
Expand Down Expand Up @@ -289,7 +292,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"metadata": {}
},
"outputs": [],
"source": [
"import pandas as pd\n",
Expand Down

0 comments on commit afa3385

Please sign in to comment.