Skip to main content
POST
/
v0
/
recall
Hybrid retrieval over facts/events/documents with tunable weights.
curl --request POST \
  --url https://api.flumes.ai/v0/recall \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "query": "<string>",
  "entity_id": "<string>",
  "namespace": "default",
  "filters": {
    "types": [
      "<string>"
    ],
    "tags_any": [
      "<string>"
    ],
    "metadata": {},
    "time_range": {
      "from": "2023-11-07T05:31:56Z",
      "to": "2023-11-07T05:31:56Z"
    }
  },
  "sort": "score_desc",
  "cursor": "<string>",
  "limit": 16,
  "retrieval": {
    "weights": {
      "semantic": 0.45,
      "bm25": 0.25,
      "graph_prior": 0.15,
      "recency_decay": 0.1,
      "confidence": 0.05
    },
    "normalization": "minmax",
    "recency_half_life_days": 45,
    "top_k": 24,
    "diversity": {
      "enable": true,
      "max_per_predicate": 3,
      "max_per_source": 5
    },
    "predicate_boosts": {},
    "entity_boosts": [
      "<string>"
    ],
    "depth": 2,
    "rerank": {
      "enable": false
    }
  },
  "return": {
    "include": [
      "facts",
      "recent_events",
      "summary",
      "sources"
    ],
    "max_facts": 12,
    "max_events": 6,
    "include_scores": false,
    "include_raw_memories": false,
    "trace": false,
    "include_structured_facts": false,
    "include_raw_matches": false
  }
}
'
import requests

url = "https://api.flumes.ai/v0/recall"

payload = {
"query": "<string>",
"entity_id": "<string>",
"namespace": "default",
"filters": {
"types": ["<string>"],
"tags_any": ["<string>"],
"metadata": {},
"time_range": {
"from": "2023-11-07T05:31:56Z",
"to": "2023-11-07T05:31:56Z"
}
},
"sort": "score_desc",
"cursor": "<string>",
"limit": 16,
"retrieval": {
"weights": {
"semantic": 0.45,
"bm25": 0.25,
"graph_prior": 0.15,
"recency_decay": 0.1,
"confidence": 0.05
},
"normalization": "minmax",
"recency_half_life_days": 45,
"top_k": 24,
"diversity": {
"enable": True,
"max_per_predicate": 3,
"max_per_source": 5
},
"predicate_boosts": {},
"entity_boosts": ["<string>"],
"depth": 2,
"rerank": { "enable": False }
},
"return": {
"include": ["facts", "recent_events", "summary", "sources"],
"max_facts": 12,
"max_events": 6,
"include_scores": False,
"include_raw_memories": False,
"trace": False,
"include_structured_facts": False,
"include_raw_matches": False
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
query: '<string>',
entity_id: '<string>',
namespace: 'default',
filters: {
types: ['<string>'],
tags_any: ['<string>'],
metadata: {},
time_range: {from: '2023-11-07T05:31:56Z', to: '2023-11-07T05:31:56Z'}
},
sort: 'score_desc',
cursor: '<string>',
limit: 16,
retrieval: {
weights: {
semantic: 0.45,
bm25: 0.25,
graph_prior: 0.15,
recency_decay: 0.1,
confidence: 0.05
},
normalization: 'minmax',
recency_half_life_days: 45,
top_k: 24,
diversity: {enable: true, max_per_predicate: 3, max_per_source: 5},
predicate_boosts: {},
entity_boosts: ['<string>'],
depth: 2,
rerank: {enable: false}
},
return: {
include: ['facts', 'recent_events', 'summary', 'sources'],
max_facts: 12,
max_events: 6,
include_scores: false,
include_raw_memories: false,
trace: false,
include_structured_facts: false,
include_raw_matches: false
}
})
};

fetch('https://api.flumes.ai/v0/recall', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.flumes.ai/v0/recall",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'query' => '<string>',
'entity_id' => '<string>',
'namespace' => 'default',
'filters' => [
'types' => [
'<string>'
],
'tags_any' => [
'<string>'
],
'metadata' => [

],
'time_range' => [
'from' => '2023-11-07T05:31:56Z',
'to' => '2023-11-07T05:31:56Z'
]
],
'sort' => 'score_desc',
'cursor' => '<string>',
'limit' => 16,
'retrieval' => [
'weights' => [
'semantic' => 0.45,
'bm25' => 0.25,
'graph_prior' => 0.15,
'recency_decay' => 0.1,
'confidence' => 0.05
],
'normalization' => 'minmax',
'recency_half_life_days' => 45,
'top_k' => 24,
'diversity' => [
'enable' => true,
'max_per_predicate' => 3,
'max_per_source' => 5
],
'predicate_boosts' => [

],
'entity_boosts' => [
'<string>'
],
'depth' => 2,
'rerank' => [
'enable' => false
]
],
'return' => [
'include' => [
'facts',
'recent_events',
'summary',
'sources'
],
'max_facts' => 12,
'max_events' => 6,
'include_scores' => false,
'include_raw_memories' => false,
'trace' => false,
'include_structured_facts' => false,
'include_raw_matches' => false
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.flumes.ai/v0/recall"

payload := strings.NewReader("{\n \"query\": \"<string>\",\n \"entity_id\": \"<string>\",\n \"namespace\": \"default\",\n \"filters\": {\n \"types\": [\n \"<string>\"\n ],\n \"tags_any\": [\n \"<string>\"\n ],\n \"metadata\": {},\n \"time_range\": {\n \"from\": \"2023-11-07T05:31:56Z\",\n \"to\": \"2023-11-07T05:31:56Z\"\n }\n },\n \"sort\": \"score_desc\",\n \"cursor\": \"<string>\",\n \"limit\": 16,\n \"retrieval\": {\n \"weights\": {\n \"semantic\": 0.45,\n \"bm25\": 0.25,\n \"graph_prior\": 0.15,\n \"recency_decay\": 0.1,\n \"confidence\": 0.05\n },\n \"normalization\": \"minmax\",\n \"recency_half_life_days\": 45,\n \"top_k\": 24,\n \"diversity\": {\n \"enable\": true,\n \"max_per_predicate\": 3,\n \"max_per_source\": 5\n },\n \"predicate_boosts\": {},\n \"entity_boosts\": [\n \"<string>\"\n ],\n \"depth\": 2,\n \"rerank\": {\n \"enable\": false\n }\n },\n \"return\": {\n \"include\": [\n \"facts\",\n \"recent_events\",\n \"summary\",\n \"sources\"\n ],\n \"max_facts\": 12,\n \"max_events\": 6,\n \"include_scores\": false,\n \"include_raw_memories\": false,\n \"trace\": false,\n \"include_structured_facts\": false,\n \"include_raw_matches\": false\n }\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.flumes.ai/v0/recall")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"<string>\",\n \"entity_id\": \"<string>\",\n \"namespace\": \"default\",\n \"filters\": {\n \"types\": [\n \"<string>\"\n ],\n \"tags_any\": [\n \"<string>\"\n ],\n \"metadata\": {},\n \"time_range\": {\n \"from\": \"2023-11-07T05:31:56Z\",\n \"to\": \"2023-11-07T05:31:56Z\"\n }\n },\n \"sort\": \"score_desc\",\n \"cursor\": \"<string>\",\n \"limit\": 16,\n \"retrieval\": {\n \"weights\": {\n \"semantic\": 0.45,\n \"bm25\": 0.25,\n \"graph_prior\": 0.15,\n \"recency_decay\": 0.1,\n \"confidence\": 0.05\n },\n \"normalization\": \"minmax\",\n \"recency_half_life_days\": 45,\n \"top_k\": 24,\n \"diversity\": {\n \"enable\": true,\n \"max_per_predicate\": 3,\n \"max_per_source\": 5\n },\n \"predicate_boosts\": {},\n \"entity_boosts\": [\n \"<string>\"\n ],\n \"depth\": 2,\n \"rerank\": {\n \"enable\": false\n }\n },\n \"return\": {\n \"include\": [\n \"facts\",\n \"recent_events\",\n \"summary\",\n \"sources\"\n ],\n \"max_facts\": 12,\n \"max_events\": 6,\n \"include_scores\": false,\n \"include_raw_memories\": false,\n \"trace\": false,\n \"include_structured_facts\": false,\n \"include_raw_matches\": false\n }\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.flumes.ai/v0/recall")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"query\": \"<string>\",\n \"entity_id\": \"<string>\",\n \"namespace\": \"default\",\n \"filters\": {\n \"types\": [\n \"<string>\"\n ],\n \"tags_any\": [\n \"<string>\"\n ],\n \"metadata\": {},\n \"time_range\": {\n \"from\": \"2023-11-07T05:31:56Z\",\n \"to\": \"2023-11-07T05:31:56Z\"\n }\n },\n \"sort\": \"score_desc\",\n \"cursor\": \"<string>\",\n \"limit\": 16,\n \"retrieval\": {\n \"weights\": {\n \"semantic\": 0.45,\n \"bm25\": 0.25,\n \"graph_prior\": 0.15,\n \"recency_decay\": 0.1,\n \"confidence\": 0.05\n },\n \"normalization\": \"minmax\",\n \"recency_half_life_days\": 45,\n \"top_k\": 24,\n \"diversity\": {\n \"enable\": true,\n \"max_per_predicate\": 3,\n \"max_per_source\": 5\n },\n \"predicate_boosts\": {},\n \"entity_boosts\": [\n \"<string>\"\n ],\n \"depth\": 2,\n \"rerank\": {\n \"enable\": false\n }\n },\n \"return\": {\n \"include\": [\n \"facts\",\n \"recent_events\",\n \"summary\",\n \"sources\"\n ],\n \"max_facts\": 12,\n \"max_events\": 6,\n \"include_scores\": false,\n \"include_raw_memories\": false,\n \"trace\": false,\n \"include_structured_facts\": false,\n \"include_raw_matches\": false\n }\n}"

response = http.request(request)
puts response.read_body
{
  "matches": [
    {
      "memory_id": "<string>",
      "type": "<string>",
      "text": "<string>",
      "metadata": {},
      "score": 123,
      "score_components": {},
      "reason": [
        "<string>"
      ],
      "timestamp": "2023-11-07T05:31:56Z"
    }
  ],
  "retrieval_summary": {
    "weights_used": {
      "semantic": 0.45,
      "bm25": 0.25,
      "graph_prior": 0.15,
      "recency_decay": 0.1,
      "confidence": 0.05
    },
    "normalization": "<string>",
    "depth": 123,
    "candidate_counts": {
      "semantic": 123,
      "bm25": 123,
      "graph": 123,
      "union": 123,
      "after_filters": 123
    },
    "diversity_actions": {
      "clamped_by_predicate": 123,
      "clamped_by_source": 123
    },
    "degraded": true,
    "budget_cut_count": 123
  },
  "next_cursor": "<string>",
  "flags": {
    "degraded": false,
    "weights_renormalized": false
  },
  "cost": {
    "input_tokens": 0,
    "embedding": 0,
    "llm_tokens": 0,
    "retrieval_ops": 0
  },
  "raw_items": [
    {
      "namespace": "default",
      "text": "<string>",
      "memory_id": "<string>",
      "org_id": "<string>",
      "agent_id": "<string>",
      "entity_id": "<string>",
      "metadata": {},
      "tags": [
        "<string>"
      ],
      "timestamp": "2023-11-07T05:31:56Z",
      "archived": false,
      "sensitivity": "auto",
      "subject": "<string>",
      "predicate": "<string>",
      "object": "<string>",
      "unit": "<string>",
      "keys": [
        "<string>"
      ],
      "valid_from": "2023-11-07T05:31:56Z",
      "valid_to": "2023-11-07T05:31:56Z",
      "confidence": 0.5,
      "status": "active",
      "provenance": {}
    }
  ],
  "request_id": "<string>"
}
{
"error": "<string>",
"message": "<string>",
"request_id": "<string>",
"details": {}
}
{
"error": "<string>",
"message": "<string>",
"request_id": "<string>",
"details": {}
}
{
"error": "<string>",
"message": "<string>",
"request_id": "<string>",
"details": {}
}
{
"error": "<string>",
"message": "<string>",
"request_id": "<string>",
"details": {}
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Headers

X-Flumes-Agent
string

Agent id within the org.

Maximum string length: 128

Body

application/json
query
string
Maximum string length: 4000
entity_id
string | null
namespace
string
default:default
filters
object
sort
enum<string>
default:score_desc
Available options:
score_desc,
timestamp_desc
cursor
string | null
limit
integer
default:16
Required range: x <= 200
retrieval
object
return
object

Response

Matches with scoring

matches
object[]
retrieval_summary
object
next_cursor
string | null
flags
object
cost
object
raw_items
object[]

Present only when return.include_raw_memories=true

request_id
string