Files
LangBot/pkg/entity/persistence/vector.py

14 lines
451 B
Python
Raw Normal View History

2025-07-05 21:56:54 +08:00
from sqlalchemy import Column, Integer, ForeignKey, LargeBinary
from sqlalchemy.orm import declarative_base, relationship
2025-07-03 23:28:47 +08:00
Base = declarative_base()
2025-07-05 21:56:54 +08:00
2025-07-03 23:28:47 +08:00
class Vector(Base):
__tablename__ = 'vectors'
id = Column(Integer, primary_key=True, index=True)
chunk_id = Column(Integer, ForeignKey('chunks.id'), unique=True)
2025-07-05 21:56:54 +08:00
embedding = Column(LargeBinary) # Store embeddings as binary
2025-07-03 23:28:47 +08:00
2025-07-05 21:56:54 +08:00
chunk = relationship('Chunk', back_populates='vector')