quivr/backend/models/databases/repository.py
Stan Girard cc39f9e3ba
feat(14k): done (#2102)
# Description

Please include a summary of the changes and the related issue. Please
also include relevant motivation and context.

## Checklist before requesting a review

Please delete options that are not relevant.

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my code
- [ ] I have commented hard-to-understand areas
- [ ] I have ideally added tests that prove my fix is effective or that
my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged

## Screenshots (if appropriate):
2024-01-27 01:50:58 -08:00

86 lines
2.0 KiB
Python

from abc import ABC, abstractmethod
from datetime import datetime
from uuid import UUID
from .entity import LLMModels
class Repository(ABC):
@abstractmethod
def create_user_daily_usage(self, user_id: UUID, user_email: str, date: datetime):
pass
@abstractmethod
def get_user_usage(self, user_id: UUID):
pass
@abstractmethod
def get_model_settings(self) -> LLMModels | None:
pass
@abstractmethod
def get_user_requests_count_for_month(self, user_id: UUID, date: datetime):
pass
@abstractmethod
def update_user_request_count(self, user_id: UUID, date: str):
pass
@abstractmethod
def increment_user_request_count(
self, user_id: UUID, date: str, current_request_count
):
pass
@abstractmethod
def set_file_vectors_ids(self, file_sha1: str):
pass
@abstractmethod
def get_brain_vectors_by_brain_id_and_file_sha1(
self, brain_id: UUID, file_sha1: str
):
pass
@abstractmethod
def create_subscription_invitation(
self, brain_id: UUID, user_email: str, rights: str
):
pass
@abstractmethod
def update_subscription_invitation(
self, brain_id: UUID, user_email: str, rights: str
):
pass
@abstractmethod
def get_subscription_invitations_by_brain_id_and_email(
self, brain_id: UUID, user_email: str
):
pass
@abstractmethod
def get_vectors_by_file_name(self, file_name: str):
pass
@abstractmethod
def similarity_search(self, query_embedding, table: str, k: int, threshold: float):
pass
@abstractmethod
def update_summary(self, document_id: UUID, summary_id: int):
pass
@abstractmethod
def get_vectors_by_batch(self, batch_id: UUID):
pass
@abstractmethod
def get_vectors_in_batch(self, batch_ids):
pass
@abstractmethod
def get_vectors_by_file_sha1(self, file_sha1):
pass