Using Retrieval Add-Ons

This guide describes how to augment Jasper API generations with real-time data from the web.

Introduction

Retrieval Add-ons provide capabilities to augment API generations with data from outside of the Jasper platform. The Jasper API currently offers two retrieval add-ons:webSearch and webScraper. These add-ons allow for enhancing AI-generated content with real-time data from the web directly though the Jasper API, helping to overcome the limitations of knowledge cutoffs and training data gaps with Large Language Models (LLMs). Each add-on has a default behavior and options for further customization.

Using Web Search

The webSearch add-on provides web searching capabilities directly from the Jasper API. Retrieving context from a web search to enrich an AI generation is recommended for use cases that require current and up-to-date information, such as generating news articles or content about a living person, place, or thing ("The Shifting Landscape of Social Media Platforms").

Default Behavior

By default, when you use the webSearch add-on without specific options in your request, Jasper will determine an appropriate query based on the inputs supplied in the request, use this query to conduct a web search, and then leverage the top three search results as context during the generation.

Example: Using webSearch in a Command

POST /v1/command
Content-Type: application/json

{
  "inputs": {
    "command": "Write a blog post about the latest advancements in AI technology",
    "retrievalAddOn": "webSearch"
  }
}

Example: Using webSearch in a Template

POST /v1/templates/skl_33330DF2C49347A4B2411624CF8E8A5B/run
Content-Type: application/json

{
  "inputs": {
    "productName": "GitLab Duo",
    "productDescription": "GitLab Duo is a suite of AI-powered features that assist you while you work in GitLab. These features aim to help increase velocity and solve key pain points across the software development lifecycle. GitLab Duo features are available in IDE extensions and the GitLab UI. Some features are also available as part of GitLab Duo Chat.",
    "retrievalAddOn": "webSearch"
  }
}

Web Search Options

You can customize the behavior of the webSearch add-on using the following options:

  • siteBlockList: List of domains to exclude from search results.
  • searchQuery: A custom query to override the default query formation behavior for the web search.
  • maxResults: The max number of search results to use in the generation.

Example: Customizing webSearch Options in a Command

POST /v1/command
Content-Type: application/json

{
  "inputs": {
    "command": "Summarize the latest advancements in AI technology.",
    "retrievalAddOn": "webSearch"
  },
  "options": {
    "webSearch": {
      "siteBlockList": ["competitor-1.com", "competitor-2.com"],
      "searchQuery": "AI technology advancements in 2024",
      "maxResults": 5
    }
  }
}

Using Web Scraping

The webScraper add-on provides URL scraping capabilities directly from the Jasper API. Jasper will scrape, clean, and reformat data from web pages and then use this data as context in the generation. Web scraping is commonly used for retrieving information that changes overtime or is not part of LLMs training data. For example, the information needed to power an AI generation may be actively maintained on a public webpage (e.g product information) or you may need to retrieve niche information across the web that is not part of LLMs training data.

Default Behavior

By default, when you use the webScraper add-on without providing specific URLs, Jasper will automatically detect URLs in the request inputs and scrape these during generation.

Example: Using webScraper in a Command


POST /v1/command
Content-Type: application/json

{
  "inputs": {
    "command": "Generate a product description around 500 words based on the information found at https://www.jasper.ai/api",
    "retrievalAddOn": "webScraper"
  }
}

Example: Using webScraper in a Template

POST /v1/templates/skl_33330DF2C49347A4B2411624CF8E8A5B/run
Content-Type: application/json

{
  "inputs": {
    "productName": "Jasper API",
    "productDescription": "Information can be found here: https://www.jasper.ai/api",
    "retrievalAddOn": "webScraper"
  }
}

Web Scraping Options

You can customize the behavior of webScraper using the following options:

  • urls: List of URLs to extract relevant information from.

Example: Customizing webScraper Options in a Command

POST /v1/command
Content-Type: application/json

{
  "inputs": {
    "command": "Generate a product description around 500 words from the webpage contents provided.",
    "retrievalAddOn": "webScraper"
  },
  "options": {
    "webScraper": {
      "urls": ["https://www.jasper.ai/api"]
    },
    "completionType" : "quality"
  }
}