Skip to content

fix(llm, llamacpp): Loosen model ID validation#163

Merged
JeanMertz merged 1 commit intomainfrom
jean/llamacpp-models
Jun 27, 2025
Merged

fix(llm, llamacpp): Loosen model ID validation#163
JeanMertz merged 1 commit intomainfrom
jean/llamacpp-models

Conversation

@JeanMertz
Copy link
Collaborator

The validation logic for model IDs was too strict to support model names often used in the Llama.cpp ecosystem. For example, a model ID like llamacpp/bartowski_Qwen2.5-7B-Instruct-GGUF_Qwen2.5-7B-Instruct-Q4_K_M.gguf was previously rejected, but can now be used with JP.

Additionally, the model listing implementation was inadvertently left out of the implementation of the Llamacpp provider. This commit fixes that oversight.

It should be noted that it is not possible (unless the llama.cpp server is run with the --alias flag1) to get the proper model name from the API (instead, it points to the model file on disk), so in reality this implementation isn't particularly useful, but at least it doesn't panic anymore.

The validation logic for model IDs was too strict to support model names
often used in the Llama.cpp ecosystem. For example, a model ID like
`llamacpp/bartowski_Qwen2.5-7B-Instruct-GGUF_Qwen2.5-7B-Instruct-Q4_K_M.gguf`
was previously rejected, but can now be used with JP.

Additionally, the model listing implementation was inadvertently left
out of the implementation of the Llamacpp provider. This commit fixes
that oversight.

It should be noted that it is not possible (unless the llama.cpp server
is run with the `--alias` flag[1]) to get the proper model name from the
API (instead, it points to the model file on disk), so in reality this
implementation isn't particularly useful, but at least it doesn't panic
anymore.

[1]: https://github.com/ggml-org/llama.cpp/blob/8846aace4934ad29651ea61b8c7e3f6b0556e3d2/tools/server/README.md#get-v1models-openai-compatible-model-info-api

Signed-off-by: Jean Mertz <git@jeanmertz.com>
@JeanMertz JeanMertz merged commit 0296692 into main Jun 27, 2025
10 checks passed
@JeanMertz JeanMertz deleted the jean/llamacpp-models branch July 12, 2025 21:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant