Skip to content

@jaypie/llm

Large language model abstraction with multi-provider support.

@jaypie/llm provides a unified interface for working with large language models, including:

  • Multi-provider support (OpenAI, Anthropic)
  • Tool calling and function execution
  • Structured output generation
  • Conversation history management
  • Multi-turn reasoning
Terminal window
npm install @jaypie/llm

Unified interface for multiple LLM providers:

import { Llm } from "@jaypie/llm";
const llm = new Llm("gpt-4o");
const response = await llm.send("What is the capital of France?");

Execute functions during LLM conversations:

import { Llm, toolkit } from "@jaypie/llm";
const llm = new Llm("gpt-4o");
const response = await llm.operate("What's the weather in Paris?", {
tools: [toolkit.weather],
turns: 12,
});

Generate structured data with natural schema syntax:

const response = await llm.send("Extract user information", {
format: { name: String, age: Number, email: String },
});

Pre-configured tools for common tasks:

  • time - Get current time
  • weather - Get weather information
  • random - Generate random numbers
  • roll - Roll dice

API documentation will be generated from TypeScript definitions.