Skip to content

Commit 24e9bc1

Browse files
committed
await
1 parent de591a3 commit 24e9bc1

File tree

1 file changed

+2
-17
lines changed

1 file changed

+2
-17
lines changed

src/cleanlab_codex/validator.py

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -118,24 +118,9 @@ def __init__(
118118
error_msg = f"Found thresholds for non-existent evaluation metrics: {_extra_thresholds}"
119119
raise ValueError(error_msg)
120120

121-
def validate(
122-
self,
123-
query: str,
124-
context: str,
125-
response: str,
126-
prompt: Optional[str] = None,
127-
form_prompt: Optional[Callable[[str, str], str]] = None,
128-
) -> dict[str, Any]:
129-
"""Synchronous wrapper around validate_async."""
130-
try:
131-
loop = asyncio.get_running_loop()
132-
except RuntimeError:
133-
loop = asyncio.new_event_loop()
134-
asyncio.set_event_loop(loop)
135-
return loop.run_until_complete(self.validate_async(query, context, response, prompt, form_prompt))
136-
121+
def validate(self, query: str, context: str, response: str, prompt=None, form_prompt=None):
137122
return asyncio.run(self.validate_async(query, context, response, prompt, form_prompt))
138-
123+
139124
async def validate_async(
140125
self,
141126
query: str,

0 commit comments

Comments
 (0)