Skip to main content
Connect external models or use Adaptive with LangChain.

External models

Connect proprietary models (OpenAI, Azure, Google, Anthropic, NVIDIA NIM) to use them through the Adaptive API with interaction and metrics logging.

OpenAI (direct)

external_model = adaptive.models.add_external(
    provider="open_ai",
    external_model_id="GPT4O",
    name="GPT-4o",
    api_key="OPENAI_API_KEY"
)
Supported model IDs: GPT4O, GPT4O_MINI, GPT4, GPT4_TURBO, GPT3_5_TURBO

Azure OpenAI

external_model = adaptive.models.add_external(
    provider="azure",
    external_model_id="DEPLOYMENT_NAME",
    name="Azure GPT-4o",
    api_key="AZURE_API_KEY",
    endpoint="https://aoairesource.openai.azure.com"
)
The external_model_id is your deployment name, and endpoint is your Azure OpenAI subscription endpoint.

Google

external_model = adaptive.models.add_external(
    provider="google",
    external_model_id="gemini-1.5-pro",
    name="Gemini 1.5 Pro",
    api_key="GOOGLE_API_KEY"
)
Supported models: Gemini model variations (excluding embeddings).

Anthropic

external_model = adaptive.models.add_external(
    provider="anthropic",
    external_model_id="claude-sonnet-4-5-20250929",
    name="Claude Sonnet 4.5",
    api_key="ANTHROPIC_API_KEY"
)
Use the model ID from Anthropic’s API documentation as the external_model_id. Once connected, attach the model to a project and make inference requests like any other model.

LangChain

Adaptive is compatible with LangChain chat model classes.

ChatOpenAI

from langchain_openai import ChatOpenAI
import os

os.environ["OPENAI_API_KEY"] = "ADAPTIVE_API_KEY"

llm = ChatOpenAI(
    model="project_key/model_key",  # model_key is optional
    base_url="ADAPTIVE_URL/api/v1",
)

messages = [
    ("system", "You are a helpful assistant that translates English to French."),
    ("human", "I love programming."),
]
response = llm.invoke(messages)

ChatGoogleGenerativeAI

from langchain_google_genai import ChatGoogleGenerativeAI
import os

os.environ["GOOGLE_API_KEY"] = "ADAPTIVE_API_KEY"

llm = ChatGoogleGenerativeAI(
    model="project_key",
    client_options={"api_endpoint": "ADAPTIVE_URL/api/v1/google"},
    transport="rest",
)

messages = [
    ("system", "You are a helpful assistant that translates English to French."),
    ("human", "I love programming."),
]
response = llm.invoke(messages)

Platform notifications

Subscribe to job events and receive alerts through Slack, email, or webhook.

Topic patterns

Topics follow the format project:<project_id>:job:<job_id>:<event_type>. Subscribe using patterns with wildcard support:
PatternMatches
project:*:job:*:completedAny job completion in any project
project:*:job:*:failedFailed jobs across all projects
project:*:job:*:runningJob start events across all projects
project:*:job:**All job events (any status) in any project
Use * to match a single segment and ** to match zero or more segments. Event types: running, completed, failed, cancelled.

Integration types

Three delivery methods are available:
TypeSetupDetails
SlackWebhook URL, optional bot tokenPosts to a channel via incoming webhook
Email (SMTP)SMTP host, port, credentials, from/to addressesSends to specified recipients
WebhookHTTP endpoint URL, method, custom headersHTTP request with event payload
Each integration can subscribe to different topic patterns. You can create multiple integrations of the same type for different channels or recipients.

SDK methods

from adaptive_sdk.input_types import (
    ConnectionConfigInputSlack,
    ConnectionConfigInputSmtp,
    ConnectionConfigInputWebhook,
    SubscriptionInput,
    DeliveryScopeInput,
)

# Slack integration
integration = adaptive.integrations.create(
    team="my-team",
    name="Job alerts",
    provider="slack",
    connection=ConnectionConfigInputSlack(
        webhook_url="https://hooks.slack.com/services/T.../B.../xxx",
    ),
    subscriptions=[
        SubscriptionInput(
            topic_pattern="project:*:job:*:completed",
            scope=DeliveryScopeInput.TEAM,
        ),
        SubscriptionInput(
            topic_pattern="project:*:job:*:failed",
            scope=DeliveryScopeInput.TEAM,
        ),
    ],
)
# SMTP (email) integration
integration = adaptive.integrations.create(
    team="my-team",
    name="Failure alerts",
    provider="smtp",
    connection=ConnectionConfigInputSmtp(
        host="smtp.example.com",
        port=587,
        username="alerts@example.com",
        password="SMTP_PASSWORD",
        from_email="alerts@example.com",
        to_emails=["team@example.com"],
    ),
    subscriptions=[
        SubscriptionInput(
            topic_pattern="project:*:job:*:failed",
            scope=DeliveryScopeInput.TEAM,
        ),
    ],
)
# Webhook integration
integration = adaptive.integrations.create(
    team="my-team",
    name="Job webhook",
    provider="webhook",
    connection=ConnectionConfigInputWebhook(
        url="https://example.com/hooks/adaptive",
        method="POST",
        headers={"Authorization": "Bearer WEBHOOK_SECRET"},
    ),
    subscriptions=[
        SubscriptionInput(
            topic_pattern="project:*:job:**",
            scope=DeliveryScopeInput.TEAM,
        ),
    ],
)

Delivery policy

Control duplicate notification behavior with the delivery_policy parameter:
PolicyBehavior
multishotSend a notification every time (default)
singleshotSend only once per event
adaptive.integrations.create(
    team="my-team",
    name="One-shot alerts",
    provider="slack",
    connection=ConnectionConfigInputSlack(
        webhook_url="https://hooks.slack.com/services/T.../B.../xxx",
    ),
    subscriptions=[
        SubscriptionInput(
            topic_pattern="project:*:job:*:completed",
            scope=DeliveryScopeInput.TEAM,
        ),
    ],
    delivery_policy="singleshot",
)

Delivery scopes

Subscriptions include a scope that controls who the notification targets:
ScopeDescription
DeliveryScopeInput.USERDeliver to specific users
DeliveryScopeInput.TEAMDeliver to the team
DeliveryScopeInput.ORGANIZATIONDeliver to the organization
DeliveryScopeInput.ADMINDeliver to admins

Permissions

Creating and managing integrations requires integration:create, integration:read, integration:update, or integration:delete permissions. See Permissions for role configuration.