Skip to content

Commit f1e851f

Browse files
committed
add response as always availible
1 parent 6bb320a commit f1e851f

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/cleanlab_codex/experimental/openai_agents/cleanlab_hook.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ def _get_context_as_string(self, messages: list[ChatCompletionMessageParam]) ->
148148

149149
async def _cleanlab_validate(
150150
self, response: ModelResponse, context: RunContextWrapper[TContext], agent: Any
151-
) -> ProjectValidateResponse | None:
151+
) -> ProjectValidateResponse:
152152
"""Validate the model response using Cleanlab with actual conversation history."""
153153
# Step 1 - Convert hook items to Cleanlab format
154154
tools_dict = (
@@ -214,7 +214,7 @@ def cleanlab_get_validate_fields(self, messages: list[ChatCompletionMessageParam
214214
}
215215

216216
async def cleanlab_get_final_response(
217-
self, response: ModelResponse, validation_result: ProjectValidateResponse | None
217+
self, response: ModelResponse, validation_result: ProjectValidateResponse
218218
) -> None:
219219
"""
220220
Determine the final response content based on cleanlab validation results.
@@ -230,9 +230,6 @@ async def cleanlab_get_final_response(
230230
Returns:
231231
Tuple of (final_content, was_replaced_flag)
232232
"""
233-
if validation_result is None:
234-
return
235-
236233
replacement_text = None
237234
if validation_result.expert_answer:
238235
replacement_text = validation_result.expert_answer

0 commit comments

Comments
 (0)