> ## Documentation Index
> Fetch the complete documentation index at: https://mem0-feature-memo-claude-plugin-v1.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Feedback Mechanism

> Provide positive or negative feedback on generated memories to continuously improve accuracy and search results.

Mem0's Feedback Mechanism allows you to provide feedback on the memories generated by your application. This feedback is used to improve the accuracy of the memories and search results.

## How it works

The feedback mechanism is a simple API that allows you to provide feedback on the memories generated by your application. The feedback is stored in the database and used to improve the accuracy of the memories and search results. Over time, Mem0 continuously learns from this feedback, refining its memory generation and search capabilities for better performance.

## Give Feedback

You can give feedback on a memory by calling the `feedback` method on the Mem0 client.

<CodeGroup>
  ```python Python theme={null}
  from mem0 import MemoryClient

  client = MemoryClient(api_key="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.")
  ```

  ```javascript JavaScript theme={null}
  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."
  })
  ```
</CodeGroup>

## Feedback Types

The `feedback` parameter can be one of the following values:

* `POSITIVE`: The memory is useful.
* `NEGATIVE`: The memory is not useful.
* `VERY_NEGATIVE`: The memory is not useful at all.

## Parameters

The `feedback` method accepts these parameters:

| Parameter         | Type   | Required | Description                                                  |
| ----------------- | ------ | -------- | ------------------------------------------------------------ |
| `memory_id`       | string | Yes      | The ID of the memory to give feedback on                     |
| `feedback`        | string | No       | Type of feedback: `POSITIVE`, `NEGATIVE`, or `VERY_NEGATIVE` |
| `feedback_reason` | string | No       | Optional explanation for the feedback                        |

<Note>
  Pass `None` or `null` to the `feedback` and `feedback_reason` parameters to remove existing feedback for a memory.
</Note>

## Bulk Feedback Operations

For applications with high volumes of feedback, you can provide feedback on multiple memories at once:

<CodeGroup>
  ```python Python theme={null}
  from mem0 import MemoryClient

  client = MemoryClient(api_key="your_api_key")

  # Bulk feedback example
  feedback_data = [
      {
          "memory_id": "memory-1", 
          "feedback": "POSITIVE", 
          "feedback_reason": "Accurately captured the user's preference"
      },
      {
          "memory_id": "memory-2", 
          "feedback": "NEGATIVE", 
          "feedback_reason": "Contains outdated information"
      }
  ]

  for item in feedback_data:
      client.feedback(**item)
  ```

  ```javascript JavaScript theme={null}
  import MemoryClient from 'mem0ai';

  const client = new MemoryClient({ apiKey: 'your-api-key'});

  // Bulk feedback example
  const feedbackData = [
      {
          memory_id: "memory-1", 
          feedback: "POSITIVE", 
          feedback_reason: "Accurately captured the user's preference"
      },
      {
          memory_id: "memory-2", 
          feedback: "NEGATIVE", 
          feedback_reason: "Contains outdated information"
      }
  ];

  for (const item of feedbackData) {
      await client.feedback(item);
  }
  ```
</CodeGroup>

## Best Practices

### When to Provide Feedback

* Immediately after memory retrieval when you can assess relevance
* During user interactions when users explicitly indicate satisfaction or dissatisfaction
* Through automated evaluation using your application's success metrics

### Effective Feedback Reasons

Provide specific, actionable feedback reasons:

**Good examples:**

* "Contains outdated contact information"
* "Accurately captured the user's dietary restrictions"
* "Irrelevant to the current conversation context"

**Avoid vague reasons:**

* "Bad memory"
* "Wrong"
* "Not good"

### Feedback Strategy

1. Be consistent: Apply the same criteria across similar memories
2. Be specific: Detailed reasons help improve the system faster
3. Monitor patterns: Regular feedback analysis helps identify improvement areas

## Error Handling

Handle potential errors when submitting feedback:

<CodeGroup>
  ```python Python theme={null}
  from mem0 import MemoryClient
  from mem0.exceptions import MemoryError, ValidationError

  client = MemoryClient(api_key="your_api_key")

  try:
      client.feedback(
          memory_id="memory-123", 
          feedback="POSITIVE", 
          feedback_reason="Helpful context for user query"
      )
      print("Feedback submitted successfully")
  except ValidationError:
      print("memory_id is not a valid UUID")
  except MemoryError as e:
      print(f"memory_id was not found or not accessible ({e.error_code})")
  ```

  ```javascript JavaScript theme={null}
  import MemoryClient from 'mem0ai';

  const client = new MemoryClient({ apiKey: 'your-api-key'});

  try {
      await client.feedback({
          memory_id: "memory-123", 
          feedback: "POSITIVE", 
          feedback_reason: "Helpful context for user query"
      });
      console.log("Feedback submitted successfully");
  } catch (error) {
      if (error.errorCode === "HTTP_400") {
          console.log("memory_id is not a valid UUID");
      } else if (error.errorCode === "HTTP_500") {
          console.log("Server error - the memory_id may not exist or be inaccessible, or it may be transient; retry if it persists");
      } else {
          console.log(`Unexpected error: ${error.message}`);
      }
  }
  ```
</CodeGroup>

### Handling an unknown or malformed `memory_id`

* A malformed `memory_id` (not a valid UUID) returns a clean `400` with `{"error": "Invalid memory_id"}`.
* A well-formed but non-existent `memory_id` (or one that doesn't belong to your org or project) currently returns a `500 Internal Server Error` instead of a `404`. This is a server-side bug being tracked in [MEM-5745](https://linear.app/mem0/issue/MEM-5745). A `5xx` can also be a transient server error, so don't treat it as a definitive "not found"; to avoid the case entirely, only call `feedback` with a `memory_id` you just read from a `get_all` or `search` response.

## Feedback Analytics

Track the impact of your feedback by monitoring memory performance over time. Consider implementing:

* Feedback completion rates: What percentage of memories receive feedback
* Feedback distribution: Balance of positive vs. negative feedback
* Memory quality trends: How accuracy improves with feedback volume
* User satisfaction metrics: Correlation between feedback and user experience
