From 37a9e5f924ab92a3b2811fd2b63a3159e6d426d3 Mon Sep 17 00:00:00 2001 From: Dhruv Chawla <43818888+Dominastorm@users.noreply.github.com> Date: Thu, 4 Apr 2024 16:14:39 +0530 Subject: [PATCH] Fix Guideline Adherence (#677) * Fix Guideline Adherence * Fix col_out --- uptrain/operators/language/guideline.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/uptrain/operators/language/guideline.py b/uptrain/operators/language/guideline.py index 6b5a351e..dda9b4bb 100644 --- a/uptrain/operators/language/guideline.py +++ b/uptrain/operators/language/guideline.py @@ -68,6 +68,7 @@ def setup(self, settings: t.Optional[Settings] = None): assert settings is not None self.settings = settings + self.col_out = f"score_{self.guideline_name}_adherence" if self.settings.evaluate_locally and ( self.settings.uptrain_access_token is None or not len(self.settings.uptrain_access_token) @@ -178,15 +179,15 @@ def evaluate_local(self, data): for res in output_payloads: idx = res.metadata["index"] output = { - "score_guideline_adherence": None, - "explanation_guideline_adherence": None, + f"score_{self.guideline_name}_adherence": None, + f"explanation_{self.guideline_name}_adherence": None, } try: score = self.score_mapping[ json.loads(res.response.choices[0].message.content)["Choice"] ] - output["score_guideline_adherence"] = float(score) - output["explanation_guideline_adherence"] = res.response.choices[ + output[f"score_{self.guideline_name}_adherence"] = float(score) + output[f"explanation_{self.guideline_name}_adherence"] = res.response.choices[ 0 ].message.content except Exception: