From 8af58129b6e6881382b9bfc050843884fe26e2e2 Mon Sep 17 00:00:00 2001 From: drbh Date: Mon, 18 Mar 2024 22:32:04 +0000 Subject: [PATCH] fix: refactor to use .data from pydantic model --- clients/python/text_generation/types.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/clients/python/text_generation/types.py b/clients/python/text_generation/types.py index b88e3b42..f0d859af 100644 --- a/clients/python/text_generation/types.py +++ b/clients/python/text_generation/types.py @@ -181,14 +181,14 @@ class Parameters(BaseModel): if field_value is not None: if field_value <= 0: raise ValidationError("`best_of` must be strictly positive") - if field_value > 1 and values["seed"] is not None: + if field_value > 1 and values.data["seed"] is not None: raise ValidationError("`seed` must not be set when `best_of` is > 1") sampling = ( - values["do_sample"] - | (values["temperature"] is not None) - | (values["top_k"] is not None) - | (values["top_p"] is not None) - | (values["typical_p"] is not None) + values.data["do_sample"] + | (values.data["temperature"] is not None) + | (values.data["top_k"] is not None) + | (values.data["top_p"] is not None) + | (values.data["typical_p"] is not None) ) if field_value > 1 and not sampling: raise ValidationError("you must use sampling when `best_of` is > 1")