# epam/ai-dial-adapter-vertexai architecture

> Architecture diagram of the GitHub repository epam/ai-dial-adapter-vertexai, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/epam/ai-dial-adapter-vertexai
- Repository: https://github.com/epam/ai-dial-adapter-vertexai

## Overview

This repository is a DIAL API adapter that translates chat-completion and embedding requests into calls to Vertex AI and related model providers. The main workflow enters the adapter app, resolves model deployments and upstream configuration, dispatches model-specific chat or embedding behavior, and returns DIAL responses; chat also handles attachments, tools, and multimodal content. The README documents additional media-generation, grounding, transcription, and Anthropic passthrough capabilities. The supplied excerpts and index show only selected wiring, so uncertain internal dispatch links are omitted.

Main entry points: [`aidial_adapter_vertexai/chat/chat_completion_adapter.py`](https://github.com/epam/ai-dial-adapter-vertexai/blob/development/aidial_adapter_vertexai/chat/chat_completion_adapter.py) (Chat adapter core), [`aidial_adapter_vertexai/app.py`](https://github.com/epam/ai-dial-adapter-vertexai/blob/development/aidial_adapter_vertexai/app.py) (Adapter app), [`aidial_adapter_vertexai/chat_completion.py`](https://github.com/epam/ai-dial-adapter-vertexai/blob/development/aidial_adapter_vertexai/chat_completion.py) (Chat endpoints), [`aidial_adapter_vertexai/chat/gemini/adapter.py`](https://github.com/epam/ai-dial-adapter-vertexai/blob/development/aidial_adapter_vertexai/chat/gemini/adapter.py) (Gemini chat)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["API entry"]
  node_app["Adapter app<br/>[app.py]"]
  node_chat_routes["Chat endpoints<br/>[chat_completion.py]"]
  node_embed_routes["Embedding endpoints<br/>[embeddings.py]"]
  node_passthrough["Anthropic passthrough"]
end

subgraph group_chat["Chat models"]
  node_chat_core["Chat adapter core"]
  node_gemini["Gemini chat<br/>[adapter.py]"]
  node_claude["Claude chat<br/>[adapter.py]"]
  node_mistral["Mistral prompts<br/>[prompt.py]"]
  node_imagen["Imagen generation<br/>[adapter.py]"]
  node_veo["Veo generation<br/>[adapter.py]"]
  node_consumer["Response consumer<br/>[consumer.py]"]
  node_tools["Tool handling<br/>[tools.py]"]
  node_static_tools["Static tools<br/>[static_tools.py]"]
  node_truncate["Prompt truncation<br/>[truncate_prompt.py]"]
end

subgraph group_embed["Embeddings"]
  node_embed_core["Embedding adapter"]
  node_genai_embed["GenAI embeddings<br/>[genai.py]"]
  node_multimodal_embed["Multimodal embeddings<br/>[multi_modal.py]"]
end

subgraph group_shared["Shared services"]
  node_deployment["Deployment catalog<br/>[deployments.py]"]
  node_resolve["Deployment resolution"]
  node_upstream["Upstream configuration<br/>[upstream_config.py]"]
  node_request["DIAL request models<br/>[request.py]"]
  node_resource["Resource conversion<br/>[resource.py]"]
  node_storage["Attachment storage<br/>[storage.py]"]
  node_vertex["Vertex AI clients<br/>[clients.py]"]
  node_vertex_api["Vertex AI interface<br/>[vertex_ai.py]"]
end

node_client(("DIAL client"))

node_client -->|"sends request"| node_app
node_app -->|"registers"| node_chat_routes
node_app -->|"registers"| node_embed_routes
node_app -->|"registers"| node_passthrough
node_chat_routes -.->|"dispatches chat"| node_chat_core
node_embed_routes -.->|"dispatches embeddings"| node_embed_core
node_embed_core -->|"implements"| node_genai_embed
node_embed_core -->|"implements"| node_multimodal_embed
node_genai_embed -->|"parses inputs"| node_request
node_genai_embed -->|"uses resources"| node_resource
node_multimodal_embed -->|"calls"| node_vertex_api
node_multimodal_embed -->|"uses resources"| node_resource
node_resource -->|"downloads via"| node_storage
node_chat_core -.->|"streams through"| node_consumer
node_gemini -->|"extends"| node_chat_core
node_claude -->|"extends"| node_chat_core
node_imagen -->|"extends"| node_chat_core
node_veo -->|"extends"| node_chat_core
node_claude -->|"uses"| node_tools
node_claude -->|"uses"| node_static_tools
node_gemini -->|"uses"| node_tools
node_gemini -->|"uses"| node_static_tools
node_chat_routes -.->|"resolves deployment"| node_resolve
node_resolve -->|"validates against"| node_deployment
node_resolve -->|"reads compatible ID"| node_upstream
node_vertex -.->|"builds provider clients"| node_upstream
node_app -.->|"initializes"| node_vertex
node_chat_routes -.->|"accepts DIAL requests"| node_request
node_chat_routes -.->|"offers truncation"| node_truncate
node_gemini -.->|"not connected"| node_mistral

click node_app "https://github.com/epam/ai-dial-adapter-vertexai/blob/development/aidial_adapter_vertexai/app.py"
click node_chat_routes "https://github.com/epam/ai-dial-adapter-vertexai/blob/development/aidial_adapter_vertexai/chat_completion.py"
click node_embed_routes "https://github.com/epam/ai-dial-adapter-vertexai/blob/development/aidial_adapter_vertexai/embeddings.py"
click node_passthrough "https://github.com/epam/ai-dial-adapter-vertexai/blob/development/aidial_adapter_vertexai/anthropic_passthrough.py"
click node_chat_core "https://github.com/epam/ai-dial-adapter-vertexai/blob/development/aidial_adapter_vertexai/chat/chat_completion_adapter.py"
click node_gemini "https://github.com/epam/ai-dial-adapter-vertexai/blob/development/aidial_adapter_vertexai/chat/gemini/adapter.py"
click node_claude "https://github.com/epam/ai-dial-adapter-vertexai/blob/development/aidial_adapter_vertexai/chat/claude/adapter.py"
click node_mistral "https://github.com/epam/ai-dial-adapter-vertexai/blob/development/aidial_adapter_vertexai/chat/mistral/prompt.py"
click node_imagen "https://github.com/epam/ai-dial-adapter-vertexai/blob/development/aidial_adapter_vertexai/chat/imagen/adapter.py"
click node_veo "https://github.com/epam/ai-dial-adapter-vertexai/blob/development/aidial_adapter_vertexai/chat/veo/adapter.py"
click node_consumer "https://github.com/epam/ai-dial-adapter-vertexai/blob/development/aidial_adapter_vertexai/chat/consumer.py"
click node_tools "https://github.com/epam/ai-dial-adapter-vertexai/blob/development/aidial_adapter_vertexai/chat/tools.py"
click node_static_tools "https://github.com/epam/ai-dial-adapter-vertexai/blob/development/aidial_adapter_vertexai/chat/static_tools.py"
click node_truncate "https://github.com/epam/ai-dial-adapter-vertexai/blob/development/aidial_adapter_vertexai/chat/truncate_prompt.py"
click node_embed_core "https://github.com/epam/ai-dial-adapter-vertexai/blob/development/aidial_adapter_vertexai/embedding/embeddings_adapter.py"
click node_genai_embed "https://github.com/epam/ai-dial-adapter-vertexai/blob/development/aidial_adapter_vertexai/embedding/genai.py"
click node_multimodal_embed "https://github.com/epam/ai-dial-adapter-vertexai/blob/development/aidial_adapter_vertexai/embedding/multi_modal.py"
click node_deployment "https://github.com/epam/ai-dial-adapter-vertexai/blob/development/aidial_adapter_vertexai/deployments.py"
click node_resolve "https://github.com/epam/ai-dial-adapter-vertexai/blob/development/aidial_adapter_vertexai/utils/adapter_deployments.py"
click node_upstream "https://github.com/epam/ai-dial-adapter-vertexai/blob/development/aidial_adapter_vertexai/upstream_config.py"
click node_request "https://github.com/epam/ai-dial-adapter-vertexai/blob/development/aidial_adapter_vertexai/dial_api/request.py"
click node_resource "https://github.com/epam/ai-dial-adapter-vertexai/blob/development/aidial_adapter_vertexai/dial_api/resource.py"
click node_storage "https://github.com/epam/ai-dial-adapter-vertexai/blob/development/aidial_adapter_vertexai/dial_api/storage.py"
click node_vertex "https://github.com/epam/ai-dial-adapter-vertexai/blob/development/aidial_adapter_vertexai/clients.py"
click node_vertex_api "https://github.com/epam/ai-dial-adapter-vertexai/blob/development/aidial_adapter_vertexai/vertex_ai.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_chat_routes,node_embed_routes,node_passthrough,node_client toneBlue
class node_chat_core,node_gemini,node_claude,node_mistral,node_imagen,node_veo,node_consumer,node_tools,node_static_tools,node_truncate toneAmber
class node_embed_core,node_genai_embed,node_multimodal_embed toneMint
class node_deployment,node_resolve,node_upstream,node_request,node_resource,node_storage,node_vertex,node_vertex_api toneRose
```

## Components

### API entry

- [Adapter app](https://github.com/epam/ai-dial-adapter-vertexai/blob/development/aidial_adapter_vertexai/app.py): `aidial_adapter_vertexai/app.py`
- [Chat endpoints](https://github.com/epam/ai-dial-adapter-vertexai/blob/development/aidial_adapter_vertexai/chat_completion.py): `aidial_adapter_vertexai/chat_completion.py`
- [Embedding endpoints](https://github.com/epam/ai-dial-adapter-vertexai/blob/development/aidial_adapter_vertexai/embeddings.py): `aidial_adapter_vertexai/embeddings.py`
- [Anthropic passthrough](https://github.com/epam/ai-dial-adapter-vertexai/blob/development/aidial_adapter_vertexai/anthropic_passthrough.py): `aidial_adapter_vertexai/anthropic_passthrough.py`

### Chat models

- [Chat adapter core](https://github.com/epam/ai-dial-adapter-vertexai/blob/development/aidial_adapter_vertexai/chat/chat_completion_adapter.py): `aidial_adapter_vertexai/chat/chat_completion_adapter.py`
- [Gemini chat](https://github.com/epam/ai-dial-adapter-vertexai/blob/development/aidial_adapter_vertexai/chat/gemini/adapter.py): `aidial_adapter_vertexai/chat/gemini/adapter.py`
- [Claude chat](https://github.com/epam/ai-dial-adapter-vertexai/blob/development/aidial_adapter_vertexai/chat/claude/adapter.py): `aidial_adapter_vertexai/chat/claude/adapter.py`
- [Mistral prompts](https://github.com/epam/ai-dial-adapter-vertexai/blob/development/aidial_adapter_vertexai/chat/mistral/prompt.py): `aidial_adapter_vertexai/chat/mistral/prompt.py`
- [Imagen generation](https://github.com/epam/ai-dial-adapter-vertexai/blob/development/aidial_adapter_vertexai/chat/imagen/adapter.py): `aidial_adapter_vertexai/chat/imagen/adapter.py`
- [Veo generation](https://github.com/epam/ai-dial-adapter-vertexai/blob/development/aidial_adapter_vertexai/chat/veo/adapter.py): `aidial_adapter_vertexai/chat/veo/adapter.py`
- [Response consumer](https://github.com/epam/ai-dial-adapter-vertexai/blob/development/aidial_adapter_vertexai/chat/consumer.py): `aidial_adapter_vertexai/chat/consumer.py`
- [Tool handling](https://github.com/epam/ai-dial-adapter-vertexai/blob/development/aidial_adapter_vertexai/chat/tools.py): `aidial_adapter_vertexai/chat/tools.py`
- [Static tools](https://github.com/epam/ai-dial-adapter-vertexai/blob/development/aidial_adapter_vertexai/chat/static_tools.py): `aidial_adapter_vertexai/chat/static_tools.py`
- [Prompt truncation](https://github.com/epam/ai-dial-adapter-vertexai/blob/development/aidial_adapter_vertexai/chat/truncate_prompt.py): `aidial_adapter_vertexai/chat/truncate_prompt.py`

### Embeddings

- [Embedding adapter](https://github.com/epam/ai-dial-adapter-vertexai/blob/development/aidial_adapter_vertexai/embedding/embeddings_adapter.py): `aidial_adapter_vertexai/embedding/embeddings_adapter.py`
- [GenAI embeddings](https://github.com/epam/ai-dial-adapter-vertexai/blob/development/aidial_adapter_vertexai/embedding/genai.py): `aidial_adapter_vertexai/embedding/genai.py`
- [Multimodal embeddings](https://github.com/epam/ai-dial-adapter-vertexai/blob/development/aidial_adapter_vertexai/embedding/multi_modal.py): `aidial_adapter_vertexai/embedding/multi_modal.py`

### Shared services

- [Deployment catalog](https://github.com/epam/ai-dial-adapter-vertexai/blob/development/aidial_adapter_vertexai/deployments.py): `aidial_adapter_vertexai/deployments.py`
- [Deployment resolution](https://github.com/epam/ai-dial-adapter-vertexai/blob/development/aidial_adapter_vertexai/utils/adapter_deployments.py): `aidial_adapter_vertexai/utils/adapter_deployments.py`
- [Upstream configuration](https://github.com/epam/ai-dial-adapter-vertexai/blob/development/aidial_adapter_vertexai/upstream_config.py): `aidial_adapter_vertexai/upstream_config.py`
- [DIAL request models](https://github.com/epam/ai-dial-adapter-vertexai/blob/development/aidial_adapter_vertexai/dial_api/request.py): `aidial_adapter_vertexai/dial_api/request.py`
- [Resource conversion](https://github.com/epam/ai-dial-adapter-vertexai/blob/development/aidial_adapter_vertexai/dial_api/resource.py): `aidial_adapter_vertexai/dial_api/resource.py`
- [Attachment storage](https://github.com/epam/ai-dial-adapter-vertexai/blob/development/aidial_adapter_vertexai/dial_api/storage.py): `aidial_adapter_vertexai/dial_api/storage.py`
- [Vertex AI clients](https://github.com/epam/ai-dial-adapter-vertexai/blob/development/aidial_adapter_vertexai/clients.py): `aidial_adapter_vertexai/clients.py`
- [Vertex AI interface](https://github.com/epam/ai-dial-adapter-vertexai/blob/development/aidial_adapter_vertexai/vertex_ai.py): `aidial_adapter_vertexai/vertex_ai.py`

### Other components

- **DIAL client**

## Connections

- DIAL client → Adapter app: sends request
- Adapter app → Chat endpoints: registers (evidence: `aidial_adapter_vertexai/app.py`)
- Adapter app → Embedding endpoints: registers (evidence: `aidial_adapter_vertexai/app.py`)
- Adapter app → Anthropic passthrough: registers (evidence: `aidial_adapter_vertexai/app.py`)
- Chat endpoints → Chat adapter core: dispatches chat (evidence: `aidial_adapter_vertexai/chat_completion.py`)
- Embedding endpoints → Embedding adapter: dispatches embeddings
- Embedding adapter → GenAI embeddings: implements (evidence: `aidial_adapter_vertexai/embedding/genai.py`)
- Embedding adapter → Multimodal embeddings: implements (evidence: `aidial_adapter_vertexai/embedding/multi_modal.py`)
- GenAI embeddings → DIAL request models: parses inputs (evidence: `aidial_adapter_vertexai/embedding/genai.py`)
- GenAI embeddings → Resource conversion: uses resources (evidence: `aidial_adapter_vertexai/embedding/genai.py`)
- Multimodal embeddings → Vertex AI interface: calls (evidence: `aidial_adapter_vertexai/embedding/multi_modal.py`)
- Multimodal embeddings → Resource conversion: uses resources (evidence: `aidial_adapter_vertexai/embedding/multi_modal.py`)
- Resource conversion → Attachment storage: downloads via (evidence: `aidial_adapter_vertexai/dial_api/resource.py`)
- Chat adapter core → Response consumer: streams through (evidence: `aidial_adapter_vertexai/chat/chat_completion_adapter.py`)
- Gemini chat → Chat adapter core: extends (evidence: `aidial_adapter_vertexai/chat/gemini/adapter.py`)
- Claude chat → Chat adapter core: extends (evidence: `aidial_adapter_vertexai/chat/claude/adapter.py`)
- Imagen generation → Chat adapter core: extends (evidence: `aidial_adapter_vertexai/chat/imagen/adapter.py`)
- Veo generation → Chat adapter core: extends (evidence: `aidial_adapter_vertexai/chat/veo/adapter.py`)
- Claude chat → Tool handling: uses (evidence: `aidial_adapter_vertexai/chat/claude/adapter.py`)
- Claude chat → Static tools: uses (evidence: `aidial_adapter_vertexai/chat/claude/adapter.py`)
- Gemini chat → Tool handling: uses (evidence: `aidial_adapter_vertexai/chat/gemini/adapter.py`)
- Gemini chat → Static tools: uses (evidence: `aidial_adapter_vertexai/chat/gemini/adapter.py`)
- Chat endpoints → Deployment resolution: resolves deployment (evidence: `aidial_adapter_vertexai/chat_completion.py`)
- Deployment resolution → Deployment catalog: validates against (evidence: `aidial_adapter_vertexai/utils/adapter_deployments.py`)
- Deployment resolution → Upstream configuration: reads compatible ID (evidence: `aidial_adapter_vertexai/utils/adapter_deployments.py`)
- Vertex AI clients → Upstream configuration: builds provider clients (evidence: `aidial_adapter_vertexai/upstream_config.py`)
- Adapter app → Vertex AI clients: initializes (evidence: `aidial_adapter_vertexai/app.py`)
- Chat endpoints → DIAL request models: accepts DIAL requests (evidence: `aidial_adapter_vertexai/chat_completion.py`)
- Chat endpoints → Prompt truncation: offers truncation
- Gemini chat → Mistral prompts: not connected
