# Cập nhật nội dung tệp trong Cửa hàng Vector

{% openapi src="/files/uCR2Hrq9CjDxpCLaqzhl" path="/vector-stores/{vector-store-id}/documents/{document-id}/" method="patch" %}
[rememberizer\_openapi.yml](https://4187618229-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fwbxu0T4faQnPtKbPzrD5%2Fuploads%2Fgit-blob-77b6137eeb641262ec8e531c78123c02b825b865%2Frememberizer_openapi.yml?alt=media\&token=b77a395b-ed7b-4546-9ec7-182d4939fd1b)
{% endopenapi %}

## Ví dụ Yêu cầu

{% tabs %}
{% tab title="cURL" %}

```bash
curl -X PATCH \
  https://api.rememberizer.ai/api/v1/vector-stores/vs_abc123/documents/1234/ \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Cập nhật Tổng quan Sản phẩm"
  }'
```

{% hint style="info" %}
Thay thế `YOUR_API_KEY` bằng khóa API Vector Store thực tế của bạn, `vs_abc123` bằng ID Vector Store của bạn, và `1234` bằng ID tài liệu.
{% endhint %}
{% endtab %}

{% tab title="JavaScript" %}

```javascript
const updateDocument = async (vectorStoreId, documentId, newName) => {
  const response = await fetch(`https://api.rememberizer.ai/api/v1/vector-stores/${vectorStoreId}/documents/${documentId}/`, {
    method: 'PATCH',
    headers: {
      'x-api-key': 'YOUR_API_KEY',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      name: newName
    })
  });
  
  const data = await response.json();
  console.log(data);
};

updateDocument('vs_abc123', 1234, 'Cập nhật Tổng quan Sản phẩm');
```

{% hint style="info" %}
Thay thế `YOUR_API_KEY` bằng khóa API Vector Store thực tế của bạn, `vs_abc123` bằng ID Vector Store của bạn, và `1234` bằng ID tài liệu.
{% endhint %}
{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

def update_document(vector_store_id, document_id, new_name):
    headers = {
        "x-api-key": "YOUR_API_KEY",
        "Content-Type": "application/json"
    }
    
    payload = {
        "name": new_name
    }
    
    response = requests.patch(
        f"https://api.rememberizer.ai/api/v1/vector-stores/{vector_store_id}/documents/{document_id}/",
        headers=headers,
        data=json.dumps(payload)
    )
    
    data = response.json()
    print(data)

update_document('vs_abc123', 1234, 'Cập nhật Tổng quan Sản phẩm')
```

{% hint style="info" %}
Thay thế `YOUR_API_KEY` bằng khóa API Vector Store thực tế của bạn, `vs_abc123` bằng ID Vector Store của bạn, và `1234` bằng ID tài liệu.
{% endhint %}
{% endtab %}
{% endtabs %}

## Tham số Đường dẫn

| Tham số         | Loại      | Mô tả                                          |
| --------------- | --------- | ---------------------------------------------- |
| vector-store-id | chuỗi     | **Bắt buộc.** ID của kho vector chứa tài liệu. |
| document-id     | số nguyên | **Bắt buộc.** ID của tài liệu cần cập nhật.    |

## Thân Request

```json
{
  "name": "Tổng quan sản phẩm đã cập nhật"
}
```

| Tham số | Loại  | Mô tả                 |
| ------- | ----- | --------------------- |
| name    | chuỗi | Tên mới cho tài liệu. |

## Định dạng Phản hồi

```json
{
  "id": 1234,
  "name": "Tổng quan Sản phẩm Cập nhật",
  "type": "text/plain",
  "vector_store": "vs_abc123",
  "size": 173,
  "status": "đã lập chỉ mục",
  "processing_status": "hoàn thành",
  "indexed_on": "2023-06-15T10:30:00Z",
  "status_error_message": null,
  "created": "2023-06-15T10:15:00Z",
  "modified": "2023-06-15T11:45:00Z"
}
```

## Xác thực

Điểm cuối này yêu cầu xác thực bằng cách sử dụng khóa API trong tiêu đề `x-api-key`.

## Phản hồi Lỗi

| Mã Trạng Thái | Mô Tả                                                      |
| ------------- | ---------------------------------------------------------- |
| 400           | Yêu Cầu Không Hợp Lệ - Định dạng yêu cầu không hợp lệ      |
| 401           | Không Được Phép - Khóa API không hợp lệ hoặc bị thiếu      |
| 404           | Không Tìm Thấy - Vector Store hoặc tài liệu không tìm thấy |
| 500           | Lỗi Máy Chủ Nội Bộ                                         |

Điểm cuối này cho phép bạn cập nhật siêu dữ liệu của một tài liệu trong vector store của bạn. Hiện tại, bạn chỉ có thể cập nhật tên của tài liệu. Điều này hữu ích để cải thiện tổ chức và khả năng tìm kiếm tài liệu mà không cần phải tải lại tài liệu.

{% hint style="info" %}
Lưu ý: Điểm cuối này chỉ cập nhật siêu dữ liệu của tài liệu, không phải nội dung của nó. Để cập nhật nội dung, bạn cần xóa tài liệu hiện có và tải lên một tài liệu mới.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.rememberizer.ai/vi/tai-nguyen-cho-nha-phat-trien/api-docs/vector-store/update-files-content-in-a-vector-store.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
