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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@nozomioai/nia-ai-sdk

v0.0.1

Published

[AI SDK adapter](https://ai-sdk.dev/) for [Nia](https://www.trynia.ai/) `Tracer`, `Oracle`, and `Document Agent`.

Readme

@nozomioai/nia-ai-sdk

AI SDK adapter for Nia Tracer, Oracle, and Document Agent.

This package is designed for AI SDK workflows where you want to:

  • call Nia Tracer as a tool for public GitHub research
  • call Nia Oracle as a tool for grounded research over indexed repos and docs
  • call Nia Document Agent as a tool for deep document analysis and structured extraction
  • augment an existing AI SDK model with Nia-backed middleware
  • stream Tracer, Oracle, or Document Agent events directly in your app

This package is intentionally not the general Nia SDK. It is the AI SDK-facing adapter layer only.

Install

bun add @nozomioai/nia-ai-sdk ai zod

If you want to use middleware with an AI SDK model provider, install that provider too. For example:

bun add @ai-sdk/openai

Set your Nia API key:

export NIA_API_KEY=nia_your_api_key

Tool Usage

Use Nia as AI SDK tools inside generateText() or streamText():

import { generateText } from "ai";
import { openai } from "@ai-sdk/openai";
import { createNiaResearchTools } from "@nozomioai/nia-ai-sdk";

const tools = createNiaResearchTools({
  apiKey: process.env.NIA_API_KEY!,
  tracer: {
    defaultRequest: {
      mode: "tracer-deep",
    },
  },
  oracle: {
    defaultRequest: {
      repositories: ["vercel/ai"],
      dataSources: ["Vercel AI SDK"],
    },
  },
  documentAgent: {
    defaultRequest: {
      sourceId: "src_abc123",
    },
  },
});

const result = await generateText({
  model: openai("gpt-4.1"),
  prompt:
    "Research how AI SDK middleware works, then summarize the best integration pattern.",
  tools,
});

console.log(result.text);

Middleware Usage

Use middleware when you want Nia to augment the last user message before your base model runs:

import { generateText } from "ai";
import { openai } from "@ai-sdk/openai";
import { withOracleContext } from "@nozomioai/nia-ai-sdk";

const model = withOracleContext(openai("gpt-4.1"), {
  apiKey: process.env.NIA_API_KEY!,
  defaultRequest: {
    repositories: ["vercel/ai"],
    dataSources: ["Vercel AI SDK"],
  },
});

const result = await generateText({
  model,
  prompt: "How should I think about AI SDK middleware for retrieval?",
});

console.log(result.text);

Use withTracerContext() the same way when the question is about public GitHub repositories that are not already indexed in Nia. Use withDocumentAgentContext() when the question targets one or more indexed PDFs or documents and you want page-level citations or structured extraction grounding.

Direct Streaming Helpers

Use the stream helpers when you want raw job events:

import { streamTracer } from "@nozomioai/nia-ai-sdk";

const session = await streamTracer(
  {
    apiKey: process.env.NIA_API_KEY!,
  },
  {
    query: "How does generateText stream responses?",
    repositories: ["vercel/ai"],
    mode: "tracer-fast",
  }
);

for await (const event of session.events) {
  console.log(event.event, event.data);
}

Available helpers:

  • streamTracer()
  • streamOracle()
  • streamOracleSessionChat()
  • streamDocumentAgent()

Public API

Main exports:

  • createTracerTool()
  • createOracleTool()
  • createDocumentAgentTool()
  • createNiaResearchTools()
  • createTracerMiddleware()
  • createOracleMiddleware()
  • createDocumentAgentMiddleware()
  • withTracerContext()
  • withOracleContext()
  • withDocumentAgentContext()
  • streamTracer()
  • streamOracle()
  • streamOracleSessionChat()
  • streamDocumentAgent()
  • adapter-facing types from src/types.ts

Internal transport and low-level client classes are not part of the supported public API.

Local Development

bun install
bun test
bun run check:types
bun run build