LLM & Integration12 min
Cosine Similarity vs Dot Product for Embeddings (2026)
Cosine similarity vs dot product for embeddings, with runnable TypeScript. Learn when to normalize, why they match for unit vectors, and which to pick.
Tag
11 posts
LLM & Integration12 min
Cosine similarity vs dot product for embeddings, with runnable TypeScript. Learn when to normalize, why they match for unit vectors, and which to pick.
LLM & Integration16 min
Token-aware text chunking for RAG in TypeScript: recursive splitting with @langchain/textsplitters and js-tiktoken, plus chunk size and overlap tuning.
LLM & Integration17 min
Count OpenAI tokens in TypeScript with gpt-tokenizer - no WASM, no API key. Count chat messages accurately and trim history to fit the model context window.
OpenCode is the open-source, terminal-first AI coding agent with 178K GitHub stars and 75+ model providers. What it is, how it works, and how to start.
MiniMax M3 is an open-weight, 1M-context AI coding model with native multimodality and Sparse Attention. What its benchmarks, pricing, and license really mean.
LLM & Integration15 min
Unit-test Vercel AI SDK v6 code in TypeScript with MockLanguageModelV3 - no API key, no cost. Mock generateText, tool calls, and streaming in Vitest.
AI & Machine Learning13 min
Add Claude prompt caching in TypeScript with cache_control: measure cache_read_input_tokens, cut API costs ~89%, and avoid the silent minimum-token cache miss.
AI & Machine Learning20 min
Claude Batch API tutorial in TypeScript: submit thousands of structured-output requests at 50% cost, poll status, stream results, and validate with Zod.
AI & Machine Learning19 min
Get guaranteed JSON from the Claude API in TypeScript: structured outputs with Zod, strict tool use, plus refusal and max_tokens handling. Runnable 2026 guide.
AI & Machine Learning13 min
Build a Model Context Protocol (MCP) client in TypeScript with @modelcontextprotocol/sdk: connect over stdio, list and call tools, and handle errors correctly.
AI & Machine Learning15 min
Hands-on Claude Sonnet 4.6 tool use tutorial: build a typed agentic loop in TypeScript with the Anthropic SDK 0.98, parallel tool calls, and JSON Schema.