SDK Reference

Complete reference for LaikaTest SDKs

Packages: @laikatest/js-client (JavaScript/TypeScript), laikatest-client (Python)
Features: Zero dependencies, intelligent caching, full type support

Python SDK Support: The Python SDK currently supports get_prompt(), prompt.compile(), and client.destroy() methods. Full experiment and score evaluation features are coming soon.

Installation

npm install @laikatest/js-client

Quick Start

import { LaikaTest } from '@laikatest/js-client';const client = new LaikaTest(process.env.LAIKATEST_API_KEY);try {  // Fetch prompt  const prompt = await client.getPrompt('customer-greeting');  // Compile with variables  const message = prompt.compile({    customerName: 'John Doe',    accountType: 'premium'  });  console.log(message);} catch (error) {  console.error('Failed to fetch prompt:', error);} finally {  client.destroy();}

Configuration Options

const client = new LaikaTest(apiKey, {  baseUrl: 'https://api.laikatest.com',  timeout: 10000,      // Request timeout in milliseconds  cacheTTL: 1800000,   // Cache time-to-live (30 minutes)  cacheEnabled: true   // Enable/disable caching});

Documentation Sections

Best Practices

  • Store API keys securely: Use environment variables, never hardcode keys
  • Reuse client instances: Create one client instance and reuse it across requests
  • Implement error handling: Always wrap SDK calls in try-catch blocks
  • Use caching wisely: Keep caching enabled for better performance, bypass only when necessary
  • Clean up resources: Call destroy() when done, especially in serverless environments