Add Feedback
This API is used to add feedback to current session messages, allowing MemOS to correct memories based on user feedback.
import os
import requests
import json
# Replace with your API Key
os.environ["MEMOS_API_KEY"] = "YOUR_API_KEY"
os.environ["MEMOS_BASE_URL"] = "https://memos.memtensor.cn/api/openmem/v1"
data = {
"user_id": "memos_user_123",
"conversation_id": "memos_feedback_conv",
"feedback_content": "No, we are changing the meal allowance for tier-1 cities to 150 yuan/day and accommodation allowance to 700 yuan/day; tier-2 and tier-3 cities remain unchanged.",
"allow_knowledgebase_ids":["basee5ec9050-c964-484f-abf1-ce3e8e2aa5b7"] # Replace with Knowledge Base ID
}
headers = {
"Content-Type": "application/json",
"Authorization": f"Token {os.environ['MEMOS_API_KEY']}"
}
url = f"{os.environ['MEMOS_BASE_URL']}/add/feedback"
res = requests.post(url=url, headers=headers, data=json.dumps(data))
print(f"result: {res.json()}")
# Ensure MemoS is installed (pip install MemoryOS -U)
from memos.api.client import MemOSClient
# Initialize client with API Key
client = MemOSClient(api_key="YOUR_API_KEY")
user_id = "memos_user_123"
conversation_id = "memos_feedback_conv"
feedback_content = "No, we are changing the meal allowance for tier-1 cities to 150 yuan/day and accommodation allowance to 700 yuan/day; tier-2 and tier-3 cities remain unchanged."
allow_knowledgebase_ids = ["basee5ec9050-c964-484f-abf1-ce3e8e2aa5b7"] # Replace with Knowledge Base ID
res = client.add_feedback(
user_id=user_id,
conversation_id=conversation_id,
feedback_content=feedback_content,
allow_knowledgebase_ids=allow_knowledgebase_ids
)
print(f"result: {res}")
curl --request POST \
--url https://memos.memtensor.cn/api/openmem/v1/add/feedback \
--header 'Authorization: Token YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"user_id": "memos_user_123",
"conversation_id": "memos_feedback_conv",
"feedback_content": "No, we are changing the meal allowance for tier-1 cities to 150 yuan/day and accommodation allowance to 700 yuan/day; tier-2 and tier-3 cities remain unchanged.",
"allow_knowledgebase_ids":["basee5ec9050-c964-484f-abf1-ce3e8e2aa5b7"]
}'
Authorizations
Token API_key, available in API Console > API Keys
Body
Unique identifier of the user associated with the feedback content.
Unique identifier of the conversation associated with the feedback content.
Feedback content text.
Unique identifier of the Agent associated with the feedback content, primarily used to query exclusive memories between a user and that Agent during retrieval.
Unique identifier of the App associated with the feedback content, primarily used to query exclusive memories of a user under that App during retrieval.
Time when the feedback occurred, can be a structured timestamp or natural language time description. Providing this parameter allows memory to include time information.
Whether memories generated from the feedback content are allowed to be written to the public memory store. When enabled, generated memories can be retrieved by other users in the project.
List of knowledgebases where memories generated from the feedback content are allowed to be written.
Response
Successful Response
API status code. See Error Code for details.
API response message
import os
import requests
import json
# Replace with your API Key
os.environ["MEMOS_API_KEY"] = "YOUR_API_KEY"
os.environ["MEMOS_BASE_URL"] = "https://memos.memtensor.cn/api/openmem/v1"
data = {
"user_id": "memos_user_123",
"conversation_id": "memos_feedback_conv",
"feedback_content": "No, we are changing the meal allowance for tier-1 cities to 150 yuan/day and accommodation allowance to 700 yuan/day; tier-2 and tier-3 cities remain unchanged.",
"allow_knowledgebase_ids":["basee5ec9050-c964-484f-abf1-ce3e8e2aa5b7"] # Replace with Knowledge Base ID
}
headers = {
"Content-Type": "application/json",
"Authorization": f"Token {os.environ['MEMOS_API_KEY']}"
}
url = f"{os.environ['MEMOS_BASE_URL']}/add/feedback"
res = requests.post(url=url, headers=headers, data=json.dumps(data))
print(f"result: {res.json()}")
# Ensure MemoS is installed (pip install MemoryOS -U)
from memos.api.client import MemOSClient
# Initialize client with API Key
client = MemOSClient(api_key="YOUR_API_KEY")
user_id = "memos_user_123"
conversation_id = "memos_feedback_conv"
feedback_content = "No, we are changing the meal allowance for tier-1 cities to 150 yuan/day and accommodation allowance to 700 yuan/day; tier-2 and tier-3 cities remain unchanged."
allow_knowledgebase_ids = ["basee5ec9050-c964-484f-abf1-ce3e8e2aa5b7"] # Replace with Knowledge Base ID
res = client.add_feedback(
user_id=user_id,
conversation_id=conversation_id,
feedback_content=feedback_content,
allow_knowledgebase_ids=allow_knowledgebase_ids
)
print(f"result: {res}")
curl --request POST \
--url https://memos.memtensor.cn/api/openmem/v1/add/feedback \
--header 'Authorization: Token YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"user_id": "memos_user_123",
"conversation_id": "memos_feedback_conv",
"feedback_content": "No, we are changing the meal allowance for tier-1 cities to 150 yuan/day and accommodation allowance to 700 yuan/day; tier-2 and tier-3 cities remain unchanged.",
"allow_knowledgebase_ids":["basee5ec9050-c964-484f-abf1-ce3e8e2aa5b7"]
}'