| Components | All | New | MacOS | Windows | Linux | iOS | ||||
| Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old | |
Llama.StartContext
Initializes a context.
| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
| Llama | 16.1 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
MBS( "Llama.StartContext"; LlamaSession { ; Parameters } ) More
Parameters
| Parameter | Description | Example | Flags |
|---|---|---|---|
| LlamaSession | The session identifier. | $$session | |
| Parameters | The parameters as JSON. | Optional |
Result
Returns OK or error.
Description
Initializes a context.You may pass parameters in the JSON.
| Key | Description |
|---|---|
| n_ctx | text context, 0 = from model |
| n_batch | logical maximum batch size that can be submitted to llama_decode |
| n_ubatch | physical maximum batch size |
| n_seq_max | max number of sequences (i.e. distinct states for recurrent models) |
| n_threads | number of threads to use for generation |
| n_threads_batch | number of threads to use for batch processing |
Examples
Start context:
Set Variable [ $r ; Value: MBS(
"Llama.StartContext" ;
$$session ;
JSONSetElement(
"{}" ;
[ "n_ctx" ; 20480 ; JSONNumber ] ;
[ "n_batch" ; 20480 ; JSONNumber ])
) ]
"Llama.StartContext" ;
$$session ;
JSONSetElement(
"{}" ;
[ "n_ctx" ; 20480 ; JSONNumber ] ;
[ "n_batch" ; 20480 ; JSONNumber ])
) ]
See also
Example Databases
Blog Entries
Created 10th February 2026, last changed 25th February 2026