> ## Documentation Index
> Fetch the complete documentation index at: https://www.adaline.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Deployment

# Deployment

Types related to prompt deployments in the Python SDK.

## Deployment

A specific instance of a prompt that has been deployed to an environment. Returned by [`get_deployment()`](/docs/reference/sdk/v2/python/classes/adaline#get_deployment) and [`get_latest_deployment()`](/docs/reference/sdk/v2/python/classes/adaline#get_latest_deployment).

```python theme={null}
from adaline_api.models.deployment import Deployment
```

### Fields

<ParamField body="id" type="str" required>
  The unique deployment identifier.
</ParamField>

<ParamField body="created_at" type="int" required>
  Unix timestamp of when the deployment was created.
</ParamField>

<ParamField body="updated_at" type="int" required>
  Unix timestamp of when the deployment was last updated.
</ParamField>

<ParamField body="created_by_user_id" type="str" required>
  The ID of the user who created the deployment.
</ParamField>

<ParamField body="updated_by_user_id" type="str" required>
  The ID of the user who last updated the deployment.
</ParamField>

<ParamField body="project_id" type="str" required>
  The associated project ID.
</ParamField>

<ParamField body="prompt_id" type="str" required>
  The associated prompt ID.
</ParamField>

<ParamField body="deployment_environment_id" type="str" required>
  The target deployment environment ID.
</ParamField>

<ParamField body="prompt" type="PromptSnapshot" required>
  The complete deployed prompt snapshot. See [PromptSnapshot](#promptsnapshot) below.
</ParamField>

### Example

```python theme={null}
from adaline.main import Adaline

adaline = Adaline()

deployment = await adaline.get_latest_deployment(
    prompt_id="prompt_abc123",
    deployment_environment_id="environment_abc123"
)

print(f"ID: {deployment.id}")
print(f"Project: {deployment.project_id}")
print(f"Prompt: {deployment.prompt_id}")
print(f"Environment: {deployment.deployment_environment_id}")
print(f"Model: {deployment.prompt.config.model}")
print(f"Provider: {deployment.prompt.config.provider_name}")
print(f"Messages: {len(deployment.prompt.messages)}")
print(f"Tools: {len(deployment.prompt.tools)}")
print(f"Created at: {deployment.created_at}")
```

***

## PromptSnapshot

See the dedicated [PromptSnapshot](/docs/reference/sdk/v2/python/types/PromptSnapshot) page for full documentation.

The complete prompt configuration captured at deployment time, including model config, messages, tools, and variables.

```python theme={null}
from adaline_api.models.prompt_snapshot import PromptSnapshot
```

### Fields

<ParamField body="config" type="PromptSnapshotConfig" required>
  Model provider and settings. See [Config Types](/docs/reference/sdk/v2/python/types/PromptSnapshotConfig).
</ParamField>

<ParamField body="messages" type="list[PromptMessage]" required>
  The prompt messages. Each message contains role and content fields.
</ParamField>

<ParamField body="tools" type="list[ToolFunction]" required>
  Tool/function definitions available to the model.
</ParamField>

<ParamField body="variables" type="list[PromptVariable]" required>
  Variable definitions used in the prompt template. See [PromptVariable](#promptvariable) below.
</ParamField>

***

## PromptVariable

See the dedicated [PromptVariable](/docs/reference/sdk/v2/python/types/PromptVariable) page for full documentation.

A variable definition used in prompt templates.

```python theme={null}
from adaline_api.models.prompt_variable import PromptVariable
```

### Fields

<ParamField body="name" type="str" required>
  The variable name (used as `{{variable_name}}` in prompt templates).
</ParamField>

<ParamField body="modality" type="str" required>
  The variable type. One of: `"text"`, `"image"`, `"pdf"`, `"api"`, `"prompt"`.
</ParamField>

### Example

```python theme={null}
deployment = await adaline.get_latest_deployment(
    prompt_id="prompt_abc123",
    deployment_environment_id="environment_abc123"
)

for variable in deployment.prompt.variables:
    print(f"{variable.name} ({variable.modality})")
    # e.g. "user_name (text)", "document (pdf)"
```

***

## Complete Example

```python theme={null}
from adaline.main import Adaline
from openai import OpenAI

adaline = Adaline()
openai_client = OpenAI()

async def use_deployment():
    deployment = await adaline.get_latest_deployment(
        prompt_id="prompt_abc123",
        deployment_environment_id="environment_abc123"
    )

    prompt = deployment.prompt
    config = prompt.config

    print(f"Provider: {config.provider_name}")
    print(f"Model: {config.model}")
    print(f"Settings: {config.settings}")
    print(f"Messages: {len(prompt.messages)}")
    print(f"Tools: {len(prompt.tools)}")
    print(f"Variables: {[v.name for v in prompt.variables]}")

    # Build provider-specific messages from the deployment's prompt messages
    messages = [...]

    response = openai_client.chat.completions.create(
        model=config.model,
        messages=messages,
        temperature=config.settings.get("temperature"),
        max_tokens=config.settings.get("maxTokens"),
    )

    return response.choices[0].message.content
```
