Skip to content

アプリケーション内で をクリックすると、お使いのDataRobotバージョンに関する全プラットフォームドキュメントにアクセスできます。

Declarative API

DataRobot offers a Terraform-native declarative API used to programmatically provision DataRobot entities such as models, deployments, applications, and more. 宣言型APIを使用すると、以下のことができます。

  1. インフラストラクチャの望ましい最終状態を指定することで、管理を簡単にし、クラウドプロバイダー間での適応性を高めることができます。
  2. プロビジョニングを自動化することで、環境間の整合性を確保し、実行順序に関する懸念を解消できます。
  3. バージョン管理を簡単にすることができます。
  4. アプリケーションテンプレートを使用することで、ワークフローの重複を減らし、一貫性を確保できます。
  5. DevOpsやCI/CDと連携することで、予測可能かつ一貫性のあるインフラストラクチャを確保し、デプロイのリスクを軽減できます。

DataRobotの宣言型APIは、反復可能かつスケーラブルな方法でリソースをエンドツーエンドでプロビジョニングするためのコードファーストの方法として使用できます。

Declarative API services

DataRobot has two services for using the declarative API: Pulumi and Terraform. DataRobot recommends using the service that supports your engineering needs. Pulumi is based on Python, while Terraform is based on yaml. Note that application templates are configured for Pulumi by default.

For information on using Pulumi for your declarative API needs, access the Pulumi registry and review the installation guide.

For information on using Terraform, access the Terraform registry and review the installation guide.

宣言型APIを使用して、Pulumi CLIでDataRobotのリソースをプロビジョニングする方法の例を以下に示します。

import pulumi_datarobot as datarobot
import pulumi
import os

for var in [
    "OPENAI_API_KEY",
    "OPENAI_API_BASE",
    "OPENAI_API_DEPLOYMENT_ID",
    "OPENAI_API_VERSION",
]:
    assert var in os.environ

pe = datarobot.PredictionEnvironment(
    "pulumi_serverless_env", platform="datarobotServerless"
)

credential = datarobot.ApiTokenCredential(
    "pulumi_credential", api_token=os.environ["OPENAI_API_KEY"]
)

cm = datarobot.CustomModel(
    "pulumi_custom_model",
    base_environment_id="65f9b27eab986d30d4c64268",  # GenAI 3.11 w/ moderations
    folder_path="model/",
    runtime_parameter_values=[
        {"key": "OPENAI_API_KEY", "type": "credential", "value": credential.id},
        {
            "key": "OPENAI_API_BASE",
            "type": "string",
            "value": os.environ["OPENAI_API_BASE"],
        },
        {
            "key": "OPENAI_API_DEPLOYMENT_ID",
            "type": "string",
            "value": os.environ["OPENAI_API_DEPLOYMENT_ID"],
        },
        {
            "key": "OPENAI_API_VERSION",
            "type": "string",
            "value": os.environ["OPENAI_API_VERSION"],
        },
    ],
    target_name="resultText",
    target_type="TextGeneration",
)

rm = datarobot.RegisteredModel(
    resource_name="pulumi_registered_model",
    name=None,
    custom_model_version_id=cm.version_id,
)

d = datarobot.Deployment(
    "pulumi_deployment",
    label="pulumi_deployment",
    prediction_environment_id=pe.id,
    registered_model_version_id=rm.version_id,
)

pulumi.export("deployment_id", d.id) 

更新しました January 3, 2025