add async to get_model signature in Protocol

Signed-off-by: Ihar Hrachyshka <ihar.hrachyshka@gmail.com>
This commit is contained in:
Ihar Hrachyshka 2025-03-25 18:25:58 -04:00
parent 6aedfc2201
commit fcf3b0a835
3 changed files with 7 additions and 7 deletions

View file

@ -103,7 +103,7 @@ class OllamaInferenceAdapter(Inference, ModelsProtocolPrivate):
assert self.model_store is not None
if sampling_params is None:
sampling_params = SamplingParams()
model = self.model_store.get_model(model_id)
model = await self.model_store.get_model(model_id)
request = CompletionRequest(
model=model.provider_resource_id,
content=content,
@ -167,7 +167,7 @@ class OllamaInferenceAdapter(Inference, ModelsProtocolPrivate):
assert self.model_store is not None
if sampling_params is None:
sampling_params = SamplingParams()
model = self.model_store.get_model(model_id)
model = await self.model_store.get_model(model_id)
request = ChatCompletionRequest(
model=model.provider_resource_id,
messages=messages,
@ -287,7 +287,7 @@ class OllamaInferenceAdapter(Inference, ModelsProtocolPrivate):
task_type: Optional[EmbeddingTaskType] = None,
) -> EmbeddingsResponse:
assert self.model_store is not None
model = self.model_store.get_model(model_id)
model = await self.model_store.get_model(model_id)
assert all(not content_has_media(content) for content in contents), (
"Ollama does not support media for embeddings"