Skip to main content

Crate kjarni

Crate kjarni 

Source

Re-exports§

pub use crate::classifier::Classifier;
pub use crate::embedder::Embedder;
pub use crate::indexer::Indexer;
pub use crate::ner::EntityRecognizer;
pub use crate::reranker::Reranker;
pub use crate::searcher::Searcher;
pub use crate::summarizer::Summarizer;
pub use crate::translator::Translator;

Modules§

agent
An agent: a chat model that calls tools, remembers between conversations, and keeps its conversations on disk.
chat
High-level chat API for conversational AI.
classifier
High-level text classification API.
common
Common types and utilities shared across kjarni modules.
embedder
High-level text embedding API.
folder_search
Searching a folder of documents by meaning, with the index kept out of sight: the first search of a folder indexes it into Kjarni’s cache, and later searches embed only the files that changed since.
generation
Generation configuration and resolution.
generator
Raw text generator for decoder language models.
hub
Models straight from the Hugging Face Hub.
indexer
kjarni_config
kjarni_config_loader
kjarni_config_resolve
models
ner
Named-entity recognition: people, places, organizations and the like.
prelude
registry
Model registry and management
reranker
High-level text reranking API.
searcher
seq2seq
Generic encoder-decoder (seq2seq) text generation.
summarizer
High-level summarization API.
transcriber
Speech-to-text transcription powered by Whisper.
translator
High-level translation API.

Structs§

BeamSearchParams
Parameters for beam search decoding.
Bm25Index
BM25 index for efficient keyword search
BuildInfo
Build metadata.
Chunk
A document chunk ready for indexing
ChunkMetadata
Metadata for a chunk
Conversation
A conversation history
CpuKVCache
CrossEncoder
Cross-encoder for semantic similarity and reranking.
DecoderGenerator
DocumentLoader
Load and chunk documents from files/directories
EncoderDecoderGenerator
GenerationConfig
The main, unified configuration struct for text generation.
GgufLoader
A loader for .gguf files with mmap caching
GpuBeamKVCache
A specialized, high-performance, GPU-resident KV cache for beam search decoding
GpuKVCache
IndexBuild
A new index built beside its final path and moved there once complete, so a failure or cancellation leaves whatever was at the target untouched.
IndexConfig
Index configuration
IndexReader
Reads and searches a segmented index
IndexWriter
Writes documents to a segmented index
Llama2ChatTemplate
Chat template for Llama 2 Instruct models (legacy format)
Llama3ChatTemplate
Chat template for Llama 3 Instruct models
LoaderConfig
Message
A single message in a conversation
MetadataFilter
Filter for metadata-based search
ModelLoadConfig
Configuration for model loading and device placement.
PrefixCache
A KV cache kept across calls, together with the tokens it holds.
Progress
Progress update
SafeTensorsLoader
A loader for .safetensors files with mmap caching
SamplingParams
Parameters for sampling-based decoding (Top-K, Top-P, Temperature).
SearchIndex
Complete search index with BM25 and semantic search
SearchResult
Search result from an index query
SentenceEncoder
Sentence encoder for semantic similarity tasks.
SequenceClassifier
A generic sequence classifier for encoder-only models.
SpeculationParams
SplitterConfig
Configuration for text splitting
StreamedToken
A container for a token and its metadata from the generation stream.
TextSplitter
Markdown-aware text splitter
VectorStore
WgpuContext

Enums§

DType
DecodingStrategy
The user-facing decoding algorithm and its specific parameters.
Device
Compute backend for model inference.
ModelArchitecture
Defines the model architecture.
ModelTask
Defines the primary intended use case for a model.
ModelType
The curated list of pretrained models supported by Kjarni.
PoolingStrategy
ProgressStage
Progress stage during indexing
Role
A role in a conversation
SearchMode
How to search the index
TokenType
The type of a token being yielded by the generation stream.

Constants§

SOURCE_PATH_KEY
Metadata key holding a chunk’s file as an absolute path. source keeps the path as the caller typed it, which is what they recognise but differs between runs, so this is what identifies a file when replacing or removing it.

Traits§

Cache
A type-erased, thread-safe container for mutable inference state.
ChatTemplate
Trait for formatting conversations into model-specific prompts
DecoderLanguageModel
The primary trait for Decoder-only Language Models Llama, GPT, Mistral,
EncoderLanguageModel
Trait for encoder-only language models (BERT, RoBERTa, etc.)
LanguageModel
Core trait for all language models providing tokenization and metadata.
WeightLoader
Trait for loading model weights from various file formats

Functions§

build_info
Get build information.
chat_send
Send a chat message
classify
Classify text (convenience wrapper).
cosine_similarity
Compute cosine similarity between two embeddings
embed
Encode text to embedding (convenience wrapper).
find_most_similar
Find the most similar embeddings to a query embedding
is_index_dir
Whether a path holds a Kjarni index.
similarity_matrix
Compute pairwise cosine similarity matrix for a batch of embeddings
source_path
The value of SOURCE_PATH_KEY for a path, which need not exist any more.
version
Get the kjarni version.

Type Aliases§

ProgressCallback