# Interface for Large Language Models via 'llama.cpp'

## Documentation for package ‘llamaR’ version 0.2.6

- DESCRIPTION file.
- User guides, package vignettes and other documentation.
- Package NEWS.

## Help Pages

C E L

## -- C --

chat_llamar | Chat with a local model through an ellmer::Chat object
chat_llamar_stop | Stop the server spawned by chat_llamar()

## -- E --

embed_llamar | Embedding provider for ragnar / standalone use

## -- L --

llama_apply_control_vector | Apply a control vector to a context
llama_backend_devices | List available backend devices
llama_batch_free | Free a llama batch allocated with 'llama_batch_init()'
llama_batch_init | Initialise a llama batch
llama_chat_apply_template | Apply chat template to messages
llama_chat_build | Build a tool-aware chat prompt and its parsing grammar
llama_chat_builtin_templates | List built-in chat templates
llama_chat_parse | Parse raw model output into content and tool calls
llama_chat_template | Get model's built-in chat template
llama_context_flash_attn | Flash attention a context actually uses
llama_detokenize | Detokenize token IDs back to text
llama_embeddings | Extract embeddings for a text
llama_embed_batch | Batch embeddings for multiple texts
llama_encode | Encode tokens using the encoder (encoder-decoder models only)
llama_flash_attn_type_name | Name of a flash-attention type
llama_free_context | Free an inference context
llama_free_model | Free a loaded model
llama_generate | Generate text from a prompt
llama_generate_batch | Generate completions for multiple prompts in parallel
llama_gen_begin | Begin a streaming (token-by-token) generation
llama_gen_begin_at | Begin streaming generation from an already-prefilled context
llama_gen_end | Finish a streaming generation
llama_gen_next | Pull the next chunk of a streaming generation
llama_get_embeddings | Get all output token embeddings as a matrix
llama_get_embeddings_ith | Get embeddings for the i-th token in the batch
llama_get_embeddings_seq | Get pooled embeddings for a sequence
llama_get_logits | Get logits from the last decode step
llama_get_logits_ith | Get logits for a specific token position
llama_get_model | Get the model associated with a context
llama_get_verbosity | Get current verbosity level
llama_hf_cache_clear | Clear the model cache
llama_hf_cache_dir | Get the cache directory for downloaded models
llama_hf_cache_info | Show information about the model cache
llama_hf_download | Download a GGUF model from Hugging Face
llama_hf_list | List GGUF files in a Hugging Face repository
llama_image_eval | Evaluate an image + prompt into a llama context
llama_image_load | Load an image file into an mtmd bitmap
llama_load_model | Load a GGUF model file
llama_load_model_from_splits | Load a model split across several GGUF files
llama_load_model_hf | Load a model directly from Hugging Face
llama_lora_alora_invocation_tokens | Invocation tokens of an activated LoRA (aLoRA)
llama_lora_apply | Apply a LoRA adapter to context
llama_lora_clear | Remove all LoRA adapters from context
llama_lora_load | Load a LoRA adapter
llama_lora_meta | Read the metadata of a LoRA adapter
llama_lora_meta_val | Read the metadata of a LoRA adapter
llama_lora_remove | Remove a LoRA adapter from context
llama_max_devices | Get maximum number of devices
llama_max_parallel_sequences | Get the maximum number of parallel sequences
llama_max_tensor_buft_overrides | Get the maximum number of tensor buffer-type overrides
llama_memory_breakdown_print | Print memory breakdown by device
llama_memory_can_shift | Check if the KV cache supports shifting
llama_memory_clear | Clear the KV cache
llama_memory_seq_add | Shift token positions in a sequence
llama_memory_seq_cp | Copy a sequence in the KV cache
llama_memory_seq_div | Integer-divide token positions in a sequence
llama_memory_seq_keep | Keep only one sequence in the KV cache
llama_memory_seq_pos_range | Get position range for a sequence
llama_memory_seq_rm | Remove tokens from a sequence in the KV cache
llama_model_cls_labels | Classifier output labels
llama_model_decoder_start_token | Token that starts decoding in encoder-decoder models
llama_model_info | Get model metadata
llama_model_meta | Get all model metadata as a named character vector
llama_model_meta_val | Get a single model metadata value by key
llama_model_sampling_meta | Sampling parameters recommended by the model author
llama_mtmd_load | Load a multimodal projector (mmproj)
llama_mtmd_marker | Media marker string for multimodal prompts
llama_mtmd_set_verbosity | Set verbosity of the multimodal subsystem
llama_mtmd_support_audio | Does this multimodal context support audio?
llama_mtmd_support_vision | Does this multimodal context support vision (images)?
llama_new_context | Create an inference context
llama_numa_init | Initialize NUMA optimization
llama_n_batch | Get logical batch size
llama_n_ctx | Get context window size
llama_n_ctx_seq | Get per-sequence context window size
llama_n_seq_max | Get maximum number of sequences
llama_n_threads | Get number of threads for single-token generation
llama_n_threads_batch | Get number of threads for batch processing
llama_n_ubatch | Get physical micro-batch size
llama_perf | Get performance statistics
llama_perf_print | Print performance statistics to the console
llama_perf_reset | Reset performance counters
llama_perf_sampler | Sampler performance statistics
llama_perf_sampler_print | Sampler performance statistics
llama_perf_sampler_reset | Sampler performance statistics
llama_pooling_type | Get pooling type
llama_sampler_accept | Feed a token to a sampler
llama_sampler_chain_add | Add a sampler to a chain
llama_sampler_chain_from_params | Build a sampler chain from a parameter list
llama_sampler_chain_get | Get a sampler out of a chain
llama_sampler_chain_n | Number of samplers in a chain
llama_sampler_chain_new | Create an empty sampler chain
llama_sampler_chain_remove | Remove a sampler from a chain
llama_sampler_clone | Copy a sampler
llama_sampler_free | Free a sampler or chain
llama_sampler_get_seed | Seed used by a sampler
llama_sampler_name | Name of a sampler
llama_sampler_new | Create a single sampler
llama_sampler_params | Describe a sampler chain
llama_sampler_reset | Reset a sampler's internal state
llama_serve_anthropic | Serve an Anthropic Messages API-compatible endpoint for a local model
llama_serve_openai | Serve an OpenAI-compatible HTTP API for a local model
llama_set_abort_callback | Set or clear the abort callback
llama_set_causal_attn | Set causal attention mode
llama_set_threads | Set the number of threads for a context
llama_set_verbosity | Set logging verbosity level
llama_set_warmup | Set warmup mode
llama_split_path | Build the path of one chunk of a split GGUF
llama_split_prefix | Recover the prefix from a split GGUF path
llama_state_data | Copy the context state to and from raw bytes
llama_state_get_data | Copy the context state to and from raw bytes
llama_state_get_size | Get the size of the serialized context state in bytes
llama_state_load | Load context state from file
llama_state_save | Save context state to file
llama_state_seq | Save and restore the state of a single sequence
llama_state_seq_file | Save and load the state of a single sequence to a file
llama_state_seq_get_data | Save and restore the state of a single sequence
llama_state_seq_get_size | Save and restore the state of a single sequence
llama_state_seq_load_file | Save and load the state of a single sequence to a file
llama_state_seq_save_file | Save and load the state of a single sequence to a file
llama_state_seq_set_data | Save and restore the state of a single sequence
llama_state_set_data | Copy the context state to and from raw bytes
llama_supports_gpu | Check whether GPU offloading is available
llama_supports_mlock | Check whether memory locking is supported
llama_supports_mmap | Check whether memory-mapped file I/O is supported
llama_supports_rpc | Check whether RPC backend is available
llama_synchronize | Synchronize asynchronous computation
llama_system_info | Get system information string
llama_time_us | Get current time in microseconds
llama_tokenize | Tokenize text into token IDs
llama_token_to_piece | Convert a single token ID to its text piece
llama_vocab_add_special | Tokenizer BOS / EOS / SEP insertion defaults
llama_vocab_fim_pad | Additional special token IDs
llama_vocab_get_add_bos | Tokenizer BOS / EOS / SEP insertion defaults
llama_vocab_get_add_eos | Tokenizer BOS / EOS / SEP insertion defaults
llama_vocab_get_add_sep | Tokenizer BOS / EOS / SEP insertion defaults
llama_vocab_get_attr | Get the attribute flags of a token
llama_vocab_get_score | Get the score of a token
llama_vocab_get_text | Get the text representation of a token
llama_vocab_info | Get vocabulary special token IDs
llama_vocab_is_control | Check if a token is a control token
llama_vocab_is_eog | Check if a token is an end-of-generation token
llama_vocab_mask | Additional special token IDs
llama_vocab_special_tokens | Additional special token IDs
llama_vocab_type | Get vocabulary type