Skip to main content
pb.search retrieves across the graph’s entities and the sources behind them. It accepts a query string with options, or a full request object.

Signature

pb.search(query: string, options?: SearchOptions): Promise<SearchResponse>;
pb.search(request: SearchRequest): Promise<SearchResponse>;

Basic usage

const hits = await pb.search("pricing objections from enterprise deals", {
  include: ["entities", "chunks"],
  limit: 10,
});

console.log(hits.results);

Options

Common fields on SearchOptions / SearchRequest:
query
string
The search text.
include
string[]
What to return, for example ["entities", "chunks"].
types
string[]
Restrict to specific entity types.
shapes
string[]
Restrict to entities of specific shapes.
sources
string[]
Restrict to specific sources.
mode
string
Retrieval mode (for example hybrid, semantic, or lexical).
depth
string
How much neighboring context to pull in.
includeNeighbors
boolean
Include graph neighbors of matched entities.
threshold
number
Minimum relevance for a result to be included.
limit
number
Maximum number of results.
offset
number
Result offset for pagination.
projectId
string
Required when your key spans more than one project.
The SDK calls POST /v1/search. The API also exposes lower-level retrieval and graph search directly. See the API endpoints.