Sections

Get matching sections

1GET https://api.markprompt.com/sections

Retrieves a list of sections that match a prompt.

The /sections endpoint is available as part of the Enterprise plan.

Request body

KeyTypeDescription
promptstring

The input prompt.

sectionsMatchCountnumber

The number of sections to retrieve. Default: 10.

sectionsMatchThresholdnumber

The similarity threshold between the input prompt and selected sections. The higher the threshold, the more relevant the sections. If it's too high, it can potentially miss some sections. Default: 0.5.

maxContextTokensnumber

The maximum number of tokens that the returned sections fill. Default: 10000.

ragType"basic" | "smallToBig"

The RAG strategy. If set to basic, sections whose embeddings satisfy the minimum similarity score against the input prompt are returned. If set to smallToBig, search for section matches is extended to include neighboring content, as long as it fits within the maxContentTokens constraint. Note that smallToBig RAG type is an enterprise-only feature.

Example request

1curl "https://api.markprompt.com/sections?prompt=what%20is%20a%20component%3F&sectionsMatchCount=20&sectionsMatchThreshold=0.4" \
2  -X GET \
3  -H "Authorization: Bearer <TOKEN>" \
4  -H "Content-type: application/json" \
5  -H "Accept: application/json" \
6  -H "X-Markprompt-API-Version: 2024-03-23"

Response

The response is of the form:

1{
2  data: [
3    {
4      path: "/path/to/section/1",
5      content: "Section 1 content...",
6      similarity: 0.89
7    },
8    {
9      path: "/path/to/section/2",
10      content: "Section 2 content...",
11      similarity: 0.72
12    },
13    ...
14  ]
15}