Feedback - Mem0
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Python
# To use the Python SDK, install the package:
# pip install mem0ai
from mem0 import MemoryClient
client = MemoryClient(api_key="your_api_key")
# Submit feedback for a memory
feedback = client.feedback(memory_id="memory_id", feedback="POSITIVE")
print(feedback)
JavaScript
// To use the JavaScript SDK, install the package:
// npm install mem0ai
import MemoryClient from 'mem0ai';
const client = new MemoryClient({ apiKey: 'your-api-key'});
client.feedback({
memory_id: "your-memory-id",
feedback: "NEGATIVE",
feedback_reason: "I don't like this memory because it is not relevant."
})
Curl
curl --request POST \
--url https://api.mem0.ai/v1/feedback/ \
--header 'Authorization: Token <api-key>' \
--header 'Content-Type: application/json' \
--data '{"memory_id": "memory_id", "feedback": "POSITIVE"}'
PHP
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.mem0.ai/v1/feedback/",
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([
'memory_id' => '<string>',
'feedback_reason' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
?>
Go
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.mem0.ai/v1/feedback/"
payload := strings.NewReader("{\n \"memory_id\": \"<string>\",\n \"feedback_reason\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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))
}
Java
HttpResponse<String> response = Unirest.post("https://api.mem0.ai/v1/feedback/")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"memory_id\": \"<string>\",\n \"feedback_reason\": \"<string>\"\n}")
.asString();
Ruby
require 'uri'
require 'net/http'
url = URI("https://api.mem0.ai/v1/feedback/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"memory_id\": \"<string>\",\n \"feedback_reason\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body
Authorization
Authorization
string
header
required
API key authentication. Prefix your Mem0 API key with 'Token '. Example: 'Token your_api_key'
Body
memory_id
string
required
ID of the memory to provide feedback for
feedback
enum
Type of feedback
Available options:
POSITIVE,NEGATIVE,VERY_NEGATIVE
feedback_reason
string | null
Reason for the feedback
Response
200
application/json
Successful operation.
id
string
Feedback ID
feedback
enum
Type of feedback
Available options:
POSITIVE,NEGATIVE,VERY_NEGATIVE
feedback_reason
string | null
Reason for the feedback