Skip to content

Commit 9c234dc

Browse files
committed
more tabs
1 parent 477a933 commit 9c234dc

File tree

1 file changed

+112
-2
lines changed

1 file changed

+112
-2
lines changed

articles/ai-foundry/how-to/deploy-models-serverless.md

Lines changed: 112 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,55 @@ Furthermore, models offered through Azure Marketplace are available for deployme
428428

429429
## Deploy the model to a serverless API
430430

431+
# [Models sold directly by Azure](#tab/azure-direct)
432+
433+
In this section, you create an endpoint for your model. Name the endpoint **DeepSeek-R1-qwerty**.
434+
435+
1. Create the serverless endpoint.
436+
437+
```python
438+
endpoint_name="DeepSeek-R1-qwerty"
439+
440+
serverless_endpoint = ServerlessEndpoint(
441+
name=endpoint_name,
442+
model_id=model_id
443+
)
444+
445+
created_endpoint = client.serverless_endpoints.begin_create_or_update(
446+
serverless_endpoint
447+
).result()
448+
```
449+
450+
1. At any point, you can see the endpoints deployed to your project:
451+
452+
```python
453+
endpoint_name="DeepSeek-R1-qwerty"
454+
455+
serverless_endpoint = ServerlessEndpoint(
456+
name=endpoint_name,
457+
model_id=model_id
458+
)
459+
460+
created_endpoint = client.serverless_endpoints.begin_create_or_update(
461+
serverless_endpoint
462+
).result()
463+
```
464+
465+
1. The created endpoint uses key authentication for authorization. Use the following steps to get the keys associated with a given endpoint.
466+
467+
```python
468+
endpoint_keys = client.serverless_endpoints.get_keys(endpoint_name)
469+
print(endpoint_keys.primary_key)
470+
print(endpoint_keys.secondary_key)
471+
```
472+
473+
1. If you need to consume this deployment from a different project or hub, or you plan to use Prompt flow to build intelligent applications, you need to create a connection to the standard deployment. To learn how to configure an existing standard deployment on a new project or hub, see [Consume deployed standard deployment from a different project or from Prompt flow](deploy-models-serverless-connect.md).
474+
475+
> [!TIP]
476+
> If you're using Prompt flow in the same project or hub where the deployment was deployed, you still need to create the connection.
477+
478+
# [Models from Partners and Community](#tab/partner-models)
479+
431480
In this section, you create an endpoint for your model with the name **AI21-Jamba-1-5-Large-qwerty**.
432481

433482
1. Create the serverless endpoint.
@@ -473,6 +522,7 @@ In this section, you create an endpoint for your model with the name **AI21-Jamb
473522
> [!TIP]
474523
> If you're using Prompt flow in the same project or hub where the deployment was deployed, you still need to create the connection.
475524

525+
---
476526

477527
## Use the standard deployment
478528

@@ -579,7 +629,67 @@ Furthermore, models offered through Azure Marketplace are available for deployme
579629

580630
## Deploy the model to a serverless API
581631

582-
In this section, you create an endpoint for your model with the name **AI21-Jamba-1-5-Large-qwerty**.
632+
# [Models sold directly by Azure](#tab/azure-direct)
633+
634+
In this section, you create an endpoint for your model. Name the endpoint **myserverless-text-1234ss**.
635+
636+
1. Create the serverless endpoint. Use the following template to create an endpoint:
637+
638+
__serverless-endpoint.bicep__
639+
640+
```bicep
641+
param projectName string = 'my-project'
642+
param endpointName string = 'myserverless-text-1234ss'
643+
param location string = resourceGroup().location
644+
param modelId string = 'azureml://registries/azureml-deepseek/models/DeepSeek-R1'
645+
646+
var modelName = substring(modelId, (lastIndexOf(modelId, '/') + 1))
647+
var subscriptionName = '${modelName}-subscription'
648+
649+
resource projectName_endpoint 'Microsoft.MachineLearningServices/workspaces/serverlessEndpoints@2024-04-01-preview' = {
650+
name: '${projectName}/${endpointName}'
651+
location: location
652+
sku: {
653+
name: 'Consumption'
654+
}
655+
properties: {
656+
modelSettings: {
657+
modelId: modelId
658+
}
659+
}
660+
dependsOn: [
661+
projectName_subscription
662+
]
663+
}
664+
665+
output endpointUri string = projectName_endpoint.properties.inferenceEndpoint.uri
666+
```
667+
668+
Create the deployment as follows:
669+
670+
```azurecli
671+
az deployment group create --resource-group $RESOURCE_GROUP --template-file model-subscription.bicep
672+
```
673+
674+
1. At any point, you can see the endpoints deployed to your project:
675+
676+
You can use the resource management tools to query the resources. The following code uses Azure CLI:
677+
678+
```azurecli
679+
az resource list \
680+
--query "[?type=='Microsoft.MachineLearningServices/workspaces/serverlessEndpoints']"
681+
```
682+
683+
1. The created endpoint uses key authentication for authorization. Get the keys associated with the given endpoint by using REST APIs to query this information.
684+
685+
1. If you need to consume this deployment from a different project or hub, or you plan to use Prompt flow to build intelligent applications, you need to create a connection to the standard deployment. To learn how to configure an existing standard deployment on a new project or hub, see [Consume deployed standard deployment from a different project or from Prompt flow](deploy-models-serverless-connect.md).
686+
687+
> [!TIP]
688+
> If you're using Prompt flow in the same project or hub where the deployment was deployed, you still need to create the connection.
689+
690+
# [Models from Partners and Community](#tab/partner-models)
691+
692+
In this section, you create an endpoint for your model with the name **myserverless-text-1234ss**.
583693

584694
1. Create the serverless endpoint. Use the following template to create an endpoint:
585695

@@ -635,6 +745,7 @@ In this section, you create an endpoint for your model with the name **AI21-Jamb
635745
> [!TIP]
636746
> If you're using Prompt flow in the same project or hub where the deployment was deployed, you still need to create the connection.
637747

748+
---
638749

639750
## Use the standard deployment
640751

@@ -653,7 +764,6 @@ You can use the resource management tools to manage the resources. The following
653764
az resource delete --name <resource-name>
654765
```
655766

656-
657767
::: zone-end
658768

659769

0 commit comments

Comments
 (0)