Spaces:
Sleeping
Sleeping
File size: 472 Bytes
51a7f02 92ef095 f2932e2 51a7f02 92ef095 cc3240a 51a7f02 f2932e2 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
#This is to init the vector store
from typing import Annotated
from fastapi import APIRouter, Body
from db.vector_store import ToyVectorStore
router = APIRouter()
@router.put("/admin/v1/db")
async def recreate_collection(name: Annotated[str, Body(embed=True)]):
""" `name` of the collection to be created.
If one exits, delete and recreate.
"""
print(f"creating collection {name} in db")
return ToyVectorStore.get_instance().create_collection(name) |