Skip to content

Raise exception if not llamacpp models are found #927

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 5, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/codegate/providers/llamacpp/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,16 @@ def models(self, endpoint: str = None, api_key: str = None) -> List[str]:
if not models_path.is_dir():
raise ModelFetchError(f"llamacpp model path does not exist: {models_path}")

# return all models except the all-minilm-L6-v2-q5_k_m model which we use for embeddings
return [
# get all models except the all-minilm-L6-v2-q5_k_m model which we use for embeddings
found_models = [
model.stem
for model in models_path.glob("*.gguf")
if model.is_file() and model.stem != "all-minilm-L6-v2-q5_k_m"
]
if len(found_models) == 0:
raise ModelFetchError("Not found models for llamacpp provider")

return found_models

async def process_request(
self,
Expand Down