Skip to content

Get up and running with Kimi, GLM, MiniMax, DeepSeek, gpt-oss, Qwen, Gemma and other models.

error checking new model

Michael Yangc5f7eadd8767
diff --git a/llama/llama.go b/llama/llama.go
index b64acd7e8..af452f97a 100644
--- a/llama/llama.go
+++ b/llama/llama.go
@@ -123,7 +123,14 @@ func New(model string, opts api.Options) (*llama, error) {
defer C.free(unsafe.Pointer(cModel))
llm.model = C.llama_load_model_from_file(cModel, params)
+ if llm.model == nil {
+ return nil, errors.New("failed to load model")
+ }
+
llm.ctx = C.llama_new_context_with_model(llm.model, params)
+ if llm.ctx == nil {
+ return nil, errors.New("failed to create context")
+ }
// warm up the model
bos := []C.llama_token{C.llama_token_bos()}