Search
Basic 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); from kirha import Kirha
kirha = Kirha()
result = kirha.search("How to stream AI responses in Next.js using the latest AI SDK?")
print(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",
});result = 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);Set summarization=True to get a written answer generated from the provider data:
from kirha import Kirha
kirha = Kirha()
result = kirha.search(
"Summarize latest NVIDIA earning calls",
summarization=True,
)
print(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);from kirha import Kirha
kirha = Kirha()
result = kirha.search(
"What does the boxed warning on Ozempic say?",
summarization={
"instruction": "Answer in three bullet points and quote the warning",
},
)
print(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); Raw data is included by default. It contains the structured output of each data provider. Set include_data to False if you only need the summary.
from kirha import Kirha
kirha = Kirha()
result = kirha.search(
"Summarize latest NVIDIA earning calls",
summarization=True,
include_data=False,
)
print(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); from kirha import Kirha
kirha = Kirha()
result = kirha.search(
"Find engineers working at companies behind the latest patents in Machine Learning",
include_planning=True,
)
print(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,
});"standard" is the default and the more accurate planner. "fast" answers sooner but is less accurate.
from kirha import Kirha
kirha = Kirha()
result = kirha.search(
"Summarize latest NVIDIA earning calls",
planning_runtime="fast",
)Search options
Prop
Type
Prop
Type
SummarizationConfig
type SummarizationConfig = true | { instruction?: string };class Summarization(TypedDict, total=False):
instruction: str