TensLab Closed Beta Sandbox • Internal Testbed

Contex RAG Token Studio

Interactive context compilation sandbox for internal beta testers. Test Contex algorithms on sample RAG payloads and measure tiktoken reduction in real-time.

Real RAG Dataset:
Model Tokenizer:
RAW RAG PAYLOAD (JSON)
0 CHARS
OPENAI TIKTOKEN 100% PARITY
0
Raw Tiktoken BPE
0
Contex Tiktoken BPE
0%
Tiktoken Reduction
$0.00
Saved / 10k Calls
0.00 ms
WASM Encode Latency
Drop-in Node.js RAG Integration (@tens-lab/core)
import { compile } from '@tens-lab/core'
import OpenAI from 'openai'

// 1. Fetch raw RAG search results (IT tickets, candidate records, vector rows)
const tickets = await vectorDb.query({ query: 'unresponsive login page', topK: 10 })

// 2. Compile into Contex Compact format (76% median token reduction)
const compactRAGContext = compile(tickets, { model: 'gpt-4o' })

// 3. Inject directly into standard LLM Chat Completion API
const response = await openai.chat.completions.create({
  model: 'gpt-4o',
  messages: [
    { role: 'system', content: 'You are a factual support assistant. Answer strictly using provided context.' },
    { role: 'user', content: `Here is the dataset in Contex format:\n\n${compactRAGContext}\n\nQuestion: List all critical priority tickets.` }
  ]
})