add model validator that removes embedding field passed

This commit is contained in:
stuart committed 2026-02-25 15:56:17 +01:00
1 parent 15afc9d481
commit 15a06521b3
1 file changed
+7
+7
View File
@@ -1,4 +1,5 @@
from typing import List, Any
from pydantic import model_validator
from pydantic_core import core_schema
import torch
@@ -19,6 +20,12 @@ class NoEmbeddingPhrase(Lexeme):
content=data["content"],
original_content=data["original_content"],
)
@model_validator(mode="before")
@classmethod
def ignore_embedding(cls, values):
# Remove embedding from incoming data
values.pop("embedding", None)
return values
class Phrase(Lexeme):