Skip to content

Commit

Permalink
Fix missing pipeline implementations.
Browse files Browse the repository at this point in the history
  • Loading branch information
manstis committed Jan 24, 2025
1 parent d6e5c61 commit b6e1179
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
26 changes: 26 additions & 0 deletions ansible_ai_connect/ai/api/model_pipelines/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import logging
from typing import get_args

import ansible_ai_connect.ai.api.model_pipelines.dummy.configuration # noqa
import ansible_ai_connect.ai.api.model_pipelines.dummy.pipelines # noqa
import ansible_ai_connect.ai.api.model_pipelines.grpc.configuration # noqa
Expand All @@ -17,3 +20,26 @@
import ansible_ai_connect.ai.api.model_pipelines.wca.pipelines_dummy # noqa
import ansible_ai_connect.ai.api.model_pipelines.wca.pipelines_onprem # noqa
import ansible_ai_connect.ai.api.model_pipelines.wca.pipelines_saas # noqa
from ansible_ai_connect.ai.api.model_pipelines.registry import REGISTRY
from ansible_ai_connect.main.settings.types import t_model_mesh_api_type

logger = logging.getLogger(__name__)


def set_defaults(pipeline_provider):

def v_or_default(k, v):
defaults = REGISTRY["nop"]
if v is None:
logger.warning(
f"'{k.alias()}' is not available for provider={pipeline_provider},"
" failing back to 'nop'"
)
return defaults[k]
return v

return {k: v_or_default(k, v) for k, v in REGISTRY[pipeline_provider].items()}


for model_mesh_api_type in get_args(t_model_mesh_api_type):
REGISTRY[model_mesh_api_type] = set_defaults(model_mesh_api_type)
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@ def __init__(self, **kwargs):


@Register(api_type="nop")
class LlamaCppConfigurationSerializer(serializers.Serializer):
class NopConfigurationSerializer(serializers.Serializer):
pass

0 comments on commit b6e1179

Please sign in to comment.