Platforms to show: All Mac Windows Linux Cross-Platform

Back to LlamaMBS module.

LlamaMBS.ApplyChatTemplate(Template as String, ChatMessages() as LlamaChatMessageMBS, AddAssistentTokens as boolean) as String

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Llama MBS Tools Plugin 26.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Apply chat template.

Template: The Jinja template to use for this chat.
ChatMessages: a list of multiple llama_chat_message
AddAssistentTokens: Whether to end the prompt with the token(s) that indicate the start of an assistant message.

Returns the answer. May raise LlamaExceptionMBS class if the apply process fails.

Some examples using this method:

LlamaMBS.BackendInit

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Llama MBS Tools Plugin 25.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Initialize the llama + ggml backend.

If numa is true, use NUMA optimizations
Call once at the start of the program

LlamaMBS.BackendLoad(Path as String) as Boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Llama MBS Tools Plugin 26.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Loads a specific backend library.

Please pass DLL, dylib or so path.

LlamaMBS.BackendLoadAll

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Llama MBS Tools Plugin 25.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Loads all backends.
Example
// load dynamic backends

LlamaMBS.BackendLoadAll

Needs ggml library loaded.

Some examples using this method:

LlamaMBS.Backends as LlamaBackendMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Llama MBS Tools Plugin 26.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Queries the backends available.
Example
// load dynamic backends
LlamaMBS.BackendLoadAll

// now inspect them
var backends() as LlamaBackendMBS = LlamaMBS.Backends
for each backend as LlamaBackendMBS in backends
var devices() as LlamaDeviceMBS = backend.Devices
var name as string = backend.Name
var features as Dictionary = backend.Features

Break
next

Each backend has a list of devices with properties.

Some examples using this method:

LlamaMBS.ChatBuiltInTemplates as String()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Llama MBS Tools Plugin 25.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Get list of built-in chat templates.

LlamaMBS.Loaded as Boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Llama MBS Tools Plugin 25.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Whether the llama library is loaded.

LlamaMBS.LoadErrorMessage as String

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Llama MBS Tools Plugin 25.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
The error message from the last LoadLibrary call.

LlamaMBS.LoadLibrary(File as FolderItem) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Llama MBS Tools Plugin 25.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Loads the llama library.

For Windows you need llama.dll, for macOS you need llama.dylib and for Linux you need llama.so.

On Windows you need to load ggml.dll, ggml-base.dll and llama.dll to have all functions.

Returns true on success and false on failure.

See also:

LlamaMBS.LoadLibrary(Path as String) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Llama MBS Tools Plugin 25.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Loads the llama library.
Example
If Not LlamaMBS.LoadLibrary("/opt/homebrew/Cellar/llama.cpp/6710/lib/libllama.dylib") Then
System.DebugLog LlamaMBS.LoadErrorMessage
End If

For Windows you need llama.dll, for macOS you need llama.dylib and for Linux you need llama.so.

On Windows you need to load ggml.dll, ggml-base.dll and llama.dll to have all functions.

Returns true on success and false on failure.

See also:

LlamaMBS.PrintSystemInfo

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Llama MBS Tools Plugin 25.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Print system information

LlamaMBS.SetDebugLogger

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Llama MBS Tools Plugin 26.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Sets the debug logger, which prints all log messages to stderr.

Helps to debug console applications.

LlamaMBS.SetLogger(Logger as LlamaLogMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Llama MBS Tools Plugin 25.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Sets the delegate for logging.

If no logger is set, log messages go to stderr.

Some examples using this method:

The items on this page are in the following plugins: MBS Tools Plugin.


The biggest plugin in space...