fix: use model-id

Signed-off-by: Jeff MAURY <jmaury@redhat.com>
This commit is contained in:
Jeff MAURY 2025-04-03 19:06:17 +02:00 committed by Philippe Martin
parent 0397c0cd44
commit cfc68012f7

View file

@ -150,9 +150,8 @@ class PodmanAILabInferenceAdapter(Inference, ModelsProtocolPrivate):
) -> AsyncGenerator: ) -> AsyncGenerator:
if sampling_params is None: if sampling_params is None:
sampling_params = SamplingParams() sampling_params = SamplingParams()
model = await self.model_store.get_model(model_id)
request = ChatCompletionRequest( request = ChatCompletionRequest(
model=model.provider_resource_id, model=model_id,
messages=messages, messages=messages,
sampling_params=sampling_params, sampling_params=sampling_params,
tools=tools or [], tools=tools or [],
@ -175,7 +174,7 @@ class PodmanAILabInferenceAdapter(Inference, ModelsProtocolPrivate):
input_dict = {} input_dict = {}
media_present = request_has_media(request) media_present = request_has_media(request)
llama_model = self.register_helper.get_llama_model(request.model) llama_model = request.model
if isinstance(request, ChatCompletionRequest): if isinstance(request, ChatCompletionRequest):
if media_present or not llama_model: if media_present or not llama_model:
contents = [await convert_message_to_openai_dict_for_podman_ai_lab(m) for m in request.messages] contents = [await convert_message_to_openai_dict_for_podman_ai_lab(m) for m in request.messages]
@ -292,3 +291,7 @@ async def convert_message_to_openai_dict_for_podman_ai_lab(message: Message) ->
return [await _convert_content(c) for c in message.content] return [await _convert_content(c) for c in message.content]
else: else:
return [await _convert_content(message.content)] return [await _convert_content(message.content)]
async def register_model(self, model: Model) -> Model:
return model