From 4290c6ddc1e03ab3ff77e7a3a8b07b3f5bb7adab Mon Sep 17 00:00:00 2001 From: Gregory Horvath Date: Wed, 25 Sep 2024 16:17:45 -0400 Subject: [PATCH] move Vector type from crud_vector_content to Typedef --- src/leapfrogai_api/data/crud_vector_content.py | 11 +---------- src/leapfrogai_api/typedef/vectorstores/__init__.py | 1 + .../typedef/vectorstores/search_types.py | 9 +++++++++ 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/leapfrogai_api/data/crud_vector_content.py b/src/leapfrogai_api/data/crud_vector_content.py index 3d1fd1423..d53118986 100644 --- a/src/leapfrogai_api/data/crud_vector_content.py +++ b/src/leapfrogai_api/data/crud_vector_content.py @@ -1,20 +1,11 @@ """CRUD Operations for VectorStore.""" -from pydantic import BaseModel from supabase import AClient as AsyncClient from leapfrogai_api.data.crud_base import get_user_id import ast from leapfrogai_api.typedef.vectorstores import SearchItem, SearchResponse from leapfrogai_api.backend.constants import TOP_K - - -class Vector(BaseModel): - id: str = "" - vector_store_id: str - file_id: str - content: str - metadata: dict - embedding: list[float] +from leapfrogai_api.typedef.vectorstores import Vector class CRUDVectorContent: diff --git a/src/leapfrogai_api/typedef/vectorstores/__init__.py b/src/leapfrogai_api/typedef/vectorstores/__init__.py index 1491a9767..dde3c2860 100644 --- a/src/leapfrogai_api/typedef/vectorstores/__init__.py +++ b/src/leapfrogai_api/typedef/vectorstores/__init__.py @@ -7,6 +7,7 @@ ListVectorStoresResponse as ListVectorStoresResponse, ) from .search_types import ( + Vector as Vector, SearchItem as SearchItem, SearchResponse as SearchResponse, ) diff --git a/src/leapfrogai_api/typedef/vectorstores/search_types.py b/src/leapfrogai_api/typedef/vectorstores/search_types.py index 76abb0822..d8d2a2d13 100644 --- a/src/leapfrogai_api/typedef/vectorstores/search_types.py +++ b/src/leapfrogai_api/typedef/vectorstores/search_types.py @@ -1,6 +1,15 @@ from pydantic import BaseModel, Field +class Vector(BaseModel): + id: str = "" + vector_store_id: str + file_id: str + content: str + metadata: dict + embedding: list[float] + + class SearchItem(BaseModel): """Object representing a single item in a search result."""