Skip to content

Commit

Permalink
Fixed bug #17
Browse files Browse the repository at this point in the history
  • Loading branch information
c0sogi committed Sep 17, 2023
1 parent f118098 commit 6b254fd
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions llama_api/utils/model_definition_finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,14 @@ def get_llm_model_from_request_body(
"""Get the LLaMA model from the request body. If the model is an
OpenAI model, it is mapped to the corresponding LLaMA model."""
model_maps, oai_maps = cls.get_model_mappings()
if body.model in oai_maps:
body.model = oai_maps[body.model]
model_name = body.model.lower()
if model_name in oai_maps:
model_name = oai_maps[model_name]
body.model = model_name
body.is_openai = True
return model_maps[body.model]
elif body.model in model_maps:
return model_maps[body.model]
return model_maps[model_name]
elif model_name in model_maps:
return model_maps[model_name]
else:
logger.warning(
f"Model {body.model} not found in your model definitions. "
Expand Down Expand Up @@ -170,6 +172,7 @@ def _collect_from_environs(
llm_models = {} # type: Dict[str, BaseLLMModel]
if model_definitions is not None:
for key, value in model_definitions.items():
key = key.lower()
if isinstance(value, dict) and "type" in value:
type = value.pop("type")
if type.lower() in cls.LLAMA_CPP_KEYS:
Expand Down

0 comments on commit 6b254fd

Please sign in to comment.