Allow to set a SetLibrarySearchPath in the golang bindings (#981)

This is used to identify the path where all the various implementations
are
This commit is contained in:
Ettore Di Giacinto
2023-06-14 16:27:19 +02:00
committed by GitHub
parent 8953b7f6a6
commit b004c53a7b
3 changed files with 15 additions and 2 deletions

View File

@@ -10,6 +10,7 @@ package gpt4all
// float top_p, float temp, int n_batch,float ctx_erase);
// void free_model(void *state_ptr);
// extern unsigned char getTokenCallback(void *, char *);
// void llmodel_set_implementation_search_path(const char *path);
import "C"
import (
"fmt"
@@ -27,6 +28,10 @@ type Model struct {
func New(model string, opts ...ModelOption) (*Model, error) {
ops := NewModelOptions(opts...)
if ops.LibrarySearchPath != "" {
C.llmodel_set_implementation_search_path(C.CString(ops.LibrarySearchPath))
}
state := C.load_model(C.CString(model), C.int(ops.Threads))
if state == nil {