mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-06-28 19:04:19 +00:00
Pass Ollama config into inference adapter vs config attributes
This simplifies the passing of config attributes when constructing the Ollama inference adapter so that we just pass the config in instead of every attribute on the config as a separate parameter. Signed-off-by: Ben Browning <bbrownin@redhat.com>
This commit is contained in:
parent
404708e99d
commit
497c97487f
2 changed files with 5 additions and 4 deletions
|
@ -10,6 +10,6 @@ from .config import OllamaImplConfig
|
||||||
async def get_adapter_impl(config: OllamaImplConfig, _deps):
|
async def get_adapter_impl(config: OllamaImplConfig, _deps):
|
||||||
from .ollama import OllamaInferenceAdapter
|
from .ollama import OllamaInferenceAdapter
|
||||||
|
|
||||||
impl = OllamaInferenceAdapter(config.url, raise_on_connect_error=config.raise_on_connect_error)
|
impl = OllamaInferenceAdapter(config)
|
||||||
await impl.initialize()
|
await impl.initialize()
|
||||||
return impl
|
return impl
|
||||||
|
|
|
@ -56,6 +56,7 @@ from llama_stack.providers.datatypes import (
|
||||||
HealthStatus,
|
HealthStatus,
|
||||||
ModelsProtocolPrivate,
|
ModelsProtocolPrivate,
|
||||||
)
|
)
|
||||||
|
from llama_stack.providers.remote.inference.ollama.config import OllamaImplConfig
|
||||||
from llama_stack.providers.utils.inference.model_registry import (
|
from llama_stack.providers.utils.inference.model_registry import (
|
||||||
ModelRegistryHelper,
|
ModelRegistryHelper,
|
||||||
)
|
)
|
||||||
|
@ -89,10 +90,10 @@ class OllamaInferenceAdapter(
|
||||||
InferenceProvider,
|
InferenceProvider,
|
||||||
ModelsProtocolPrivate,
|
ModelsProtocolPrivate,
|
||||||
):
|
):
|
||||||
def __init__(self, url: str, raise_on_connect_error: bool = True) -> None:
|
def __init__(self, config: OllamaImplConfig) -> None:
|
||||||
self.register_helper = ModelRegistryHelper(MODEL_ENTRIES)
|
self.register_helper = ModelRegistryHelper(MODEL_ENTRIES)
|
||||||
self.url = url
|
self.url = config.url
|
||||||
self.raise_on_connect_error = raise_on_connect_error
|
self.raise_on_connect_error = config.raise_on_connect_error
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def client(self) -> AsyncClient:
|
def client(self) -> AsyncClient:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue