Paperful Icon

Paperfuldocs

Papers

Get a node's context

Retrieve the content surrounding a node.

A node's context is the content immediately around it. Use it to expand a single node, such as a search match, into a passage a reader or model can understand.

Get context

const graph = await paperful.papers.graph("00000000-0000-0000-0000-000000000000");
const node = graph.nodes[10];

const context = await node.context();

Choose how much context

const context = await node.context(
  { 
    before: 2, 
    after: 4 
  }
);

Prop

Type

The maximum number of nodes included before and after the current node is 12 in each direction.

On this page