跳轉到

刪除向量儲存中的文件

DELETE /vector-stores/{vector-store-id}/documents/{document-id}/

Delete a specific document from a vector store.

Parameter In Type Required Description
vector-store-id path string yes The ID of the vector store.
document-id path integer yes The ID of the document.
x-api-key header string yes The API key for authentication.

Responses

  • 204 — Document deleted successfully.

範例請求

curl -X DELETE   
  https://api.rememberizer.ai/api/v1/vector-stores/vs_abc123/documents/1234/   
  -H "x-api-key: YOUR_API_KEY"

Info

YOUR_API_KEY 替換為您的實際向量存儲 API 金鑰,vs_abc123 替換為您的向量存儲 ID,1234 替換為文件 ID。

const deleteDocument = async (vectorStoreId, documentId) => {
  const response = await fetch(`https://api.rememberizer.ai/api/v1/vector-stores/${vectorStoreId}/documents/${documentId}/`, {
    method: 'DELETE',
    headers: {
      'x-api-key': 'YOUR_API_KEY'
    }
  });

  if (response.status === 204) {
    console.log("文件成功刪除");
  } else {
    console.error("刪除文件失敗");
  }
};

deleteDocument('vs_abc123', 1234);

Info

YOUR_API_KEY 替換為您的實際向量存儲 API 金鑰,vs_abc123 替換為您的向量存儲 ID,1234 替換為文件 ID。

import requests

def delete_document(vector_store_id, document_id):
    headers = {
        "x-api-key": "YOUR_API_KEY"
    }

    response = requests.delete(
        f"https://api.rememberizer.ai/api/v1/vector-stores/{vector_store_id}/documents/{document_id}/",
        headers=headers
    )

    if response.status_code == 204:
        print("文件成功刪除")
    else:
        print(f"刪除文件失敗: {response.text}")

delete_document('vs_abc123', 1234)

Info

YOUR_API_KEY 替換為您的實際向量存儲 API 金鑰,vs_abc123 替換為您的向量存儲 ID,1234 替換為文件 ID。

路徑參數

參數 類型 描述
vector-store-id 字串 必填。 包含文件的向量存儲的 ID。
document-id 整數 必填。 要刪除的文件的 ID。

回應

成功的請求會返回 204 無內容狀態碼,並且沒有回應主體。

認證

此端點需要使用 x-api-key 標頭中的 API 金鑰進行認證。

錯誤回應

狀態碼 描述
401 未授權 - 無效或缺失的 API 金鑰
404 未找到 - 向量儲存或文件未找到
500 內部伺服器錯誤

此端點允許您從向量儲存中移除文件。一旦刪除,該文件及其向量嵌入將不再可用於搜索操作。這對於移除過時、不相關或敏感的內容非常有用。

Warning

警告:文件刪除是永久性的,無法撤銷。在刪除重要文件之前,請確保您有備份。