JavaScript

Using PDK in JavaScript/TypeScript

Installation

bash
npm install @echo-pdk/core

Basic Usage

import { createEcho } from "@echo-pdk/core"
import { readFileSync } from "fs"

const echo = createEcho()

// Load your prompt template
const template = readFileSync("./prompts/support-agent.echo", "utf-8")

// Render with context
const prompt = await echo.render(template, {
  company: "Acme Inc",
  customer: { tier: "Premium", name: "Alice" },
  issue: { type: "Refund", description: "Wrong item shipped" }
})

// Send to your LLM
const response = await openai.chat.completions.create({
  messages: [{ role: "system", content: prompt }]
})

With AI Judge

const echo = createEcho({
  aiProvider: {
    type: 'openai',
    apiKey: process.env.OPENAI_API_KEY,
  }
})