Spaces:
Sleeping
Sleeping
File size: 633 Bytes
51a7f02 92ef095 51a7f02 92ef095 51a7f02 92ef095 cc3240a 51a7f02 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
#This is to init the vector store
from typing import Annotated
from qdrant_client.models import VectorParams, Distance
from fastapi import APIRouter, Body
from db import vector_store
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 vector_store.client.recreate_collection(collection_name=name,
vectors_config=VectorParams(size=1536, distance=Distance.COSINE))
|