From 412736f52c67d3330733c94f773f0f96b923854e Mon Sep 17 00:00:00 2001 From: Nil-Andreu Date: Sun, 8 Jan 2023 20:59:46 +0100 Subject: [PATCH] [NEW] insert_message_embedding: documentation --- backend/oasst_backend/prompt_repository.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/backend/oasst_backend/prompt_repository.py b/backend/oasst_backend/prompt_repository.py index 3feb77bc..c31c0061 100644 --- a/backend/oasst_backend/prompt_repository.py +++ b/backend/oasst_backend/prompt_repository.py @@ -230,6 +230,20 @@ class PromptRepository: ) def insert_message_embedding(self, message_id: UUID, model: str, embedding: List[float]) -> MessageEmbedding: + """Insert the embedding of a new message in the database. + + Args: + message_id (UUID): the identifier of the message we want to save its embedding + model (str): the model used for creating the embedding + embedding (List[float]): the values obtained from the message & model + + Raises: + OasstError: if misses some of the before params + + Returns: + MessageEmbedding: the instance in the database of the embedding saved for that message + """ + if None in (message_id, model, embedding): raise OasstError("Paramters missing to add embedding", OasstErrorCode.GENERIC_ERROR)