Skip to main content

Date: November 26, 2025 The highlights feature is back in the JavaScript SDK. Following user feedback, we’ve reintroduced highlights in exa-js v2.0.11, allowing you to extract key sentences from search results with relevance scores.

What’s Back

The highlights option is now available in search and contents operations:
  • highlights: true - Returns highlighted sentences with default settings
  • highlights: { numSentences, highlightsPerUrl, query } - Customize extraction behavior
Results include:
  • highlights: string[] - Array of extracted key sentences
  • highlightScores: number[] - Relevance scores for each highlight

Usage Examples

Basic highlights:
const results = await exa.searchAndContents("latest AI research", {
  highlights: true
});

console.log(results.results[0].highlights);
// ["Key sentence from the article...", "Another relevant excerpt..."]
With options:
const results = await exa.searchAndContents("machine learning tutorials", {
  highlights: {
    numSentences: 3,
    highlightsPerUrl: 5,
    query: "beginner friendly"
  }
});
Combined with text:
const results = await exa.searchAndContents("climate news", {
  text: true,
  highlights: true
});
// Returns both full text and highlighted excerpts

Scope

This update applies only to the JavaScript SDK (exa-js). Other SDKs can access highlights via direct API calls.

Installation

npm install exa-js@latest