kirha logo

Search

Pass a natural language query to kirha.search(query, options?). KIRHA's planner picks the data providers to call, runs them, and returns the results.

import { Kirha } from "kirha";

const kirha = new Kirha({ apiKey: process.env.KIRHA_API_KEY });

const result = await kirha.search("How to stream AI responses in Next.js using the latest AI SDK?"); 
console.log(result.data); 

Focus

Without focus, KIRHA searches every vertical. Pass a vertical slug to restrict the search to its providers:

const result = await kirha.search("List top 10 stablecoins yield on Ethereum", {
  focus: "crypto", 
});

Set focus in the constructor to apply it to every query, and override it per query.

Summarization

Set summarization: true to get a written answer generated from the provider data:

import { Kirha } from "kirha";

const kirha = new Kirha({ apiKey: process.env.KIRHA_API_KEY });

const result = await kirha.search("Summarize latest NVIDIA earning calls", {
  summarization: true, 
});

console.log(result.summary);

Summarization with custom instruction

Pass an instruction to control how the summary is written:

import { Kirha } from "kirha";

const kirha = new Kirha({ apiKey: process.env.KIRHA_API_KEY });

const result = await kirha.search("What does the boxed warning on Ozempic say?", {
  summarization: { 
    instruction: "Answer in three bullet points and quote the warning", 
  }, 
});

console.log(result.summary);

Raw data

Raw data is included by default. It contains the structured output of each data provider. Set includeData to false if you only need the summary.

import { Kirha } from "kirha";

const kirha = new Kirha({ apiKey: process.env.KIRHA_API_KEY });

const result = await kirha.search("Summarize latest NVIDIA earning calls", {
  summarization: true,
  includeData: false, 
});
console.log(result.summary); 

To see which tools were called, include the plan in the response:

import { Kirha } from "kirha";

const kirha = new Kirha({ apiKey: process.env.KIRHA_API_KEY });

const result = await kirha.search("Find engineers working at companies behind the latest patents in Machine Learning", {
  includePlanning: true, 
});
console.log(result.planning); 

Planning runtime

PlanningRuntime.Standard is the default and the more accurate planner. PlanningRuntime.Fast answers sooner but is less accurate.

import { Kirha, PlanningRuntime } from "kirha";

const kirha = new Kirha({ apiKey: process.env.KIRHA_API_KEY });

const result = await kirha.search("Summarize latest NVIDIA earning calls", {
  planningRuntime: PlanningRuntime.Fast, 
});

Search options

Prop

Type

SummarizationConfig

type SummarizationConfig = true | { instruction?: string };

On this page