将文件上传到向量存储
将文件内容批量上传到向量存储
post
Upload files to a vector store.
Path parameters
vector-store-idstringRequired
The ID of the vector store.
Header parameters
x-api-keystringRequired
The API key for authentication.
Body
filesstring · binary[]Optional
The files to upload.
Responses
201
Files uploaded successfully.
application/json
207
Some files failed to upload.
post
/vector-stores/{vector-store-id}/documents/upload示例请求
curl -X POST \
https://api.rememberizer.ai/api/v1/vector-stores/vs_abc123/documents/upload \
-H "x-api-key: YOUR_API_KEY" \
-F "files=@/path/to/document1.pdf" \
-F "files=@/path/to/document2.docx"const uploadFiles = async (vectorStoreId, files) => {
const formData = new FormData();
// 将多个文件添加到表单数据中
for (const file of files) {
formData.append('files', file);
}
const response = await fetch(`https://api.rememberizer.ai/api/v1/vector-stores/${vectorStoreId}/documents/upload`, {
method: 'POST',
headers: {
'x-api-key': 'YOUR_API_KEY'
// 注意:不要设置 Content-Type 头,它会自动设置为正确的边界
},
body: formData
});
const data = await response.json();
console.log(data);
};
// 使用文件输入元素的示例
const fileInput = document.getElementById('fileInput');
uploadFiles('vs_abc123', fileInput.files);批量上传最佳实践
Last updated