mybigday/llama.rn
React Native binding of llama.cpp
It looks like you just pasted a large portion of the llama.rn README – covering everything from basic usage, speculative decoding, multimodal support, tool‑calling, grammar sampling, parallel decoding, session handling, and embeddings.
If you have a specific question about any of these features (e.g., how to enable MTP speculative decoding, how to feed an image to a multimodal model, how to use the parallel‑slot API, etc.) or need a quick example or clarification, just let me know and I’ll be happy to help!
Otherwise, here’s a very short TL;DR:
- Initialize with
await initLlama({model, n_ctx, n_gpu_layers, …}). - Multimodal: call
await context.initMultimodal({path: mmprojPath, use_gpu:true})and then send messages that containimage_urlorinput_audioobjects. - Speculative Decoding (MTP): enable via
speculative: {type:'draft-mtp', n_max:3}at init‑time or per‑completion; disable withspeculative:false. - Tool‑calling: provide a
toolsarray andtool_choice:'auto'; the result will includetool_callsif the model decides to invoke a function. - Grammar / JSON‑schema: pass a GBNF string in
grammar(or aresponse_formatwith a JSON schema) to force structured output. - Parallel decoding:
await context.parallel.enable({n_parallel:4, n_batch:512})then usecontext.parallel.completion(...)for slot‑based concurrent requests. - Session:
await context.saveSession(path)/await context.loadSession(path)to cache KV‑cache state. - Embedding: set
embedding:trueat init and callawait context.embedding('text').
Just tell me what you’d like to dive into!
Related
- Dispatch
- Project
- Dispatch
- Project
- Project