From 5e38bffb6e10a1992f5f91ddd7c402423e525e1e Mon Sep 17 00:00:00 2001 From: Vanessa Arndorfer Date: Wed, 20 Sep 2023 13:48:28 -0700 Subject: [PATCH] Unique endpoint name (#2660) * randomize keyvault name * formatting * shorten kv name * unique endpoint name * remove duplicate code --------- Co-authored-by: Vanessa Arndorfer --- .../llm/langchain/1_langchain_basic_deploy.ipynb | 11 +++++------ .../llm/semantic-kernel/1_semantic_http_server.ipynb | 11 +++++------ 2 files changed, 10 insertions(+), 12 deletions(-) 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 index a4b62561c0..4715d3e32f 100644 --- a/sdk/python/endpoints/online/llm/langchain/1_langchain_basic_deploy.ipynb +++ b/sdk/python/endpoints/online/llm/langchain/1_langchain_basic_deploy.ipynb @@ -138,6 +138,8 @@ "outputs": [], "source": [ "# create a endpoint\n", + "import datetime\n", + "\n", "from azure.ai.ml.entities import (\n", " ManagedOnlineEndpoint,\n", ")\n", @@ -146,7 +148,8 @@ " MLClient,\n", ")\n", "\n", - "online_endpoint_name = \"aml-llm-demo-langchain-endpoint\"\n", + "time = str(datetime.datetime.now().strftime(\"%m%d%H%M%f\"))\n", + "online_endpoint_name = f\"aml-llm-lc-demo-{time}\"\n", "\n", "# get a handle to the workspace\n", "ml_client = MLClient(credential, SUBSCRIPTION_ID, RESOURCE_GROUP, AML_WORKSPACE_NAME)\n", @@ -208,10 +211,6 @@ "metadata": {}, "outputs": [], "source": [ - "import datetime\n", - "\n", - "time = str(datetime.datetime.now().strftime(\"%m%d%H%M%f\"))\n", - "\n", "KEYVAULT_NAME = f\"llmdemokv{time}\"\n", "KV_OPENAI_KEY = \"OPENAI-API-KEY\"\n", "\n", @@ -352,7 +351,7 @@ " 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", + "deployment_name = f\"deploy-{time}\"\n", "lc_deployment = ManagedOnlineDeployment(\n", " name=deployment_name,\n", " environment=env,\n", 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 index f5b3cea517..b2cba49bd8 100644 --- 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 @@ -170,6 +170,8 @@ "outputs": [], "source": [ "# create a endpoint\n", + "import datetime\n", + "\n", "from azure.ai.ml.entities import (\n", " ManagedOnlineEndpoint,\n", ")\n", @@ -178,7 +180,8 @@ " MLClient,\n", ")\n", "\n", - "online_endpoint_name = \"aml-llm-demo-sk-endpoint\"\n", + "time = str(datetime.datetime.now().strftime(\"%m%d%H%M%f\"))\n", + "online_endpoint_name = f\"aml-llm-sk-demo-{time}\"\n", "\n", "ml_client = MLClient(credential, SUBSCRIPTION_ID, RESOURCE_GROUP, AML_WORKSPACE_NAME)\n", "\n", @@ -239,10 +242,6 @@ "metadata": {}, "outputs": [], "source": [ - "import datetime\n", - "\n", - "time = str(datetime.datetime.now().strftime(\"%m%d%H%M%f\"))\n", - "\n", "KEYVAULT_NAME = f\"llmdemokv{time}\"\n", "KV_OPENAI_KEY = \"OPENAI-API-KEY\"\n", "\n", @@ -376,7 +375,7 @@ " Environment,\n", ")\n", "\n", - "deployment_name = f\"deploy-{str(datetime.datetime.now().strftime('%m%d%H%M%f'))}\"\n", + "deployment_name = f\"deploy-{time}\"\n", "sk_deployment = ManagedOnlineDeployment(\n", " name=deployment_name,\n", " model=Model(path=\"../src\"),\n",