Skip to content

Latest commit

 

History

History
76 lines (59 loc) · 2.13 KB

File metadata and controls

76 lines (59 loc) · 2.13 KB

🎯 Examples Hub - Quick Navigation

Bite-sized wisdom, maximum impact

Example Categories

🚀 Quick Start

💡 Common Use Cases

🔧 Advanced Patterns

🏭 Production

Quick Code Snippets

Minimal Setup (3 lines!)

import LLMRouter from 'llm-runner-router';
const router = new LLMRouter();
const response = await router.quick("Hello AI!");

Load Any Model Format

await router.load('model.gguf');     // GGUF
await router.load('model.onnx');     // ONNX
await router.load('hf:gpt2');        // HuggingFace

Stream Tokens

for await (const token of router.stream(prompt)) {
  process.stdout.write(token);
}

Custom Strategy

router.setStrategy('quality-first'); // Or: cost-optimized, speed-priority

Interactive Examples

Try these in your browser console:

// Browser-ready example
const router = new LLMRouter({ 
  preferredEngine: 'webgpu' 
});
await router.load('tinyllama.gguf');
console.log(await router.quick("Hi!"));

Learning Path

  1. Start Here: Basic Examples (5 min)
  2. Then: API Server (10 min)
  3. Advanced: Custom Routing (15 min)
  4. Production: Docker Deploy (20 min)

Examples are the bridges between theory and mastery 🌉