Skip to content

Commit 795769f

Browse files
committed
simplified COT and rebased main
1 parent a027a73 commit 795769f

File tree

1 file changed

+9
-11
lines changed
  • sdks/python/src/opik/evaluation/metrics/llm_judges/g_eval

1 file changed

+9
-11
lines changed

sdks/python/src/opik/evaluation/metrics/llm_judges/g_eval/metric.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from typing import Any, Optional, Union
22
import pydantic
3-
import asyncstdlib as a
43

54
from opik.evaluation.metrics import base_metric, score_result
65
from opik.evaluation.models import base_model, models_factory
@@ -52,11 +51,14 @@ def __init__(
5251
self._chain_of_thought_response = ""
5352

5453
def llm_chain_of_thought(self) -> str:
55-
prompt = template.G_EVAL_COT_TEMPLATE.format(
56-
task_introduction=self.task_introduction,
57-
evaluation_criteria=self.evaluation_criteria,
58-
)
59-
return self._model.generate_string(input=prompt)
54+
if not self._chain_of_thought_response:
55+
prompt = template.G_EVAL_COT_TEMPLATE.format(
56+
task_introduction=self.task_introduction,
57+
evaluation_criteria=self.evaluation_criteria,
58+
)
59+
self._chain_of_thought_response=self._model.generate_string(input=prompt)
60+
61+
return self._chain_of_thought_response
6062

6163

6264
async def allm_chain_of_thought(self) -> str:
@@ -144,10 +146,6 @@ async def ascore(
144146
llm_query = template.G_EVAL_QUERY_TEMPLATE.format(
145147
task_introduction=self.task_introduction,
146148
evaluation_criteria=self.evaluation_criteria,
147-
<<<<<<< HEAD
148-
149-
=======
150-
>>>>>>> 857e26be (COT simplified)
151149
chain_of_thought=await self.allm_chain_of_thought(),
152150
input=output,
153151
)
@@ -170,4 +168,4 @@ async def ascore(
170168
content=model_output,
171169
name=self.name,
172170
log_probs_supported=self._log_probs_supported,
173-
)
171+
)

0 commit comments

Comments
 (0)