Elffuss BraidHub

kikocis/llama-stack public

3fc339af16ee · 806 BRawPermalink
1# Copyright (c) Meta Platforms, Inc. and affiliates.
2# All rights reserved.
3#
4# This source code is licensed under the terms described in the LICENSE file in
5# the root directory of this source tree.
6
7from .config import TGIImplConfig
8from .tgi import InferenceEndpointAdapter, TGIAdapter
9
10
11async def get_adapter_impl(config: TGIImplConfig, _deps):
12 assert isinstance(config, TGIImplConfig), f"Unexpected config type: {type(config)}"
13
14 if config.url is not None:
15 impl = TGIAdapter(config)
16 elif config.is_inference_endpoint():
17 impl = InferenceEndpointAdapter(config)
18 else:
19 raise ValueError(
20 "Invalid configuration. Specify either an URL or HF Inference Endpoint details (namespace and endpoint name)."
21 )
22
23 await impl.initialize()
24 return impl