1
1
import pytest
2
+ from pydantic import BaseModel , Field
2
3
from unittest .mock import MagicMock , AsyncMock
3
- from typing import List , Dict
4
+ from typing import List , Dict , Any
4
5
5
6
from judgeval .data import Example
6
7
from judgeval .scorers .prompt_scorer import PromptScorer , ClassifierScorer
@@ -27,6 +28,9 @@ def mock_model():
27
28
28
29
# Simple implementation of PromptScorer for testing
29
30
class SampleScorer (PromptScorer ):
31
+
32
+ model : Any = Field (default = None )
33
+
30
34
def __init__ (self , mock_model , * args , ** kwargs ):
31
35
super ().__init__ (* args , ** kwargs )
32
36
self .model = mock_model
@@ -105,6 +109,7 @@ def classifier_options(self):
105
109
def test_classifier_init (self , classifier_conversation , classifier_options ):
106
110
scorer = ClassifierScorer (
107
111
name = "test_classifier" ,
112
+ slug = "test_classifier_slug" ,
108
113
conversation = classifier_conversation ,
109
114
options = classifier_options
110
115
)
@@ -114,6 +119,7 @@ def test_classifier_init(self, classifier_conversation, classifier_options):
114
119
def test_build_measure_prompt (self , example , classifier_conversation , classifier_options ):
115
120
scorer = ClassifierScorer (
116
121
name = "test_classifier" ,
122
+ slug = "test_classifier_slug" ,
117
123
conversation = classifier_conversation ,
118
124
options = classifier_options
119
125
)
@@ -124,6 +130,7 @@ def test_build_measure_prompt(self, example, classifier_conversation, classifier
124
130
def test_process_response (self , classifier_conversation , classifier_options ):
125
131
scorer = ClassifierScorer (
126
132
name = "test_classifier" ,
133
+ slug = "test_classifier_slug" ,
127
134
conversation = classifier_conversation ,
128
135
options = classifier_options
129
136
)
@@ -136,6 +143,7 @@ def test_process_response(self, classifier_conversation, classifier_options):
136
143
def test_process_response_invalid_choice (self , classifier_conversation , classifier_options ):
137
144
scorer = ClassifierScorer (
138
145
name = "test_classifier" ,
146
+ slug = "test_classifier_slug" ,
139
147
conversation = classifier_conversation ,
140
148
options = classifier_options
141
149
)
@@ -147,6 +155,7 @@ def test_process_response_invalid_choice(self, classifier_conversation, classifi
147
155
def test_success_check (self , classifier_conversation , classifier_options ):
148
156
scorer = ClassifierScorer (
149
157
name = "test_classifier" ,
158
+ slug = "test_classifier_slug" ,
150
159
conversation = classifier_conversation ,
151
160
options = classifier_options
152
161
)
0 commit comments