add model validator that removes embedding field passed
This commit is contained in:
1 parent
15afc9d481
commit
15a06521b3
1 file changed
+7
@@ -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):
|
||||
|
||||
|
||||
Reference in new issue
Block a user