GuidesRecipesAPI EndpointsRelease NotesCommunity
Log In
Guides

Understanding the Map-Reduce Endpoint

Introduction

In Layar 2.0 there is dedicated endpoint for map-reduce workflows, /layar/gpt/mapReduce. This is a great way to get around context limits presented by any model without having to fall back on RAG. This endpoint should be used if you are looking to ask more broad questions against a large document or set of documents.

Map-Reduce Payload

{
  "sources": [
    {
      "provider": provider,
      "documentId": "AZxJZkv8X7kSH_xsJJZn"
    }
  ],
  "model": "gpt-oss-120b",
  "mapPrompt": "Identify all reisks mentioned and rate their severity",
  "reducePrompt": "Compile all risks into a prioritized list"
}

sources

A list of JSON dictionaries containing the provider and documentId / savedListId

model

A string value containing the model name you want to use for inferencing.

mapPrompt

A string value containing your map prompt.

reducePrompt

a string value containing your reduce prompt.

Endpoint Response

The response is a JSON dictionary with a single value, content This value contains the response from the model.

{
    "content": "Model response"
}