Skip to content

Commit 6419f65

Browse files
committed
try to fix pydantic error
1 parent 25e9350 commit 6419f65

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

autointent/modules/scoring/_knn/rerank_scorer.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import numpy as np
66
import numpy.typing as npt
7+
from pydantic import PositiveInt
78

89
from autointent import Context, Ranker
910
from autointent.configs import CrossEncoderConfig, EmbedderConfig
@@ -35,10 +36,10 @@ class RerankScorer(KNNScorer):
3536

3637
def __init__(
3738
self,
38-
k: int = 5,
39+
k: PositiveInt = 5,
3940
weights: WeightType = "distance",
4041
use_crosencoder_scores: bool = False,
41-
m: int | None = None,
42+
m: PositiveInt | None = None,
4243
cross_encoder_config: CrossEncoderConfig | str | dict[str, Any] | None = None,
4344
embedder_config: EmbedderConfig | str | dict[str, Any] | None = None,
4445
) -> None:
@@ -61,9 +62,9 @@ def __init__(
6162
def from_context(
6263
cls,
6364
context: Context,
64-
k: int = 5,
65+
k: PositiveInt = 5,
6566
weights: WeightType = "distance",
66-
m: int | None = None,
67+
m: PositiveInt | None = None,
6768
cross_encoder_config: CrossEncoderConfig | str | None = None,
6869
embedder_config: EmbedderConfig | str | None = None,
6970
use_crosencoder_scores: bool = False,

0 commit comments

Comments
 (0)