Skip to content

Commit f0a34dc

Browse files
Raise exception if not llamacpp models are found (#927)
1 parent 7dd4019 commit f0a34dc

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/codegate/providers/llamacpp/provider.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,16 @@ def models(self, endpoint: str = None, api_key: str = None) -> List[str]:
3838
if not models_path.is_dir():
3939
raise ModelFetchError(f"llamacpp model path does not exist: {models_path}")
4040

41-
# return all models except the all-minilm-L6-v2-q5_k_m model which we use for embeddings
42-
return [
41+
# get all models except the all-minilm-L6-v2-q5_k_m model which we use for embeddings
42+
found_models = [
4343
model.stem
4444
for model in models_path.glob("*.gguf")
4545
if model.is_file() and model.stem != "all-minilm-L6-v2-q5_k_m"
4646
]
47+
if len(found_models) == 0:
48+
raise ModelFetchError("Not found models for llamacpp provider")
49+
50+
return found_models
4751

4852
async def process_request(
4953
self,

0 commit comments

Comments
 (0)