Build magical context for an agent turn (optionally extract & ingest).
curl --request POST \
--url https://api.flumes.ai/v0/context/assemble \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"entity_id": "<string>",
"turn": "<string>",
"namespace": "default",
"goal": "<string>",
"budget": {
"max_context_tokens": 1200
},
"policy": {
"pii_redaction": "auto",
"egress_rehydration": "none"
},
"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
},
"seed_context": {
"memory_ids": [
"<string>"
],
"snippets": [
"<string>"
]
},
"must_include": [
"<string>"
],
"ingest": {
"extract": true,
"store_turn": "event",
"upsert_conflicts": "smart"
}
}
'import requests
url = "https://api.flumes.ai/v0/context/assemble"
payload = {
"entity_id": "<string>",
"turn": "<string>",
"namespace": "default",
"goal": "<string>",
"budget": { "max_context_tokens": 1200 },
"policy": {
"pii_redaction": "auto",
"egress_rehydration": "none"
},
"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
},
"seed_context": {
"memory_ids": ["<string>"],
"snippets": ["<string>"]
},
"must_include": ["<string>"],
"ingest": {
"extract": True,
"store_turn": "event",
"upsert_conflicts": "smart"
}
}
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({
entity_id: '<string>',
turn: '<string>',
namespace: 'default',
goal: '<string>',
budget: {max_context_tokens: 1200},
policy: {pii_redaction: 'auto', egress_rehydration: 'none'},
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
},
seed_context: {memory_ids: ['<string>'], snippets: ['<string>']},
must_include: ['<string>'],
ingest: {extract: true, store_turn: 'event', upsert_conflicts: 'smart'}
})
};
fetch('https://api.flumes.ai/v0/context/assemble', 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/context/assemble",
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([
'entity_id' => '<string>',
'turn' => '<string>',
'namespace' => 'default',
'goal' => '<string>',
'budget' => [
'max_context_tokens' => 1200
],
'policy' => [
'pii_redaction' => 'auto',
'egress_rehydration' => 'none'
],
'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
],
'seed_context' => [
'memory_ids' => [
'<string>'
],
'snippets' => [
'<string>'
]
],
'must_include' => [
'<string>'
],
'ingest' => [
'extract' => true,
'store_turn' => 'event',
'upsert_conflicts' => 'smart'
]
]),
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/context/assemble"
payload := strings.NewReader("{\n \"entity_id\": \"<string>\",\n \"turn\": \"<string>\",\n \"namespace\": \"default\",\n \"goal\": \"<string>\",\n \"budget\": {\n \"max_context_tokens\": 1200\n },\n \"policy\": {\n \"pii_redaction\": \"auto\",\n \"egress_rehydration\": \"none\"\n },\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 \"seed_context\": {\n \"memory_ids\": [\n \"<string>\"\n ],\n \"snippets\": [\n \"<string>\"\n ]\n },\n \"must_include\": [\n \"<string>\"\n ],\n \"ingest\": {\n \"extract\": true,\n \"store_turn\": \"event\",\n \"upsert_conflicts\": \"smart\"\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/context/assemble")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"entity_id\": \"<string>\",\n \"turn\": \"<string>\",\n \"namespace\": \"default\",\n \"goal\": \"<string>\",\n \"budget\": {\n \"max_context_tokens\": 1200\n },\n \"policy\": {\n \"pii_redaction\": \"auto\",\n \"egress_rehydration\": \"none\"\n },\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 \"seed_context\": {\n \"memory_ids\": [\n \"<string>\"\n ],\n \"snippets\": [\n \"<string>\"\n ]\n },\n \"must_include\": [\n \"<string>\"\n ],\n \"ingest\": {\n \"extract\": true,\n \"store_turn\": \"event\",\n \"upsert_conflicts\": \"smart\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.flumes.ai/v0/context/assemble")
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 \"entity_id\": \"<string>\",\n \"turn\": \"<string>\",\n \"namespace\": \"default\",\n \"goal\": \"<string>\",\n \"budget\": {\n \"max_context_tokens\": 1200\n },\n \"policy\": {\n \"pii_redaction\": \"auto\",\n \"egress_rehydration\": \"none\"\n },\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 \"seed_context\": {\n \"memory_ids\": [\n \"<string>\"\n ],\n \"snippets\": [\n \"<string>\"\n ]\n },\n \"must_include\": [\n \"<string>\"\n ],\n \"ingest\": {\n \"extract\": true,\n \"store_turn\": \"event\",\n \"upsert_conflicts\": \"smart\"\n }\n}"
response = http.request(request)
puts response.read_body{
"context": {
"facts": [
"<string>"
],
"facts_struct": [
{
"memory_id": "<string>",
"type": "<string>",
"text": "<string>",
"subject": "<string>",
"predicate": "<string>",
"object_text": "<string>",
"object_num": 123,
"object_type": "<string>",
"unit": "<string>",
"keys": [
"<string>"
],
"status": "<string>",
"confidence": 123,
"timestamp": "2023-11-07T05:31:56Z",
"valid_from": "2023-11-07T05:31:56Z",
"valid_to": "2023-11-07T05:31:56Z",
"score": 123,
"metadata": {},
"tags": [
"<string>"
],
"provenance": {}
}
],
"recent_events": [
"<string>"
],
"summary": "<string>",
"sources": [
"<string>"
],
"token_counts": {
"planned": 123,
"budget": 123,
"dropped": 123
},
"budget_actions": [
{
"action": "<string>",
"memory_id": "<string>",
"notes": "<string>"
}
]
},
"trace": {
"summary": {
"origin": "<string>",
"tokens_out": 123
},
"budget": {
"origin": "<string>",
"chars_per_token": 123
}
},
"extracted": {
"entities": [
{
"entity_id": "<string>",
"type": "<string>",
"name": "<string>",
"confidence": 0.5,
"attributes": {}
}
],
"facts": [
{
"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": {}
}
],
"upserts": [
{
"memory_id": "<string>",
"supersedes": [
"<string>"
]
}
],
"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
},
"flags": {
"degraded": false,
"weights_renormalized": false
},
"cost": {
"input_tokens": 0,
"embedding": 0,
"llm_tokens": 0,
"retrieval_ops": 0
},
"redaction": {
"applied": true,
"rules": [
"<string>"
]
},
"raw_memories": [
{
"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": {}
}{
"error": "<string>",
"message": "<string>",
"request_id": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"request_id": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"request_id": "<string>",
"details": {}
}Context
Build magical context for an agent turn (optionally extract & ingest).
POST
/
v0
/
context
/
assemble
Build magical context for an agent turn (optionally extract & ingest).
curl --request POST \
--url https://api.flumes.ai/v0/context/assemble \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"entity_id": "<string>",
"turn": "<string>",
"namespace": "default",
"goal": "<string>",
"budget": {
"max_context_tokens": 1200
},
"policy": {
"pii_redaction": "auto",
"egress_rehydration": "none"
},
"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
},
"seed_context": {
"memory_ids": [
"<string>"
],
"snippets": [
"<string>"
]
},
"must_include": [
"<string>"
],
"ingest": {
"extract": true,
"store_turn": "event",
"upsert_conflicts": "smart"
}
}
'import requests
url = "https://api.flumes.ai/v0/context/assemble"
payload = {
"entity_id": "<string>",
"turn": "<string>",
"namespace": "default",
"goal": "<string>",
"budget": { "max_context_tokens": 1200 },
"policy": {
"pii_redaction": "auto",
"egress_rehydration": "none"
},
"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
},
"seed_context": {
"memory_ids": ["<string>"],
"snippets": ["<string>"]
},
"must_include": ["<string>"],
"ingest": {
"extract": True,
"store_turn": "event",
"upsert_conflicts": "smart"
}
}
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({
entity_id: '<string>',
turn: '<string>',
namespace: 'default',
goal: '<string>',
budget: {max_context_tokens: 1200},
policy: {pii_redaction: 'auto', egress_rehydration: 'none'},
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
},
seed_context: {memory_ids: ['<string>'], snippets: ['<string>']},
must_include: ['<string>'],
ingest: {extract: true, store_turn: 'event', upsert_conflicts: 'smart'}
})
};
fetch('https://api.flumes.ai/v0/context/assemble', 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/context/assemble",
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([
'entity_id' => '<string>',
'turn' => '<string>',
'namespace' => 'default',
'goal' => '<string>',
'budget' => [
'max_context_tokens' => 1200
],
'policy' => [
'pii_redaction' => 'auto',
'egress_rehydration' => 'none'
],
'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
],
'seed_context' => [
'memory_ids' => [
'<string>'
],
'snippets' => [
'<string>'
]
],
'must_include' => [
'<string>'
],
'ingest' => [
'extract' => true,
'store_turn' => 'event',
'upsert_conflicts' => 'smart'
]
]),
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/context/assemble"
payload := strings.NewReader("{\n \"entity_id\": \"<string>\",\n \"turn\": \"<string>\",\n \"namespace\": \"default\",\n \"goal\": \"<string>\",\n \"budget\": {\n \"max_context_tokens\": 1200\n },\n \"policy\": {\n \"pii_redaction\": \"auto\",\n \"egress_rehydration\": \"none\"\n },\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 \"seed_context\": {\n \"memory_ids\": [\n \"<string>\"\n ],\n \"snippets\": [\n \"<string>\"\n ]\n },\n \"must_include\": [\n \"<string>\"\n ],\n \"ingest\": {\n \"extract\": true,\n \"store_turn\": \"event\",\n \"upsert_conflicts\": \"smart\"\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/context/assemble")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"entity_id\": \"<string>\",\n \"turn\": \"<string>\",\n \"namespace\": \"default\",\n \"goal\": \"<string>\",\n \"budget\": {\n \"max_context_tokens\": 1200\n },\n \"policy\": {\n \"pii_redaction\": \"auto\",\n \"egress_rehydration\": \"none\"\n },\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 \"seed_context\": {\n \"memory_ids\": [\n \"<string>\"\n ],\n \"snippets\": [\n \"<string>\"\n ]\n },\n \"must_include\": [\n \"<string>\"\n ],\n \"ingest\": {\n \"extract\": true,\n \"store_turn\": \"event\",\n \"upsert_conflicts\": \"smart\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.flumes.ai/v0/context/assemble")
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 \"entity_id\": \"<string>\",\n \"turn\": \"<string>\",\n \"namespace\": \"default\",\n \"goal\": \"<string>\",\n \"budget\": {\n \"max_context_tokens\": 1200\n },\n \"policy\": {\n \"pii_redaction\": \"auto\",\n \"egress_rehydration\": \"none\"\n },\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 \"seed_context\": {\n \"memory_ids\": [\n \"<string>\"\n ],\n \"snippets\": [\n \"<string>\"\n ]\n },\n \"must_include\": [\n \"<string>\"\n ],\n \"ingest\": {\n \"extract\": true,\n \"store_turn\": \"event\",\n \"upsert_conflicts\": \"smart\"\n }\n}"
response = http.request(request)
puts response.read_body{
"context": {
"facts": [
"<string>"
],
"facts_struct": [
{
"memory_id": "<string>",
"type": "<string>",
"text": "<string>",
"subject": "<string>",
"predicate": "<string>",
"object_text": "<string>",
"object_num": 123,
"object_type": "<string>",
"unit": "<string>",
"keys": [
"<string>"
],
"status": "<string>",
"confidence": 123,
"timestamp": "2023-11-07T05:31:56Z",
"valid_from": "2023-11-07T05:31:56Z",
"valid_to": "2023-11-07T05:31:56Z",
"score": 123,
"metadata": {},
"tags": [
"<string>"
],
"provenance": {}
}
],
"recent_events": [
"<string>"
],
"summary": "<string>",
"sources": [
"<string>"
],
"token_counts": {
"planned": 123,
"budget": 123,
"dropped": 123
},
"budget_actions": [
{
"action": "<string>",
"memory_id": "<string>",
"notes": "<string>"
}
]
},
"trace": {
"summary": {
"origin": "<string>",
"tokens_out": 123
},
"budget": {
"origin": "<string>",
"chars_per_token": 123
}
},
"extracted": {
"entities": [
{
"entity_id": "<string>",
"type": "<string>",
"name": "<string>",
"confidence": 0.5,
"attributes": {}
}
],
"facts": [
{
"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": {}
}
],
"upserts": [
{
"memory_id": "<string>",
"supersedes": [
"<string>"
]
}
],
"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
},
"flags": {
"degraded": false,
"weights_renormalized": false
},
"cost": {
"input_tokens": 0,
"embedding": 0,
"llm_tokens": 0,
"retrieval_ops": 0
},
"redaction": {
"applied": true,
"rules": [
"<string>"
]
},
"raw_memories": [
{
"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": {}
}{
"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
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
Agent id within the org.
Maximum string length:
128Idempotency key for safe retries (unique per org).
Maximum string length:
128Query Parameters
Include verbose trace/debug fields.
Body
application/json
Maximum string length:
20000Maximum string length:
2000Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
memory_ids to pin if present
Show child attributes
Show child attributes
⌘I
