Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: CentML AI Inference Provider Integration #810

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
32 changes: 32 additions & 0 deletions distributions/dependencies.json
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,38 @@
"sentence-transformers --no-deps",
"torch torchvision --index-url https://download.pytorch.org/whl/cpu"
],
"centml": [
"aiosqlite",
"autoevals",
"blobfile",
"chardet",
"chromadb-client",
"datasets",
"faiss-cpu",
"fastapi",
"fire",
"httpx",
"matplotlib",
"nltk",
"numpy",
"openai",
"opentelemetry-exporter-otlp-proto-http",
"opentelemetry-sdk",
"pandas",
"pillow",
"psycopg2-binary",
"pypdf",
"redis",
"requests",
"scikit-learn",
"scipy",
"sentencepiece",
"tqdm",
"transformers",
"uvicorn",
"sentence-transformers --no-deps",
"torch --index-url https://download.pytorch.org/whl/cpu"
],
"vllm-gpu": [
"aiosqlite",
"autoevals",
Expand Down
14 changes: 14 additions & 0 deletions llama_stack/providers/registry/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,4 +258,18 @@ def available_providers() -> List[ProviderSpec]:
provider_data_validator="llama_stack.providers.remote.inference.passthrough.PassthroughProviderDataValidator",
),
),
remote_provider_spec(
api=Api.inference,
adapter=AdapterSpec(
adapter_type="centml",
pip_packages=[
"openai",
],
module="llama_stack.providers.remote.inference.centml",
config_class=
"llama_stack.providers.remote.inference.centml.CentMLImplConfig",
provider_data_validator=
"llama_stack.providers.remote.inference.centml.CentMLProviderDataValidator",
),
),
]
31 changes: 31 additions & 0 deletions llama_stack/providers/remote/inference/centml/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the terms described in the LICENSE file in
# the root directory of this source tree.

from pydantic import BaseModel

from .config import CentMLImplConfig


class CentMLProviderDataValidator(BaseModel):
centml_api_key: str


async def get_adapter_impl(config: CentMLImplConfig, _deps):
"""
Factory function to construct and initialize the CentML adapter.

:param config: Instance of CentMLImplConfig, containing `url`, `api_key`, etc.
:param _deps: Additional dependencies provided by llama-stack (unused here).
"""
from .centml import CentMLInferenceAdapter

# Ensure the provided config is indeed a CentMLImplConfig
assert isinstance(config, CentMLImplConfig), f"Unexpected config type: {type(config)}"

# Instantiate and initialize the adapter
adapter = CentMLInferenceAdapter(config)
await adapter.initialize()
return adapter
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy