import { SDK } from "@meetkai/mka1";
const sdk = new SDK({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await sdk.llm.vectorStores.createFileBatch({
vectorStoreId: "vs_abc123",
createVectorStoreFileBatchRequest: {
fileIds: [
"file-abc123",
"file-def456",
"file-ghi789",
],
attributes: {
"batch_id": "import-2024-01",
},
},
});
console.log(result);
}
run();{
"id": "vsfb_abc123",
"object": "vector_store.file_batch",
"created_at": 1704067200,
"vector_store_id": "vs_abc123",
"status": "in_progress",
"file_counts": {
"in_progress": 3,
"completed": 0,
"failed": 0,
"cancelled": 0,
"total": 3
}
}Adds multiple files to a vector store in a single batch operation.
import { SDK } from "@meetkai/mka1";
const sdk = new SDK({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
async function run() {
const result = await sdk.llm.vectorStores.createFileBatch({
vectorStoreId: "vs_abc123",
createVectorStoreFileBatchRequest: {
fileIds: [
"file-abc123",
"file-def456",
"file-ghi789",
],
attributes: {
"batch_id": "import-2024-01",
},
},
});
console.log(result);
}
run();{
"id": "vsfb_abc123",
"object": "vector_store.file_batch",
"created_at": 1704067200,
"vector_store_id": "vs_abc123",
"status": "in_progress",
"file_counts": {
"in_progress": 3,
"completed": 0,
"failed": 0,
"cancelled": 0,
"total": 3
}
}Authenticate with your MKA1 API key at the API gateway: Authorization: Bearer <mka1-api-key>. For multi-user server-side integrations, also send X-On-Behalf-Of to identify the end user making the request.
Optional external user identifier for multi-user server-side integrations. Use this when acting on behalf of one of your end users.
The ID of the vector store for which to create a File Batch.
Request body for creating a vector store file batch.
A list of File IDs that the vector store should use. If attributes or chunking_strategy are provided at the root level, they will be applied to all files in the batch. Mutually exclusive with 'files'.
A list of objects that each include a file_id plus optional attributes or chunking_strategy. Use this when you need to override metadata for specific files. The global attributes or chunking_strategy will be ignored. Mutually exclusive with 'file_ids'.
Show child attributes
Global attributes to apply to all files if using 'file_ids'. Ignored if using 'files'.
Show child attributes
Global chunking strategy to apply to all files if using 'file_ids'. Ignored if using 'files'.
Show child attributes
OK
A batch of files attached to a vector store.
The identifier, which can be referenced in API endpoints.
The object type, which is always 'vector_store.file_batch'.
The Unix timestamp (in seconds) for when the vector store files batch was created.
-9007199254740991 <= x <= 9007199254740991The ID of the vector store that the File is attached to.
The status of the vector store files batch. 'in_progress' means files are being processed, 'completed' means all files have been processed, 'cancelled' means the batch was cancelled, 'failed' means the batch failed.
in_progress, completed, cancelled, failed File processing status counts.
Show child attributes
Was this page helpful?