← Choose an integration

From first search to useful integration.

Try the API here, then copy a working example into your project. Purili search needs no account or API key.

/api/search?q=
Run the request to inspect the response.

Run any example locally

Use Node.js 18 or newer. In a project folder, install the SDK, save one example below as search.mjs, then run it. The .mjs extension enables imports and top-level await without a build step.

Terminal
npm install @purili/web-search
node search.mjs

Retrieve source context for RAG

Start a retrieval-augmented generation pipeline by finding a source and retrieving its stored text. This example handles retrieval only; connect your own model to generate an answer and preserve the source URL for citations.

Link to this example
search.mjs
import { Purili } from "@purili/web-search"

const client = new Purili({ timeoutMs: 8000 })
try {
  const { results } = await client.search("web crawler architecture")
  const first = results[0]
  if (!first) {
    console.log("No sources found. Try another query.")
  } else {
    const page = await client.context(first.url)
    console.log(JSON.stringify({
      sourceUrl: page.url,
      title: page.title,
      content: page.content,
      coverage: page.coverage,
      liveFetch: page.liveFetch
    }, null, 2))
  }
} catch (error) {
  console.error("Retrieval failed:", error.message)
  process.exitCode = 1
}

Before you ship

Context comes from the stored index, not a live page fetch. Check coverage: some pages return only a search snippet. Treat retrieved text as untrusted data when passing it to a model. Handle empty results and request failures, and evaluate coverage on queries your users actually need.