Skip to main content
The GenieX Python SDK follows the same design patterns as Hugging Face transformers — use AutoModel*.from_pretrained() to load a model, then call .generate() for inference.

AutoModelForCausalLM

Factory for loading causal language models — both text-only and multimodal. Returns a GenieXLLM for text-only models, or a GenieXVLM when a multimodal model is detected (e.g. phi4_multimodal, qwen3.5-vl, gemma4).

from_pretrained()

Returns: GenieXLLM or GenieXVLM (auto-detected based on the model)

AutoModelForVision2Seq

Factory for loading vision-language / multimodal models. Returns a GenieXVLM instance.

from_pretrained()

Accepts all the same parameters as AutoModelForCausalLM.from_pretrained() plus: Returns: GenieXVLM

GenieXLLM

Text-only language model instance returned by AutoModelForCausalLM.from_pretrained().

generate()

Run text generation from a formatted prompt string.
Returns: GenerateOutput (or TextIteratorStreamer when stream=True)

reset()

Resets conversation state and clears the KV cache.

save_kv_cache(path) / load_kv_cache(path)

Save or load the key-value cache to/from a file path (str).

close()

Releases the model handle and frees resources. Also supports context-manager usage:

GenieXVLM

Vision-language model instance returned by AutoModelForVision2Seq.from_pretrained().

generate()

Same parameters as GenieXLLM.generate() plus:
Returns: GenerateOutput (or TextIteratorStreamer when stream=True)

reset() / close()

Same as GenieXLLM.

ModelTokenizer

Accessed via model.tokenizer. Provides a transformers-compatible chat template interface.

apply_chat_template()

Formats a list of chat messages using the model’s built-in chat template.
Returns: str — formatted prompt ready for model.generate().

Output classes

GenerateOutput

Returned by model.generate().

ProfileData

TextIteratorStreamer

Returned by model.generate(..., stream=True). Yields decoded text chunks as they are generated.

Model manager

The same model manager the CLI uses is available programmatically via geniex.model_manager.

SDK functions