memories
Create memories
Store new memories in a MemCube.
POST
/
memories
Create memories
curl --request POST \
--url https://api.example.com/memories \
--header 'Content-Type: application/json' \
--data '
{
"user_id": "user123",
"messages": [
{
"content": "Hello",
"role": "user"
}
],
"mem_cube_id": "cube123",
"memory_content": "This is a memory content",
"doc_path": "/path/to/document.txt"
}
'import requests
url = "https://api.example.com/memories"
payload = {
"user_id": "user123",
"messages": [
{
"content": "Hello",
"role": "user"
}
],
"mem_cube_id": "cube123",
"memory_content": "This is a memory content",
"doc_path": "/path/to/document.txt"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
user_id: 'user123',
messages: [{content: 'Hello', role: 'user'}],
mem_cube_id: 'cube123',
memory_content: 'This is a memory content',
doc_path: '/path/to/document.txt'
})
};
fetch('https://api.example.com/memories', 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.example.com/memories",
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([
'user_id' => 'user123',
'messages' => [
[
'content' => 'Hello',
'role' => 'user'
]
],
'mem_cube_id' => 'cube123',
'memory_content' => 'This is a memory content',
'doc_path' => '/path/to/document.txt'
]),
CURLOPT_HTTPHEADER => [
"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.example.com/memories"
payload := strings.NewReader("{\n \"user_id\": \"user123\",\n \"messages\": [\n {\n \"content\": \"Hello\",\n \"role\": \"user\"\n }\n ],\n \"mem_cube_id\": \"cube123\",\n \"memory_content\": \"This is a memory content\",\n \"doc_path\": \"/path/to/document.txt\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.example.com/memories")
.header("Content-Type", "application/json")
.body("{\n \"user_id\": \"user123\",\n \"messages\": [\n {\n \"content\": \"Hello\",\n \"role\": \"user\"\n }\n ],\n \"mem_cube_id\": \"cube123\",\n \"memory_content\": \"This is a memory content\",\n \"doc_path\": \"/path/to/document.txt\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/memories")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"user_id\": \"user123\",\n \"messages\": [\n {\n \"content\": \"Hello\",\n \"role\": \"user\"\n }\n ],\n \"mem_cube_id\": \"cube123\",\n \"memory_content\": \"This is a memory content\",\n \"doc_path\": \"/path/to/document.txt\"\n}"
response = http.request(request)
puts response.read_body{
"message": "Operation successful",
"code": 200,
"data": null
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Body
application/json
User ID for the request
Example:
"user123"
List of messages to store.
Show child attributes
Show child attributes
Example:
[{ "content": "Hello", "role": "user" }]
ID of the memory cube
Example:
"cube123"
Content to store as memory
Example:
"This is a memory content"
Path to document to store
Example:
"/path/to/document.txt"
⌘I
Create memories
curl --request POST \
--url https://api.example.com/memories \
--header 'Content-Type: application/json' \
--data '
{
"user_id": "user123",
"messages": [
{
"content": "Hello",
"role": "user"
}
],
"mem_cube_id": "cube123",
"memory_content": "This is a memory content",
"doc_path": "/path/to/document.txt"
}
'import requests
url = "https://api.example.com/memories"
payload = {
"user_id": "user123",
"messages": [
{
"content": "Hello",
"role": "user"
}
],
"mem_cube_id": "cube123",
"memory_content": "This is a memory content",
"doc_path": "/path/to/document.txt"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
user_id: 'user123',
messages: [{content: 'Hello', role: 'user'}],
mem_cube_id: 'cube123',
memory_content: 'This is a memory content',
doc_path: '/path/to/document.txt'
})
};
fetch('https://api.example.com/memories', 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.example.com/memories",
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([
'user_id' => 'user123',
'messages' => [
[
'content' => 'Hello',
'role' => 'user'
]
],
'mem_cube_id' => 'cube123',
'memory_content' => 'This is a memory content',
'doc_path' => '/path/to/document.txt'
]),
CURLOPT_HTTPHEADER => [
"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.example.com/memories"
payload := strings.NewReader("{\n \"user_id\": \"user123\",\n \"messages\": [\n {\n \"content\": \"Hello\",\n \"role\": \"user\"\n }\n ],\n \"mem_cube_id\": \"cube123\",\n \"memory_content\": \"This is a memory content\",\n \"doc_path\": \"/path/to/document.txt\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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.example.com/memories")
.header("Content-Type", "application/json")
.body("{\n \"user_id\": \"user123\",\n \"messages\": [\n {\n \"content\": \"Hello\",\n \"role\": \"user\"\n }\n ],\n \"mem_cube_id\": \"cube123\",\n \"memory_content\": \"This is a memory content\",\n \"doc_path\": \"/path/to/document.txt\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/memories")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"user_id\": \"user123\",\n \"messages\": [\n {\n \"content\": \"Hello\",\n \"role\": \"user\"\n }\n ],\n \"mem_cube_id\": \"cube123\",\n \"memory_content\": \"This is a memory content\",\n \"doc_path\": \"/path/to/document.txt\"\n}"
response = http.request(request)
puts response.read_body{
"message": "Operation successful",
"code": 200,
"data": null
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}