-
Notifications
You must be signed in to change notification settings - Fork 180
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/main' into refactor-logging
- Loading branch information
Showing
19 changed files
with
1,919 additions
and
116 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,22 @@ | ||
from typing import Any, List | ||
from typing import Any, Coroutine, List, Optional | ||
|
||
from pydantic.v1 import BaseModel, Field | ||
from pydantic.v1 import BaseModel, Field, validator | ||
|
||
|
||
class BaseEncoder(BaseModel): | ||
name: str | ||
score_threshold: float | ||
score_threshold: Optional[float] = None | ||
type: str = Field(default="base") | ||
|
||
class Config: | ||
arbitrary_types_allowed = True | ||
|
||
@validator("score_threshold", pre=True, always=True) | ||
def set_score_threshold(cls, v): | ||
return float(v) if v is not None else None | ||
|
||
def __call__(self, docs: List[Any]) -> List[List[float]]: | ||
raise NotImplementedError("Subclasses must implement this method") | ||
|
||
def acall(self, docs: List[Any]) -> Coroutine[Any, Any, List[List[float]]]: | ||
raise NotImplementedError("Subclasses must implement this method") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.