lloyal.node API Reference - v1.0.7
    Preparing search index...

    Function loadBinary

    • Load native binary for a specific GPU variant

      Loads the appropriate platform-specific binary with automatic fallback:

      1. Try requested GPU variant (if specified)
      2. Fall back to default (CPU) platform package
      3. Fall back to local build (development: build/Release/lloyal.node)

      Use this for advanced scenarios where you need direct binary access or want to check variant availability before creating a context.

      Parameters

      • Optionalvariant: GpuVariant

        GPU variant: 'cuda', 'vulkan', or undefined for CPU

      Returns { createContext(options: ContextOptions): Promise<SessionContext> }

      Native binary module with createContext method

      Error if no binary available for the current platform

      // Load default (CPU) binary
      const binary = loadBinary();

      // Load CUDA binary (falls back to CPU if unavailable)
      const binary = loadBinary('cuda');

      // Create context from loaded binary
      const ctx = await binary.createContext({ modelPath: './model.gguf' });