# Welcome

Welcome to Second Me! We're pioneering an open-source AI identity system that represents rather than replaces you. Our platform creates 100% private, deeply personalized AI agents that understand your unique thinking patterns, represent you across different contexts, and form collaborative networks with others.

Our mission is clear: to safeguard your distinct identity while giving you powerful new ways to exist and express yourself in the AI age.

Join us in ensuring AI serves humanity's diverse individuality rather than diminishing it.


# Tutorial

Say Hello to Second Me - A New AI Species, Making We Matter Again

<figure><img src="/files/QM09ELFpb4RsP2XdTPa1" alt=""><figcaption></figcaption></figure>

***

## Introduction

Second Me is the first open-source AI identity system that delivers 100% private, deeply personalized AI agents built specifically to represent your authentic self. It doesn't just learn your preferences - it comprehends your unique thinking patterns, represents you across different contexts, forms collaborative networks with other Second Mes, and creates new value in the emerging Agent economy. Our mission is clear: safeguarding your distinct identity - your “Me” - while giving you a powerful new way to exist and express yourself in the AI age.

## Start Here

Once `make start` completes successfully, just pop open your browser and head to <http://localhost:3000> to access the platform. Feel free to check out this video and we'll work through this setup together!

{% embed url="<https://www.loom.com/share/7f10bb22b9764d6b8c1a9fc69b2ad7c1?sid=a3b8428f-2155-418a-966e-c14603e87f23>" %}

## Step 1: Create Second Me

Ready to create your AI self? Here's how to get started.

### Define Your Identity

Start by sharing a bit about yourself - this becomes the core of your Second Me.

1. Navigate to **Create Second Me > Define Your Identity** in the left sidebar
2. Time to make it yours:
   * **Second Me Name**: Pick a name for your Second Me
   * **Short Personal Description**: Tell us a bit about yourself - your style, what drives you, what makes you you
   * **Email of Second Me**: Add an email where your Second Me can be reached
3. Hit **Save** when you're happy with everything
4. Ready for the fun part? Click **Next: Upload Your Memory** to keep going!

<figure><img src="/files/tVGXBA9ZLvaqSQQASkGs" alt=""><figcaption></figcaption></figure>

### Upload Your Memory

Now, let's teach your Second Me about you!

1. Head over to **Create Second Me > Upload Your Memory**
2. Share your experiences any way you like:
   * **Text**: Just type it in - drop your thoughts right on the page
   * **File**: Upload them one by one
   * **Folder**: Dump a whole folder - we'll sort it out
   * Soon you'll be able to connect your apps and wearables too!
3. When you're done sharing, just hit **Next: Training** and we'll work our magic!

{% hint style="info" %}
**Tips:**

* Upload diverse content that reflects your thinking patterns, writing style, and knowledge areas
* While more data can help, too many files might slow down your training time. Consider your computer's processing power and be selective with your uploads for the best balance of quality and efficiency!
  {% endhint %}

<figure><img src="/files/sFIHKSSCOaxO0TTBdqDQ" alt=""><figcaption></figcaption></figure>

### Train Second Me

Almost there! Let's bring your Second Me to life!

1. Pop over to **Create Second Me > Train Second Me**
2. Configure your training settings:
   * **Support Model for Data Synthesis:** Pick how you want your memories processed
   * **Base Model for Training Second Me:** Choose a model that works best with your computer
3. Hit **Start Training** and watch the magic happen!

Keep an eye on the progress bar - it's like watching your Second Me grow up! Once it hits 100%, you two are ready to meet!

{% hint style="info" %}
**Tips:**

* Pick a model that your computer can handle comfortably
* Training time can vary based on what you've shared. No rush - good things take time!
* Feel free to do other stuff while we work our magic! Just keep the window open and your computer running. We'll take care of the rest!
  {% endhint %}

<figure><img src="/files/dod2iSQM3bcizeq5AxpV" alt=""><figcaption></figcaption></figure>

## Step 2: Explore the Playground

Ready to meet your Second Me? Let's dive in!

### Chat Mode

Chat Mode allows you to have direct conversations with your Second Me:

1. Head over to **Playground > Chat with Second Me**
2. Just type your message and hit **Enter -** it's that easy
3. Want to tweak how your Second Me chats? Check out the cool settings on the right:
   * **Memory Retrieval**: Choose how much of your shared memories come into play
   * **System Prompt**: Shape how your Second Me acts
   * **Temperature**: Adjust the creativity level (0 = precise, 1 = creative)
4. Need a fresh start? Just hit **Clear Chat** and you're good to go!n

{% hint style="info" %}
**Tips:**

* Want your Second Me to match different vibes? Just tweak their personality settings. It's like choosing the perfect outfit for different occasions!
  {% endhint %}

<figure><img src="/files/67TJpL8WdHDGv90p6HeE" alt=""><figcaption></figcaption></figure>

## Step 3: Discover Second Me Apps

Ready to supercharge your Second Me? Check out our cool apps!

### Roleplay Apps

Roleplay Apps allow you to create specialized versions of your Second Me with different personas, each designed for specific purposes or contexts.

1. Navigate to **Second Me Apps > Roleplay Apps** in the left sidebar
2. Browse our collection (like our interview pro and cool ambassador!)
3. To explore an existing roleplay app:
   * See one you like? Just tap the card for a sneak peek
   * Ready to chat? Hit **View App** and you're set!
4. To create your own Roleplay App:
   * Smash that **Create Roleplay App** button (top-right corner)
   * Give your character an awesome name
   * Tell us their superpower (what they're best at!)
   * Tweak their style to match your vibe
   * Hit **Save!**

<figure><img src="/files/e6qs9sqO9NkEuyiuTPwp" alt=""><figcaption></figcaption></figure>

### Network Apps

**Getting Started with Network Apps**

1. Navigate to **Second Me Apps > Network Apps** in the left sidebar
2. You'll see options to join existing networks or create your own collaboration spaces

**To join the global Second Me Network**

1. Click on the **Join AI Network** button
2. Toggle **Register on the Network** to make your Second Me discoverable
3. View current network members and their online status

<figure><img src="/files/WK4AkUFpcpTj6ZIeUghS" alt=""><figcaption></figcaption></figure>

**To create a new collaboration space**

* Click the **Create New Space** button in the top-right corner
* Provide a **Space Name** (e.g., "Market Analysis Space")
* Define the **Space Task** describing the purpose of this collaboration
* Invite your crew with the + button
* Hit **Create Space** and boom - your hangout is ready!

<figure><img src="/files/3e3TILIHH414wE5rQI2z" alt=""><figcaption></figcaption></figure>

### Second X Apps

**Getting Started with Second X Apps**

1. Head over to **Second Me Apps > Second X Apps** in the left sidebar
2. Check out our "Coming Soon" lineup (trust me, it's worth the peek!)
3. Read the descriptions to understand how each app will function
4. Check back regularly as these cutting-edge applications become available

**Upcoming Second X Applications**

* **Second Tinder**: Your wingman's going digital! Let your Second Me find those perfect matches
* **Second LinkedIn**: Your digital networker building those power connections
* **Second Airbnb**: Your property's new best friend handling the hosting game
* **Second OnlyFans**: Your creative twin dropping exclusive content for the fans

<figure><img src="/files/tDXmRZNSIL2imYONsWnO" alt=""><figcaption></figcaption></figure>

***

And that's a wrap on your tour!&#x20;

Let your Second Mes loose and watch them work their magic! Can't wait to see what kind of amazing adventures you'll cook up together!


# What's new

Here are all significant changes to Second Me, updated weekly.

## Snapshot-0407: Full Docker Support & Enhanced API Integration

Released: April 8, 2025

### 🚀 New Features

* **Full Docker Support Across All Platforms**
  * Second Me now fully supports Docker deployment across **Mac (Apple Silicon included)**, **Windows**, and **Linux**.
  * This resolves previous environment issues on Apple Silicon devices and ensures a smoother, more consistent experience across platforms.
* **OpenAI-Compatible API Interface**

  * Now supports the standard OpenAI protocol interface—seamlessly integrate with VS Code, Notion, ChatBox, and hundreds of other mainstream AI apps.

  > Check out the documentation for details: docs/Public Chat API.md & docs/Local Chat API.md

### 🔮 What's Coming Next (Coming in the Next Month)

In the coming month, we're focused on making Second Me not just smarter—but more *you*. Here’s what’s on the immediate roadmap:

* **Your Identity as an Interface**\
  Your Second Me will begin acting as an MCP server that represents your identity, enabling secure and meaningful interactions with other users and services.
* **Deep Reasoning & Continuous Learning**\
  We're incorporating chain-of-thought reasoning (inspired by models like OpenAI o1 and DeepSeek R1), along with one-click continuous training. You'll be able to upload new data and instantly improve your model—tailoring Second Me to reflect your evolving thinking.

These features are actively under development and will be rolled out progressively within the next month.

## Snapshot-0331

Released: March 31, 2025

### 🚀 New Features

* **Docker Deployment Support**
  * Added containerization support for **Linux and Windows**
* **MLX Training \[Beta]**&#x20;
  * Native support for Apple Silicon, enabling faster training with larger models
  * Note: Currently optimized for Apple Silicon users; see `lpm_kernel/L2/mlx_training` README for setup instructions

### 🛠 Improvements

* **Improved Training Pipeline Logging**
  * Enhanced visibility into training processes

### 🔧 Bug Fixes & Optimizations

* **File Handling**
  * Fixed "too many open files" errors
* **Better Long-Document Handling in Embedding**
  * Improved stability and performance for processing large text inputs
* **Clipboard Support**
  * Added `copyToClipboard` functionality for improved usability

**👏 Acknowledgements:** Special thanks to our contributors, including **@Mahdi Rahimi**, **@Airmomo**, **@Llux-C**, and others, for their valuable help in implementing these improvements and fixes.


# FAQ

## Installation  & Environment Setup

### How do I install Second Me on Windows / Linux / Mac / Dock

* **Recommended solution:** Use Docker (cross-platform support: Mac, Windows, Linux).
* **Notes for Windows users:**
  * Additional installation of `make` is required (via MinGW or WSL).
  * Not recommended to use native Windows environment (not fully tested).
* **Non-Docker installation:** Ensure all dependencies are installed (e.g., brew, poetry, Python 3.12).
* **Advanced users:** Bare-metal deployment on Mac is suggested for maximum performance.

### Can I shut down my computer during training?

* **Supports checkpoint resumption:** Training progress is saved in `resource/` and `data/` directories. Restart to continue training.
* **Note:** Shutting down will terminate the current training process; the service needs to be restarted.

### Does it support GPU acceleration?

* Under development. Docker GPU support can be combined with local Ollama.

### How to use proxy or resolve network issues during installation?

* Select different sources based on your region/country for installation.

## Model/Training

### How do I train with a local model (e.g., Ollama, Gemma, Qwen)?

* **Guide:** Refer to [`Custom Model Config (Ollama).md`](https://github.com/mindverse/Second-Me/blob/master/docs/Custom%20Model%20Config\(Ollama\).md).
* **Docker users:** Replace `127.0.0.1` in the API Endpoint with `host.docker.internal`.

### Why does the model fail during training?

* **Common causes:**
  * Insufficient Docker memory limits (increase memory allocation).
  * Incorrect model configuration (verify parameter compatibility).

### What to do if ChromaDB reports embedding dimension mismatch?

* Solutions:
  * Delete `data/chroma_db` and retrain.
  * Ensure embedding model dimensions match (e.g., 768 vs. 3072).
* Appendix:
  * Partially resolved in [PR #207](https://github.com/mindverse/Second-Me/pull/207).

### Why is embedding failing with OpenAI error even when using Ollama?

* The OpenAI SDK is used, so error paths may include "OpenAI," but requests are sent to the configured model endpoint, not OpenAI's service.

### What is the recommended size for training data?

* Keep between 10k\~100k for stability. Larger datasets may cause timeouts or memory issues.

### Can I reuse API calls to save money on retraining?

* Yes, intermediate data is saved and won’t trigger repeated API calls.

## Features & Architecture

### What’s the difference between Second Me and me.bot?

* **SecondMe:** Open-source personal LLM framework.
* **Me.Bot:** An online app based on this framework.

### Can I run multiple Second Me instances?

* **Supported:** Ensure sufficient hardware resources and resolve port conflicts.

### Can I use Second Me in my own agent framework?

* Open API and MCP service support for direct integration.

### Why does embedding stage use a different model than chat stage?

* **Technical reason:** Not all model vendors provide both interfaces, openai does, but DeepSeek for example does not (for now). We need both interfaces during training, so we need to configure them separately.

## Errors & Debugging

### **No rule to make target 'setup' error?**

* **Troubleshooting:**
  * Confirm you’re in the project root directory.
  * Verify Makefile integrity.

### "Too many open files" during training?

* **Possible cause:** Memory leak, please submit an issue to us if you encounter this situation.
* **When reporting issues, include:**
  * OS (Mac/Linux).
  * Memory configuration (e.g., 16GB).
  * Docker version (if applicable).
* **Note:** Avoid sharing private data in logs.

**Can’t enter training page or web UI crashes?**

* **Debug steps:**
  * Run `make status` to check service status.
  * Verify no network conflicts (e.g., port occupancy).

### What does "entities.parquet - no such file or directory" mean?

* **Cause:** Insufficient data extraction model capability.
* **Suggestion:** Switch to high-performance models (e.g., OpenAI API).

### **“Permission denied (publickey)” when cloning repository?**

* SSH key not set up. Use HTTPS instead:

  ```
  git clone https://github.com/mindverse/Second-Me.git
  ```

### Why "internal server error"?

* **Typical cause:** The probability is that the maximum length of the chunk exceeds the limit because of the inconsistency between the configured embedding model and the maximum length set by the project.
* **Action:** You can adjust the parameter **EMBEDDING\_MAX\_TEXT\_LENGTH** in the `.env` file according to the specific parameters of the model.

### Step "generate\_biography" failed?

* For paid models (OpenAI/DeepSeek), common errors:
  * **openai.BadRequestError:** **Error code**：
    * **400 - Bad Request**
      * **Reason:** The request body format is incorrect.
      * **Solution:** Check whether the model name and API key are correct (there may be extra spaces after the model name).
    * **401 - Unauthorized**
      * **Reason:** Invalid API key, authentication failed.
      * **Solution:** Verify that your API key is correct. If you don’t have one, create an API key first.
    * **402 - Insufficient Balance**
      * **Reason:** Insufficient account balance.
      * **Solution:** Check your account balance and top up on the recharge page.
    * **422 - Unprocessable Entity**
      * **Reason:** Invalid parameters in the request body.
      * **Solution:** Adjust the parameters based on the error message.
    * **429 - Too Many Requests**
      * **Reason:** Request rate (TPM or RPM) limit reached.
      * **Solution:** Plan your request rate appropriately.
    * **500 - Internal Server Error**
      * **Reason:** Server internal error.
      * **Solution:** Retry later. If the issue persists, contact the server provider.
    * **503 - Service Unavailable**
      * **Reason:** Server is overloaded.
      * **Solution:** Retry your request later.
* For errors like `Biography generation failed: must be......, not.......` or `Expecting value......` :
  * Upgrading Models
    * Select a more capable model to ensure that the generation capabilities meet the demand.
  * Switch to an API model
    * Switch to a cloud-based API service that supports the OpenAI protocol to circumvent local arithmetic or compatibility limitations.
* For errors like `Biography generation failed: Request timed out` , it is usually due to  in sufficient local computing resources, resulting in model response timeout. The following optimization measure are recommended:&#x20;
  * Use cloud API services
    * Use APIs that support the OpenAI protocol to call the model, avoiding local hardware performance limitations and ensuring stable generation.

### Issue with Embedding Model?

* Usually the probability of embedding failure is very low and can be solved as follows:
  * Use a better model (e.g., OpenAI) or host a local high-performance extractor.
  * It may be that the local directory has already been initialized and chromadb needs to be re-initialized (refer to [PR #207](https://github.com/mindverse/Second-Me/pull/207)).

### `sqlite3.OperationalError: no such column: collections.topic`?

* Delete the data directory where ChromaDB stores data.
* Restart the application to reinitialize ChromaDB (either restart `make restart` or make docker restart `make docker-restart-all` depending on your platform).

### Training stuck at "Training to create Second Me -> train"?

* **Resource suggestion:** the training process takes up a lot of memory, allocating more memory can speed up the training, 16G or even higher is recommended.

## Other Questions

### **Can I use Logseq, Notion, me.bot logs for training?**

* Yes, convert to plaintext/markdown before uploading.

### **Why are some of my memory files missing after upload?**

* Current UI displays only 100 files; pagination is under development.

### **Does Mindverse recruit interns or collaborators?**

* Yes! Contact Scarlett or Kevin for opportunities.


# Deployment

## 📊 Model Deployment Memory and Supported Model Size Reference Guide

*Note: "B" in the table represents "billion parameters model". Data shown are examples only; actual supported model sizes may vary depending on system optimization, deployment environment, and other hardware/software conditions.*

| Memory (GB) | Docker Deployment (Windows/Linux) | Docker Deployment (Mac) | Integrated Setup (Windows/Linux) | Integrated Setup (Mac) |
| ----------- | --------------------------------- | ----------------------- | -------------------------------- | ---------------------- |
| 8           | \~0.8B (example)                  | \~0.4B (example)        | \~1.0B (example)                 | \~0.6B (example)       |
| 16          | 1.5B (example)                    | 0.5B (example)          | \~2.0B (example)                 | \~0.8B (example)       |
| 32          | \~2.8B (example)                  | \~1.2B (example)        | \~3.5B (example)                 | \~1.5B (example)       |

> **Note**: Models below 0.5B may not provide satisfactory performance for complex tasks. And we're continuously improving cross-platform support - please [submit an issue](https://github.com/mindverse/Second-Me/issues/new) for feedback or compatibility problems on different operating systems.

> **MLX Acceleration**: Mac M-series users can use [MLX](https://github.com/mindverse/Second-Me/tree/master/lpm_kernel/L2/mlx_training) to run larger models (CLI-only).

## 🐳 Option 1: Docker Setup

> **Note**: Docker setup on Mac M-Series chips has 25-30% performance overhead compared to integrated setup, but offers easier installation process.

### **Prerequisites**

* Docker and Docker Compose installed on your system
  * For Docker installation: [Get Docker](https://docs.docker.com/get-docker/)
  * For Docker Compose installation: [Install Docker Compose](https://docs.docker.com/compose/install/)
* For Windows Users: You can use [MinGW](https://www.mingw-w64.org/) to run `make` commands. You may need to modify the Makefile by replacing Unix-specific commands with Windows-compatible alternatives.
* Memory Usage Settings (important):
  * Configure these settings in Docker Desktop (macOS) or Docker Desktop (Windows) at: Dashboard -> Settings -> Resources
  * Make sure to allocate sufficient memory resources (at least 8GB recommended)

### **Setup Steps**

1. Clone the repository

```bash
git clone git@github.com:Mindverse/Second-Me.git
cd Second-Me
```

2. Start the containers

```bash
make docker-up
```

3. After starting the service (either with local setup or Docker), open your browser and visit:

```bash
http://localhost:3000
```

4. View help and more commands

```bash
make help
```

5. For custom Ollama model configuration, please refer to:Custom Model Config(Ollama)

## 🚀 Option 2: Integrated Setup (Non-Docker)

> **Note**: Integrated Setup provides best performance, especially for larger models, as it runs directly on your host system without containerization overhead.

### **Prerequisites**

* Python 3.12+ installed on your system (using uv)
* Node.js 23+ and npm installed
* Basic build tools (cmake, make, etc.)

### **Setup Steps**

1. Clone the repository

```bash
git clone git@github.com:Mindverse/Second-Me.git
cd Second-Me
```

2. Setup Python Environment Using uv

```bash
# Install uv
curl -LsSf https://astral.sh/uv/install.sh | sh

# Create virtual environment with Python 3.12
uv venv --python 3.12

# Activate the virtual environment
source .venv/bin/activate  # Unix/macOS
# or
# .venv\Scripts\activate  # Windows
```

3. Install dependencies

```bash
make setup
```

4. Start all services

```bash
make restart
```

5. After services are started, open your browser and visit:

```bash
http://localhost:3000
```

> 💡 **Advantages**: This method offers better performance than Docker on Mac & Linux systems while still providing a simple setup process. It installs directly on your host system without containerization overhead. (Windows not tested)


# Create Second Me


# Support Model Config

## Custom Model Endpoint Guide with Ollama

### 1. Prerequisites: Ollama Setup

First, download and install Ollama from the official website:

🔗 **Download Link**: <https://ollama.com/download>

📚 **Additional Resources**:

* Official Website: [https://ollama.com](https://ollama.com/)
* Model Library: <https://ollama.com/library>
* GitHub Repository: [https://github.com/ollama/ollama/](https://github.com/ollama/ollama)

***

### 2. Basic Ollama Commands

| Command                  | Description                |
| ------------------------ | -------------------------- |
| `ollama pull model_name` | Download a model           |
| `ollama serve`           | Start the Ollama service   |
| `ollama ps`              | List running models        |
| `ollama list`            | List all downloaded models |
| `ollama rm model_name`   | Remove a model             |
| `ollama show model_name` | Show model details         |

### 3. Using Ollama API for Custom Model

#### OpenAI-Compatible API

**Chat Request**

```bash
curl http://127.0.0.1:11434/v1/chat/completions -H "Content-Type: application/json" -d '{
  "model": "qwen2.5:0.5b",
  "messages": [
    {"role": "user", "content": "Why is the sky blue?"}
  ]
}'
```

**Embedding Request**

```bash
curl http://127.0.0.1:11434/v1/embeddings -d '{
  "model": "snowflake-arctic-embed:110m",
  "input": "Why is the sky blue?"
}'
```

More Details: <https://github.com/ollama/ollama/blob/main/docs/openai.md>

### 4. Configuring Custom Embedding in Second Me

1. Start the Ollama service: `ollama serve`
2. Check your Ollama embedding model context length:

```bash
# Example: ollama show snowflake-arctic-embed:110m
$ ollama show snowflake-arctic-embed:110m

Model
  architecture        bert       
  parameters          108.89M    
  context length      512        
  embedding length    768        
  quantization        F16        

License
  Apache License               
  Version 2.0, January 2004
```

3. Modify `EMBEDDING_MAX_TEXT_LENGTH` in `Second_Me/.env` to match your embedding model's context window. This prevents chunk length overflow and avoids server-side errors (500 Internal Server Error).

```bash
# Embedding configurations

EMBEDDING_MAX_TEXT_LENGTH=embedding_model_context_length
```

4. Configure Custom Embedding in Settings

```
Chat:
Model Name: qwen2.5:0.5b
API Key: ollama
API Endpoint: http://127.0.0.1:11434/v1

Embedding:
Model Name: snowflake-arctic-embed:110m
API Key: ollama
API Endpoint: http://127.0.0.1:11434/v1
```

**When running Second Me in Docker environments**, please replace `127.0.0.1` in API Endpoint with `host.docker.internal`:

```
Chat:
Model Name: qwen2.5:0.5b
API Key: ollama
API Endpoint: http://host.docker.internal:11434/v1

Embedding:
Model Name: snowflake-arctic-embed:110m
API Key: ollama
API Endpoint: http://host.docker.internal:11434/v1
```


# Second Me Service


# MCP Server Config Guideline

## Installation and operation

### Installation dependencies

Please ensure that Python version 3.7 or above is installed in the system. You need to install the following dependencies:

```bash
pip install mcp
```

### Configuration File

The tool manages server and client settings through a configuration file. Below is an example structure of the `config.json` file:

```json
{
  "mcpServers": {
    "mindverse": {
      "command": "python",
      "args": ["{replace-with-your-path}/Second-Me/mcp/mcp_public.py"]
    }
  }
}
```

### Configuration Items Explanation

**Server Configuration (object)**

* `command` (string):\
  The command to execute the script (typically the Python interpreter)
* `args` (array):\
  Arguments passed to the script, including:
  * Path to the Python script (replace `{replace-with-your-path}` with your actual path)

### Input Parameter Explanation

The `get_response` function has two input parameters:

`query`: This is the user input query that the tool will use to request the model. For example, the user might ask questions like "How is the weather?" or "What can you do for me?"

`instance_id`: This is a string used to identify a specific model instance. Typically, `instance_id` might be the model's URL path or a unique identifier used to specify an instance on the model platform.

## Response

* Server-Sent Events (SSE) stream in OpenAI-compatible format
* Each event contains a fragment of the generated response
* The last event is marked as `[DONE]`

### Response Format Example

```

data: {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"lpm-registry-model","system_fingerprint":null,"choices":[{"index":0,"delta":{"content":" world!"},"finish_reason":null}]}

data: {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1694268190,"model":"lpm-registry-model","system_fingerprint":null,"choices":[{"index":0,"delta":{},"finish_reason":"stop"}]}

data: [DONE]
```

### Note

Currently, MCP services automatically process streaming data to generate coherent paragraphs. If you need RAW results, you can directly return a 'response' in the code. You can change it yourself according to the following code.

```
@mindverse.tool()
async def get_response(query:str, instance_id:str) -> HTTPResponse:
    """
    Received a response based on public mindverse model.

    Args:
        query (str): Questions raised by users regarding the mindverse model.
        instance_id (str): ID used to identify the mindverse model, or url used to identify the mindverse model.

    """
    id = instance_id.split('/')[-1]
    path = f"/api/chat/{id}"
    headers = {"Content-Type": "application/json"}
    messages.append({"role": "user", "content": query})

    data = {
        "messages": messages,
        "metadata": {
        "enable_l0_retrieval": False,
        "role_id": "default_role"
    },
    "temperature": 0.7,
    "max_tokens": 2000,
    "stream": True
    }

    conn = http.client.HTTPSConnection(url)

    # Send the POST request
    conn.request("POST", path, body=json.dumps(data), headers=headers)

    # Get the response
    response = conn.getresponse()
    return response
```


# AI-native Memory 2.0: Second Me

{% embed url="<https://arxiv.org/pdf/2503.08102>" %}


# AI-native Memory: A Pathway from LLMs Towards AGI

{% embed url="<https://arxiv.org/pdf/2406.18312>" %}


