Skip to main content

NeuroLink Cookbook

Welcome to the NeuroLink Cookbook! This collection of recipes provides practical, copy-paste ready solutions for common use cases and challenges when building with NeuroLink.

What's in the Cookbook?

Each recipe follows a consistent structure:

  • Problem: What challenge does this solve?
  • Solution: High-level approach
  • Code: Complete, working TypeScript example
  • Explanation: Step-by-step breakdown
  • Variations: Alternative approaches
  • See Also: Related recipes and documentation

Recipe Categories

Getting Started

  • Basic Streaming - Stream AI responses in real time with the result.stream pattern
  • Multimodal Images - Send images to vision models for analysis, OCR, and comparison
  • Provider Switching - Switch providers at runtime, compare outputs, and implement fallback
  • Embeddings Basics - Generate embeddings, compare similarity, and build semantic search

Reliability & Error Handling

Performance & Optimization

Context Management

Advanced Features

How to Use These Recipes

  1. Find your use case: Browse the categories above
  2. Copy the code: All examples are production-ready
  3. Customize: Adapt the code to your specific needs
  4. Test: Verify the solution works in your environment

Prerequisites

Most recipes assume you have:

  • NeuroLink installed: npm install @juspay/neurolink
  • At least one provider configured (API keys in .env)
  • Basic TypeScript/JavaScript knowledge

Contributing

Found a common pattern not covered here? Contribute a recipe!

See Also