npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@superagent-ai/reag

v0.0.3

Published

Reasoning Augmented Generation

Downloads

24

Readme

🎓 ReAG TypeScript SDK

Introduction

The ReAG SDK provides a production-grade framework for integrating Reasoning Augmented Generation (ReAG) into your applications. Designed to work with both Python and Typescript, this SDK simplifies document ingestion and intelligent querying without the need for API keys.

By removing the complexities of traditional RAG systems, the SDK enables developers to directly ingest markdown formatted documents complete with metadata and execute contextual queries seamlessly.

Table of Contents

Features

  • Multi-language Support: Available for both Python and Typescript.
  • Document Ingestion: Ingest markdown formatted documents with associated metadata.
  • Intelligent Querying: Retrieve sources and insights based on contextual queries.
  • Language Model Agnostic: Works with any preferred language model.
  • Production Ready: Robust, scalable, and designed for real-world applications.
  • Type Safety: Full TypeScript support with comprehensive type definitions.

Installation

  1. Ensure Node.js (14+) is installed.
  2. Install using npm:
    npm install @superagent-ai/reag
  3. Or using Yarn:
    yarn add @superagent-ai/reag

Quick Start

import { ReagClient, ClientOptions } from '@superagent-ai/reag';
import { openai } from "@ai-sdk/openai";

// Initialize the SDK with required options
const client = new ReagClient({
  model: openai("o3-mini", { structuredOutputs: true }),
  // system: optional system prompt here or use the default
});

// Example document with metadata
const document = {
  name: "Getting Started",
  content: "ReAG SDK is a framework for Reasoning Augmented Generation...",
  metadata: {
    url: "https://docs.example.com/getting-started",
    source: "documentation",
    id: "doc-1"
  }
};

// Query with document context and filters
const response = await client.query(
  "Describe the main features of the SDK",
  [document],
  {
    filter: [
      {
        key: "source",
        value: "documentation",
        operator: "equals"
      }
    ]
  }
);

// Response includes: content, reasoning, isIrrelevant, and document reference
console.log('Query Response:', response);

API Reference

Initialization

Initialize the client by providing required configuration options:

const client = new ReagClient({
  model: openai("o3-mini", { structuredOutputs: true }),
  system?: string // Optional system prompt
  batchSize?: number // Optional batch size
  schema?: z.ZodSchema // Optional schema
});

Document Structure

Documents should follow this structure:

interface Document {
  name: string;
  content: string;
  metadata: {
    [key: string]: any;  // Custom metadata fields
  }
}

Querying

Query documents with optional filters:

const response = await client.query(
  query: string,
  documents: Document[],
  options?: {
    filter?: Array<{
      key: string;
      value: string | number;
      operator: "equals" | "greaterThanOrEqual" // and other operators
    }>
  }
);

Response structure:

interface QueryResponse {
  content: string;      // Generated response
  reasoning: string;    // Reasoning behind the response
  isIrrelevant: boolean; // Relevance indicator
  document: Document;   // Reference to source document
}

Example filters:

  • Filter by metadata field:
    {
      filter: [
        {
          key: "source",
          value: "documentation",
          operator: "equals"
        }
      ]
    }
  • Filter by numeric values:
    {
      filter: [
        {
          key: "version",
          value: 2,
          operator: "greaterThanOrEqual"
        }
      ]
    }

Contributing

We welcome contributions from the community. Please refer to the CONTRIBUTING.md file for guidelines on reporting issues, suggesting improvements, and submitting pull requests.

License

This project is licensed under the MIT License.

Additional Resources

Contact

For support or inquiries, please contact: