Platforms to show: All Mac Windows Linux Cross-Platform
Llama
Classes for using llama cpp in Xojo to run local LLMs.
- Classes
- class LlamaBackendMBS
- method Constructor
- method Devices as LlamaDeviceMBS()
- property Features as Dictionary
- property Name as String
- class LlamaBatchMBS
- method Constructor
- method Constructor(tokens as Int32, embd as Int32, n_seq_max as Int32)
- method Constructor(tokens() as Int32)
- method Destructor
- method Tokens as Int32()
- property embd as Ptr
- property Handle as Integer
- property logits as Ptr
- property n_tokens as Int32
- class LlamaChatMessageMBS
- method Constructor
- method Constructor(Role as String, Content as String)
- method Destructor
- property Content as String
- property Role as String
- class LlamaContextMBS
- method Ask(Sampler as LlamaSamplerMBS, prompt as String, MaxTokens as Integer = 100) as String
- method ClearMemory
- method Constructor
- method Constructor(Model as LlamaModelMBS, Parameters as LlamaContextParametersMBS = nil)
- method Decode(batch as LlamaBatchMBS) as Integer
- method Destructor
- method Embeddings as Ptr
- method Embeddings(index as Integer) as Ptr
- method EmbeddingsSeq(index as Integer) as Ptr
- method Encode(batch as LlamaBatchMBS) as Integer
- method Logits as Ptr
- method Logits(index as Integer) as Ptr
- method MemoryBreakdownPrint
- method Performance as LlamaPerformanceContextDataMBS
- method PerformancePrint
- method PerformanceReset
- method SetCausalAttention(causalAttn as boolean)
- method SetEmbeddings(embeddings as Boolean)
- method SetThreads(Threads as Integer, ThreadsBatch as Integer)
- method SetWarmup(warmup as boolean)
- method Synchronize
- property Handle as Integer
- property Model as LlamaModelMBS
- property n_batch as UInt32
- property n_ctx as UInt32
- property n_ctx_seq as UInt32
- property n_ctx_used as UInt32
- property n_seq_max as UInt32
- property n_threads as Integer
- property n_threads_batch as Integer
- property n_ubatch as UInt32
- property pooling_type as Integer
- class LlamaContextParametersMBS
- method Constructor
- method Destructor
- shared method FlashAttnTypeName(FlashAttnType as Integer) as String
- property attention_type as Integer
- property defrag_thold as Single
- property embeddings as Boolean
- property flash_attn_type as Integer
- property kv_unified as Boolean
- property no_perf as Boolean
- property n_batch as UInt32
- property n_ctx as UInt32
- property n_seq_max as UInt32
- property n_threads as Int32
- property n_threads_batch as Int32
- property n_ubatch as UInt32
- property offload_kqv as Boolean
- property op_offload as Boolean
- property pooling_type as Integer
- property rope_freq_base as Single
- property rope_freq_scale as Single
- property rope_scaling_type as Integer
- property swa_full as Boolean
- property type_k as Integer
- property type_v as Integer
- property yarn_attn_factor as Single
- property yarn_beta_fast as Single
- property yarn_beta_slow as Single
- property yarn_ext_factor as Single
- property yarn_orig_ctx as UInt32
- class LlamaDeviceMBS
- method Constructor
- property Description as String
- property DeviceID as String
- property MemoryFree as Integer
- property MemoryTotal as Integer
- property Name as String
- property Type as Integer
- property TypeString as String
- class LlamaExceptionMBS
- class LlamaModelMBS
- method ChatTemplate(Name as String) as String
- method ClassifierOutputLabel(index as integer) as String
- method Constructor
- method Constructor(File as FolderItem, Parameters as LlamaModelParametersMBS = nil)
- method Constructor(Path as String, Parameters as LlamaModelParametersMBS = nil)
- method DecoderStartToken as Int32
- method Destructor
- method MetaKey(Index as Integer) as String
- shared method MetaKeyName(Key as Integer) as String
- method MetaValue(Index as Integer) as String
- method MetaValue(Key as String) as String
- method SaveToFile(File as FolderItem)
- method SaveToFile(Path as String)
- property ClassifierOutputs as Integer
- property ctx_train as Integer
- property Description as String
- property embd as Integer
- property embd_inp as Integer
- property embd_out as Integer
- property Handle as Integer
- property HasDecoder as Boolean
- property HasEncoder as Boolean
- property head as Integer
- property head_kv as Integer
- property IsDiffusion as Boolean
- property IsHybrid as Boolean
- property IsRecurrent as Boolean
- property layer as Integer
- property Meta as Dictionary
- property MetaCount as Integer
- property ParameterCount as Integer
- property RopeType as Integer
- property Size as Integer
- property swa as Integer
- property Vocab as LlamaVocabMBS
- class LlamaModelParametersMBS
- method Constructor
- method Destructor
- property check_tensors as Boolean
- property main_gpu as Int32
- property no_alloc as Boolean
- property no_host as Boolean
- property n_gpu_layers as Int32
- property split_mode as Integer
- property use_direct_io as Boolean
- property use_extra_bufts as Boolean
- property use_mlock as Boolean
- property use_mmap as Boolean
- property vocab_only as Boolean
- property Yield as Boolean
- event Progress(progress as Single) as Boolean
- class LlamaModelQuantizeParametersMBS
- method Constructor
- method Destructor
- property allow_requantize as Boolean
- property ftype as Integer
- property keep_split as Boolean
- property nthread as Int32
- property only_copy as Boolean
- property output_tensor_type as Integer
- property pure as Boolean
- property quantize_output_tensor as Boolean
- property token_embedding_type as Integer
- class LlamaPerformanceContextDataMBS
- method Constructor
- method Destructor
- property n_eval as Int32
- property n_p_eval as Int32
- property n_reused as Int32
- property t_eval_ms as Double
- property t_load_ms as Double
- property t_p_eval_ms as Double
- property t_start_ms as Double
- class LlamaPerformanceSamplerDataMBS
- method Constructor
- method Destructor
- property n_sample as Int32
- property t_sample_ms as Double
- class LlamaSamplerChainParametersMBS
- method Constructor
- method Destructor
- property no_perf as Boolean
- class LlamaSamplerMBS
- method Accept(token as Int32)
- method AddToChain(sampler as LlamaSamplerMBS)
- method Chain(Index as Integer) as LlamaSamplerMBS
- method Clone as LlamaSamplerMBS
- method Constructor
- method Constructor(parameters as LlamaSamplerChainParametersMBS)
- method Destructor
- shared method InitDist(seed as UInt32) as LlamaSamplerMBS
- shared method InitGreedy as LlamaSamplerMBS
- shared method InitInfill(vocab as LlamaVocabMBS) as LlamaSamplerMBS
- shared method InitMinP(p as Single, minKeep as UInt64) as LlamaSamplerMBS
- shared method InitTemp(p as Single) as LlamaSamplerMBS
- shared method InitTempExt(t as Single, delta as Single, exponent as Single) as LlamaSamplerMBS
- shared method InitTopK(k as Int32) as LlamaSamplerMBS
- shared method InitTopNSigma(n as Single) as LlamaSamplerMBS
- shared method InitTopP(p as Single, minKeep as UInt64) as LlamaSamplerMBS
- shared method InitTypical(p as Single, minKeep as UInt64) as LlamaSamplerMBS
- shared method InitXTC(p as Single, t as Single, minKeep as UInt64, seed as UInt32) as LlamaSamplerMBS
- method Performance as LlamaPerformanceSamplerDataMBS
- method PerformancePrint
- method PerformanceReset
- method RemoveFromChain(Index as Integer)
- method Reset
- method Sample(context as LlamaContextMBS, Index as Integer) as Int32
- property ChainLength as Integer
- property Handle as Integer
- property Name as String
- property Seed as UInt32
- class LlamaVocabMBS
- method Constructor
- method Destructor
- method Detokenize(tokens() as Int32, removeSpecial as boolean, unparseSpecial as Boolean) as String
- method isControl(Token as Int32) as Boolean
- method isEOG(Token as Int32) as Boolean
- method Text(Token as Int32) as String
- method TokenAttributes(Token as Int32) as Integer
- method Tokenize(text as String, AddSpecial as Boolean = true, ParseSpecial as Boolean = true) as Int32()
- method TokenScore(Token as Int32) as Single
- method TokenToPiece(Token as Int32, special as boolean = true) as String
- property bos as Int32
- property eot as Int32
- property Handle as Integer
- property nl as Int32
- property n_tokens as Integer
- property pad as Int32
- property sep as Int32
- property type as Integer
- class LlamaBackendMBS
- Modules
- module LlamaMBS
- method ApplyChatTemplate(Template as String, ChatMessages() as LlamaChatMessageMBS, AddAssistentTokens as boolean) as String
- method BackendInit
- method BackendLoad(Path as String) as Boolean
- method BackendLoadAll
- method Backends as LlamaBackendMBS()
- method ChatBuiltInTemplates as String()
- method Loaded as Boolean
- method LoadErrorMessage as String
- method LoadLibrary(File as FolderItem) as boolean
- method LoadLibrary(Path as String) as boolean
- method PrintSystemInfo
- method SetDebugLogger
- method SetLogger(Logger as LlamaLogMBS)
- property MaxDevices as UInt64
- property MaxParallelSequences as UInt64
- property MaxTensorBufTOverrides as UInt64
- property SupportsGPUOffload as Boolean
- property SupportsMLock as Boolean
- property SupportsMMap as Boolean
- property SupportsRPC as Boolean
- property TimeUS as Int64
- delegate LlamaLogMBS(Level as Integer, Message as String)
- module LlamaMBS
- Blog Entries
Release notes
- Version 26.1
- Updated LlamaMBS module to use newer headers.
- Added no_alloc and use_direct_io properties to LlamaModelParametersMBS class.
- Added MaxTensorBufTOverrides property to LlamaMBS module.
- Added n_ctx_seq property to LlamaContextMBS class.
- Added embd_out and embd_inp to LlamaModelMBS class.
- Added MetaKeyName function and related constants to LlamaModelMBS class.
- Added LlamaExceptionMBS class.
- Fixed a memory leak in Tokenize and Detokenize functions in LlamaVocabMBS class.
- Added SetDebugLogger method to LlamaMBS module.
- Added LlamaDeviceMBS and LlamaBackendMBS classes.
- Added Backends method to LlamaMBS module.
- Version 25.5
- Added LlamaMBS module for using Llama.cpp in Xojo.
The items on this page are in the following plugins: MBS Tools Plugin.