Implementation:869413421 Ai moive studio Catalog Resolve Model
| Knowledge Sources | |
|---|---|
| Domains | Architecture, Generative_AI |
| Last Updated | 2026-10-23 12:00 GMT |
Overview
Function that resolves a model name to its full configuration by intersecting public catalog availability, per-credential permissions, and server-side configuration.
Description
'catalog.resolve_model resolves a logical model name to a full configuration dict containing the provider-specific ID, profile, aspect ratios, durations, resolutions, voices, and other capabilities. It:
1. Calls get_catalog to fetch available models for the provider/credential 2. Filters candidates by type (text/image/audio/video) 3. Falls back to the default model if none specified 4. Returns the matching model config or raises an error
Usage
Import when resolving model configurations before generation calls. Called by GatewayProvider._model for every generation method.
Code Reference
Source Location
- Repository: ai-moive-studio
- File: backend/src/services/provider/catalog.py:L90-99
Signature
async def resolve_model(conn: Dict, token: str, model: str, kind: str) -> Dict:
"""
Args:
conn: connection info from registry
token: API key for permission check
model: model name (optional, falls back to default)
kind: model type (text/image/audio/video)
Returns:
Model config dict with id, profile, aspect_ratios, durations, etc.
"""
Import
from src.services.provider.catalog import resolve_model
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| conn | dict | Yes | Connection info from registry |
| token | str | Yes | API key for permission check |
| model | str | No | Model name (falls back to default) |
| kind | str | Yes | Model type: text/image/audio/video |
Outputs
| Name | Type | Description |
|---|---|---|
| return value | dict | Model config with id, profile, aspect_ratios, durations, resolutions, voices |
Usage Examples
Resolving a Model
from src.services.provider.catalog import resolve_model
from src.services.provider.registry import connection
conn = connection("openai", "https://api.openai.com/v1")
config = await resolve_model(conn, "sk-...", "gpt-4o", "text")
print(config) # {id: "gpt-4o", profile: "chat", ...}