(self, image_root: str = "")
| 247 | return default_prompt |
| 248 | |
| 249 | def __init__(self, image_root: str = ""): |
| 250 | # Load API configuration |
| 251 | self.test_model = os.getenv("TEST_MODEL") |
| 252 | self.test_api_key = os.getenv("TEST_API_KEY") |
| 253 | self.test_base_url = os.getenv("TEST_BASE_URL") |
| 254 | self.image_root = image_root |
| 255 | |
| 256 | if not all([self.test_model, self.test_api_key, self.test_base_url]): |
| 257 | raise ValueError("TEST_MODEL, TEST_API_KEY, and TEST_BASE_URL must be set in .env file") |
| 258 | |
| 259 | # Initialize OpenAI client for test model |
| 260 | self.client = openai.OpenAI( |
| 261 | api_key=self.test_api_key, |
| 262 | base_url=self.test_base_url |
| 263 | ) |
| 264 | |
| 265 | # Load prompts from files |
| 266 | self.system_prompt = self._load_prompt_from_file("prompts/system_prompt.txt") |
| 267 | self.deficiency_prompt = self._load_prompt_from_file("prompts/deficiency_prompt.txt") |
| 268 | self.score_prompt = self._load_prompt_from_file("prompts/score_question_prompt.txt") |
| 269 | self.compare_prompt = self._load_prompt_from_file("prompts/compare_question_prompt.txt") |
| 270 | |
| 271 | def process_deficiency(self, item: Dict, max_retries: int = 3) -> Dict: |
| 272 | """Process a single deficiency test sample: call API, classify deficiencies, and calculate metrics.""" |
nothing calls this directly
no test coverage detected