docs
0
# Vector Stores
1
2
Vector database operations for retrieval-augmented generation (RAG) applications with file management and batch processing.
3
4
## Capabilities
5
6
### Vector Store Management
7
8
```python { .api }
9
class VectorStores:
10
def create(self, **kwargs): ...
11
def list(self, **kwargs): ...
12
def retrieve(self, **kwargs): ...
13
def update(self, **kwargs): ...
14
def delete(self, **kwargs): ...
15
files: VectorFiles
16
file_batches: VectorFileBatches
17
18
class VectorFiles:
19
def create(self, **kwargs): ...
20
def list(self, **kwargs): ...
21
def retrieve(self, **kwargs): ...
22
def delete(self, **kwargs): ...
23
24
class VectorFileBatches:
25
def create(self, **kwargs): ...
26
def list(self, **kwargs): ...
27
def retrieve(self, **kwargs): ...
28
def cancel(self, **kwargs): ...
29
```
30
31
## Usage Examples
32
33
```python
34
from portkey_ai import Portkey
35
36
portkey = Portkey(
37
api_key="PORTKEY_API_KEY",
38
virtual_key="VIRTUAL_KEY"
39
)
40
41
# Create vector store
42
vector_store = portkey.beta.vector_stores.create(
43
name="Knowledge Base"
44
)
45
46
# Add files to vector store
47
portkey.beta.vector_stores.files.create(
48
vector_store_id=vector_store.id,
49
file_id="file-123"
50
)
51
52
# Create file batch
53
batch = portkey.beta.vector_stores.file_batches.create(
54
vector_store_id=vector_store.id,
55
file_ids=["file-123", "file-456"]
56
)
57
```