

As traduções são geradas por tradução automática. Em caso de conflito entre o conteúdo da tradução e da versão original em inglês, a versão em inglês prevalecerá.

# Gerenciar endpoints de inferência usando o comando `endpoints`
<a name="machine-learning-api-endpoints"></a>

Use o comando `endpoints` do Neptune ML para criar um endpoint de inferência, conferir o status, excluí-lo ou listar endpoints de inferência existentes.

## Criar um endpoint de inferência usando o comando `endpoints` do Neptune ML
<a name="machine-learning-api-endpoints-create-job"></a>

Um comando `endpoints` do Neptune ML para criar um endpoint de inferência a partir de um modelo criado por um trabalho de treinamento tem a seguinte aparência:

------
#### [ AWS CLI ]

```
aws neptunedata create-ml-endpoint \
  --endpoint-url https://{{your-neptune-endpoint}}:{{port}} \
  --id "{{(a unique ID for the new endpoint)}}" \
  --ml-model-training-job-id "{{(the model-training job-id of a completed job)}}"
```

Para obter mais informações, consulte [create-ml-endpoint](https://docs.aws.amazon.com/cli/latest/reference/neptunedata/create-ml-endpoint.html)na Referência de AWS CLI Comandos.

------
#### [ SDK ]

```
import boto3
from botocore.config import Config

client = boto3.client(
    'neptunedata',
    endpoint_url='https://{{your-neptune-endpoint}}:{{port}}',
    config=Config(read_timeout=None, retries={'total_max_attempts': 1})
)

response = client.create_ml_endpoint(
    id='{{(a unique ID for the new endpoint)}}',
    mlModelTrainingJobId='{{(the model-training job-id of a completed job)}}'
)

print(response)
```

------
#### [ awscurl ]

```
awscurl https://{{your-neptune-endpoint}}:{{port}}/ml/endpoints \
  --region {{us-east-1}} \
  --service neptune-db \
  -X POST \
  -H 'Content-Type: application/json' \
  -d '{
        "id" : "{{(a unique ID for the new endpoint)}}",
        "mlModelTrainingJobId": "{{(the model-training job-id of a completed job)}}"
      }'
```

**nota**  
Este exemplo pressupõe que suas AWS credenciais estejam configuradas em seu ambiente. {{us-east-1}}Substitua pela região do seu cluster Neptune.

------
#### [ curl ]

```
curl \
  -X POST https://{{your-neptune-endpoint}}:{{port}}/ml/endpoints \
  -H 'Content-Type: application/json' \
  -d '{
        "id" : "{{(a unique ID for the new endpoint)}}",
        "mlModelTrainingJobId": "{{(the model-training job-id of a completed job)}}"
      }'
```

------

Um comando `endpoints` do Neptune ML para atualizar um endpoint de inferência existente a partir de um modelo criado por um trabalho de treinamento tem a seguinte aparência:

------
#### [ AWS CLI ]

```
aws neptunedata create-ml-endpoint \
  --endpoint-url https://{{your-neptune-endpoint}}:{{port}} \
  --id "{{(a unique ID for the new endpoint)}}" \
  --update \
  --ml-model-training-job-id "{{(the model-training job-id of a completed job)}}"
```

Para obter mais informações, consulte [create-ml-endpoint](https://docs.aws.amazon.com/cli/latest/reference/neptunedata/create-ml-endpoint.html)na Referência de AWS CLI Comandos.

------
#### [ SDK ]

```
import boto3
from botocore.config import Config

client = boto3.client(
    'neptunedata',
    endpoint_url='https://{{your-neptune-endpoint}}:{{port}}',
    config=Config(read_timeout=None, retries={'total_max_attempts': 1})
)

response = client.create_ml_endpoint(
    id='{{(a unique ID for the new endpoint)}}',
    update=True,
    mlModelTrainingJobId='{{(the model-training job-id of a completed job)}}'
)

print(response)
```

------
#### [ awscurl ]

```
awscurl https://{{your-neptune-endpoint}}:{{port}}/ml/endpoints \
  --region {{us-east-1}} \
  --service neptune-db \
  -X POST \
  -H 'Content-Type: application/json' \
  -d '{
        "id" : "{{(a unique ID for the new endpoint)}}",
        "update" : "true",
        "mlModelTrainingJobId": "{{(the model-training job-id of a completed job)}}"
      }'
```

**nota**  
Este exemplo pressupõe que suas AWS credenciais estejam configuradas em seu ambiente. {{us-east-1}}Substitua pela região do seu cluster Neptune.

------
#### [ curl ]

```
curl \
  -X POST https://{{your-neptune-endpoint}}:{{port}}/ml/endpoints \
  -H 'Content-Type: application/json' \
  -d '{
        "id" : "{{(a unique ID for the new endpoint)}}",
        "update" : "true",
        "mlModelTrainingJobId": "{{(the model-training job-id of a completed job)}}"
      }'
```

------

Um comando `endpoints` do Neptune ML para criar um endpoint de inferência a partir de um modelo criado por um trabalho de transformação de modelos tem a seguinte aparência:

------
#### [ AWS CLI ]

```
aws neptunedata create-ml-endpoint \
  --endpoint-url https://{{your-neptune-endpoint}}:{{port}} \
  --id "{{(a unique ID for the new endpoint)}}" \
  --ml-model-transform-job-id "{{(the model-transform job-id of a completed job)}}"
```

Para obter mais informações, consulte [create-ml-endpoint](https://docs.aws.amazon.com/cli/latest/reference/neptunedata/create-ml-endpoint.html)na Referência de AWS CLI Comandos.

------
#### [ SDK ]

```
import boto3
from botocore.config import Config

client = boto3.client(
    'neptunedata',
    endpoint_url='https://{{your-neptune-endpoint}}:{{port}}',
    config=Config(read_timeout=None, retries={'total_max_attempts': 1})
)

response = client.create_ml_endpoint(
    id='{{(a unique ID for the new endpoint)}}',
    mlModelTransformJobId='{{(the model-transform job-id of a completed job)}}'
)

print(response)
```

------
#### [ awscurl ]

```
awscurl https://{{your-neptune-endpoint}}:{{port}}/ml/endpoints \
  --region {{us-east-1}} \
  --service neptune-db \
  -X POST \
  -H 'Content-Type: application/json' \
  -d '{
        "id" : "{{(a unique ID for the new endpoint)}}",
        "mlModelTransformJobId": "{{(the model-transform job-id of a completed job)}}"
      }'
```

**nota**  
Este exemplo pressupõe que suas AWS credenciais estejam configuradas em seu ambiente. {{us-east-1}}Substitua pela região do seu cluster Neptune.

------
#### [ curl ]

```
curl \
  -X POST https://{{your-neptune-endpoint}}:{{port}}/ml/endpoints \
  -H 'Content-Type: application/json' \
  -d '{
        "id" : "{{(a unique ID for the new endpoint)}}",
        "mlModelTransformJobId": "{{(the model-transform job-id of a completed job)}}"
      }'
```

------

Um comando `endpoints` do Neptune ML para atualizar um endpoint de inferência existente a partir de um modelo criado por um trabalho de transformação de modelos tem a seguinte aparência:

------
#### [ AWS CLI ]

```
aws neptunedata create-ml-endpoint \
  --endpoint-url https://{{your-neptune-endpoint}}:{{port}} \
  --id "{{(a unique ID for the new endpoint)}}" \
  --update \
  --ml-model-transform-job-id "{{(the model-transform job-id of a completed job)}}"
```

Para obter mais informações, consulte [create-ml-endpoint](https://docs.aws.amazon.com/cli/latest/reference/neptunedata/create-ml-endpoint.html)na Referência de AWS CLI Comandos.

------
#### [ SDK ]

```
import boto3
from botocore.config import Config

client = boto3.client(
    'neptunedata',
    endpoint_url='https://{{your-neptune-endpoint}}:{{port}}',
    config=Config(read_timeout=None, retries={'total_max_attempts': 1})
)

response = client.create_ml_endpoint(
    id='{{(a unique ID for the new endpoint)}}',
    update=True,
    mlModelTransformJobId='{{(the model-transform job-id of a completed job)}}'
)

print(response)
```

------
#### [ awscurl ]

```
awscurl https://{{your-neptune-endpoint}}:{{port}}/ml/endpoints \
  --region {{us-east-1}} \
  --service neptune-db \
  -X POST \
  -H 'Content-Type: application/json' \
  -d '{
        "id" : "{{(a unique ID for the new endpoint)}}",
        "update" : "true",
        "mlModelTransformJobId": "{{(the model-transform job-id of a completed job)}}"
      }'
```

**nota**  
Este exemplo pressupõe que suas AWS credenciais estejam configuradas em seu ambiente. {{us-east-1}}Substitua pela região do seu cluster Neptune.

------
#### [ curl ]

```
curl \
  -X POST https://{{your-neptune-endpoint}}:{{port}}/ml/endpoints \
  -H 'Content-Type: application/json' \
  -d '{
        "id" : "{{(a unique ID for the new endpoint)}}",
        "update" : "true",
        "mlModelTransformJobId": "{{(the model-transform job-id of a completed job)}}"
      }'
```

------

**Parâmetros para criação de endpoints de inferência `endpoints`**
+ **`id`**: (*opcional*) um identificador exclusivo para o novo endpoint de inferência.

  *Tipo*: string. *Padrão*: um nome com carimbo de data e hora gerado automaticamente.
+ **`mlModelTrainingJobId`**: o ID do trabalho de treinamento de modelos concluído que criou o modelo para o qual o endpoint de inferência apontará.

  *Tipo*: string.

  *Observação*: é necessário fornecer o `mlModelTrainingJobId` ou o `mlModelTransformJobId`.
+ **`mlModelTransformJobId`**: o ID do trabalho de transformação de modelos concluído.

  *Tipo*: string.

  *Observação*: é necessário fornecer o `mlModelTrainingJobId` ou o `mlModelTransformJobId`.
+ **`update`**: (*opcional*) se presente, esse parâmetro indica que se trata de uma solicitação de atualização.

  *Tipo*: booliano. *Padrão*: `false`

  *Observação*: é necessário fornecer o `mlModelTrainingJobId` ou o `mlModelTransformJobId`.
+ **`neptuneIamRoleArn`**— (*Opcional*) O ARN de uma função do IAM que fornece ao Neptune acesso aos recursos de IA e SageMaker Amazon S3.

  *Tipo*: string. *Observação*: deve estar listado no grupo de parâmetros do cluster de banco de dados ou será lançado um erro.
+ **`modelName`**: (*opcional*) o tipo de modelo para treinamento. Por padrão, o modelo de ML é automaticamente baseado no `modelType` usado no processamento de dados, mas você pode especificar um tipo de modelo diferente aqui.

  *Tipo*: string. *Padrão*: `rgcn` para grafos heterogêneos e `kge` para grafos de conhecimento. *Valores válidos*: para grafos heterogêneos: `rgcn`. Para grafos de conhecimento:`kge`, `transe`, `distmult` ou `rotate`.
+ **`instanceType`**: (*opcional*) o tipo de instância de ML usada para serviços on-line.

  *Tipo*: string. *Padrão*: `ml.m5.xlarge`.

  *Observação*: selecionar a instância de ML para um endpoint de inferência depende do tipo de tarefa, do tamanho do grafo e do orçamento. Consulte [Selecionar uma instância para um endpoint de inferência](machine-learning-on-graphs-instance-selection.md#machine-learning-on-graphs-inference-endpoint-instance-size).
+ **`instanceCount`**: (*opcional*) o número mínimo de instâncias do Amazon EC2 a serem implantadas em um endpoint para previsão.

  *Tipo*: número inteiro. *Padrão*: `1`.
+ **`volumeEncryptionKMSKey`**— (*Opcional*) A chave AWS Key Management Service (AWS KMS) que a SageMaker IA usa para criptografar dados no volume de armazenamento anexado às instâncias de computação de ML que executam os endpoints.

  *Tipo*: string *Padrão*: *nenhum*.

## Obter o status de um endpoint de inferência usando o comando `endpoints` do Neptune ML
<a name="machine-learning-api-endpoints-get-endpoint-status"></a>

Um exemplo de comando `endpoints` do Neptune ML para o status de um endpoint de instância tem a seguinte aparência:

------
#### [ AWS CLI ]

```
aws neptunedata get-ml-endpoint \
  --endpoint-url https://{{your-neptune-endpoint}}:{{port}} \
  --id "{{(the inference endpoint ID)}}"
```

Para obter mais informações, consulte [get-ml-endpoint](https://docs.aws.amazon.com/cli/latest/reference/neptunedata/get-ml-endpoint.html)na Referência de AWS CLI Comandos.

------
#### [ SDK ]

```
import boto3
from botocore.config import Config

client = boto3.client(
    'neptunedata',
    endpoint_url='https://{{your-neptune-endpoint}}:{{port}}',
    config=Config(read_timeout=None, retries={'total_max_attempts': 1})
)

response = client.get_ml_endpoint(
    id='{{(the inference endpoint ID)}}'
)

print(response)
```

------
#### [ awscurl ]

```
awscurl https://{{your-neptune-endpoint}}:{{port}}/ml/endpoints/{{(the inference endpoint ID)}} \
  --region {{us-east-1}} \
  --service neptune-db \
  -X GET
```

**nota**  
Este exemplo pressupõe que suas AWS credenciais estejam configuradas em seu ambiente. {{us-east-1}}Substitua pela região do seu cluster Neptune.

------
#### [ curl ]

```
curl -s \
  "https://{{your-neptune-endpoint}}:{{port}}/ml/endpoints/{{(the inference endpoint ID)}}" \
  | python -m json.tool
```

------

**Parâmetros para o status do endpoint da instância `endpoints`**
+ **`id`**: (*obrigatório*) o identificador exclusivo do endpoint de inferência.

  *Tipo*: string.
+ **`neptuneIamRoleArn`**— (*Opcional*) O ARN de uma função do IAM que fornece ao Neptune acesso aos recursos de IA e SageMaker Amazon S3.

  *Tipo*: string. *Observação*: deve estar listado no grupo de parâmetros do cluster de banco de dados ou será lançado um erro.

## Excluir um endpoint de instância usando o comando `endpoints` do Neptune ML
<a name="machine-learning-api-endpoints-delete-endpoint"></a>

Um exemplo de comando `endpoints` do Neptune ML para exclusão de um endpoint de instância tem a seguinte aparência:

------
#### [ AWS CLI ]

```
aws neptunedata delete-ml-endpoint \
  --endpoint-url https://{{your-neptune-endpoint}}:{{port}} \
  --id "{{(the inference endpoint ID)}}"
```

Para também limpar artefatos relacionados:

```
aws neptunedata delete-ml-endpoint \
  --endpoint-url https://{{your-neptune-endpoint}}:{{port}} \
  --id "{{(the inference endpoint ID)}}" \
  --clean
```

Para obter mais informações, consulte [delete-ml-endpoint](https://docs.aws.amazon.com/cli/latest/reference/neptunedata/delete-ml-endpoint.html)na Referência de AWS CLI Comandos.

------
#### [ SDK ]

```
import boto3
from botocore.config import Config

client = boto3.client(
    'neptunedata',
    endpoint_url='https://{{your-neptune-endpoint}}:{{port}}',
    config=Config(read_timeout=None, retries={'total_max_attempts': 1})
)

response = client.delete_ml_endpoint(
    id='{{(the inference endpoint ID)}}',
    clean=True
)

print(response)
```

------
#### [ awscurl ]

```
awscurl https://{{your-neptune-endpoint}}:{{port}}/ml/endpoints/{{(the inference endpoint ID)}} \
  --region {{us-east-1}} \
  --service neptune-db \
  -X DELETE
```

Para também limpar artefatos relacionados:

```
awscurl "https://{{your-neptune-endpoint}}:{{port}}/ml/endpoints/{{(the inference endpoint ID)}}?clean=true" \
  --region {{us-east-1}} \
  --service neptune-db \
  -X DELETE
```

**nota**  
Este exemplo pressupõe que suas AWS credenciais estejam configuradas em seu ambiente. {{us-east-1}}Substitua pela região do seu cluster Neptune.

------
#### [ curl ]

```
curl -s \
  -X DELETE "https://{{your-neptune-endpoint}}:{{port}}/ml/endpoints/{{(the inference endpoint ID)}}"
```

Ou esta:

```
curl -s \
  -X DELETE "https://{{your-neptune-endpoint}}:{{port}}/ml/endpoints/{{(the inference endpoint ID)}}?clean=true"
```

------

**Parâmetros para exclusão `endpoints` de um endpoint de inferência**
+ **`id`**: (*obrigatório*) o identificador exclusivo do endpoint de inferência.

  *Tipo*: string.
+ **`neptuneIamRoleArn`**— (*Opcional*) O ARN de uma função do IAM que fornece ao Neptune acesso aos recursos de IA e SageMaker Amazon S3.

  *Tipo*: string. *Observação*: deve estar listado no grupo de parâmetros do cluster de banco de dados ou será lançado um erro.
+ **`clean`**: (*opcional*) indica que todos os artefatos relacionados a esse endpoint também devem ser excluídos.

  *Tipo*: booliano. *Padrão*: `FALSE`.

## Listar endpoints de inferência usando o comando `endpoints` do Neptune ML
<a name="machine-learning-api-endpoints-list-endpoints"></a>

Um comando `endpoints` do Neptune ML para listar endpoints de inferência tem a seguinte aparência:

------
#### [ AWS CLI ]

```
aws neptunedata list-ml-endpoints \
  --endpoint-url https://{{your-neptune-endpoint}}:{{port}}
```

Para limitar o número de resultados:

```
aws neptunedata list-ml-endpoints \
  --endpoint-url https://{{your-neptune-endpoint}}:{{port}} \
  --max-items 3
```

Para obter mais informações, consulte [list-ml-endpoints](https://docs.aws.amazon.com/cli/latest/reference/neptunedata/list-ml-endpoints.html)na Referência de AWS CLI Comandos.

------
#### [ SDK ]

```
import boto3
from botocore.config import Config

client = boto3.client(
    'neptunedata',
    endpoint_url='https://{{your-neptune-endpoint}}:{{port}}',
    config=Config(read_timeout=None, retries={'total_max_attempts': 1})
)

response = client.list_ml_endpoints(
    maxItems=3
)

print(response)
```

------
#### [ awscurl ]

```
awscurl https://{{your-neptune-endpoint}}:{{port}}/ml/endpoints \
  --region {{us-east-1}} \
  --service neptune-db \
  -X GET
```

Para limitar o número de resultados:

```
awscurl "https://{{your-neptune-endpoint}}:{{port}}/ml/endpoints?maxItems=3" \
  --region {{us-east-1}} \
  --service neptune-db \
  -X GET
```

**nota**  
Este exemplo pressupõe que suas AWS credenciais estejam configuradas em seu ambiente. {{us-east-1}}Substitua pela região do seu cluster Neptune.

------
#### [ curl ]

```
curl -s "https://{{your-neptune-endpoint}}:{{port}}/ml/endpoints" \
  | python -m json.tool
```

Ou esta:

```
curl -s "https://{{your-neptune-endpoint}}:{{port}}/ml/endpoints?maxItems=3" \
  | python -m json.tool
```

------

**Parâmetros para listar endpoints de inferência `dataprocessing`**
+ **`maxItems`**: (*opcional*) o número máximo de itens a serem gerados.

  *Tipo*: número inteiro. *Padrão*: `10`. *Valor máximo permitido*: `1024`.
+ **`neptuneIamRoleArn`**— (*Opcional*) O ARN de uma função do IAM que fornece ao Neptune acesso aos recursos de IA e SageMaker Amazon S3.

  *Tipo*: string. *Observação*: deve estar listado no grupo de parâmetros do cluster de banco de dados ou será lançado um erro.