From 2ba87bf47cc9a5c56d49d6825a7d2193fc3614a1 Mon Sep 17 00:00:00 2001 From: Angela Date: Tue, 14 Oct 2025 14:51:46 -0700 Subject: [PATCH] update docstring for validate response --- CHANGELOG.md | 7 ++++++- pyproject.toml | 2 +- src/cleanlab_codex/__about__.py | 2 +- src/cleanlab_codex/project.py | 8 +++++++- tests/test_project.py | 4 ++-- 5 files changed, 17 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 31594f9..8b4b0d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [1.0.31] 2025-10-14 + +- Add `expert_guardrail_override_explanation` and `log_id` to `ProjectValidateResponse` docstring + ## [1.0.30] 2025-10-01 - Update API reference language from Codex -> Cleanlab AI Platform @@ -141,7 +145,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Initial release of the `cleanlab-codex` client library. -[Unreleased]: https://github.com/cleanlab/cleanlab-codex/compare/v1.0.30...HEAD +[Unreleased]: https://github.com/cleanlab/cleanlab-codex/compare/v1.0.31...HEAD +[1.0.31]: https://github.com/cleanlab/cleanlab-codex/compare/v1.0.30...v1.0.31 [1.0.30]: https://github.com/cleanlab/cleanlab-codex/compare/v1.0.29...v1.0.30 [1.0.29]: https://github.com/cleanlab/cleanlab-codex/compare/v1.0.28...v1.0.29 [1.0.28]: https://github.com/cleanlab/cleanlab-codex/compare/v1.0.27...v1.0.28 diff --git a/pyproject.toml b/pyproject.toml index 13871ad..79c63f6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,7 +26,7 @@ classifiers = [ ] dependencies = [ "cleanlab-tlm~=1.1,>=1.1.14", - "codex-sdk==0.1.0a28", + "codex-sdk==0.1.0a30", "pydantic>=2.0.0, <3", ] diff --git a/src/cleanlab_codex/__about__.py b/src/cleanlab_codex/__about__.py index 849d55a..cfd3e86 100644 --- a/src/cleanlab_codex/__about__.py +++ b/src/cleanlab_codex/__about__.py @@ -1,2 +1,2 @@ # SPDX-License-Identifier: MIT -__version__ = "1.0.30" +__version__ = "1.0.31" diff --git a/src/cleanlab_codex/project.py b/src/cleanlab_codex/project.py index 172f22d..496b587 100644 --- a/src/cleanlab_codex/project.py +++ b/src/cleanlab_codex/project.py @@ -18,7 +18,11 @@ from codex import Codex as _Codex from codex.types.project_validate_response import ProjectValidateResponse - from openai.types.chat import ChatCompletion, ChatCompletionMessageParam, ChatCompletionToolParam + from openai.types.chat import ( + ChatCompletion, + ChatCompletionMessageParam, + ChatCompletionToolParam, + ) _ERROR_CREATE_ACCESS_KEY = ( @@ -187,6 +191,8 @@ def validate( - escalated_to_sme (bool): True if the query should be escalated to SME for review. When True, the query is logged and may be answered by an expert. - eval_scores (dict[str, ThresholdedEvalScore]): Evaluation scores for different response attributes (e.g., trustworthiness, helpfulness, ...). Each includes a numeric score and a `failed` flag indicating whether the score falls below threshold. - expert_answer (str | None): If it was auto-determined that this query should be escalated to SME, and a prior SME answer for a similar query was found, then this will return that expert answer. Otherwise, it is None. + - expert_guardrail_override_explanation (str | None): If the final guardrail decision was overridden by expert review, this will contain an explanation for why the guardrail result was overridden. Otherwise, it is None. + - log_id (str): The ID of the log created for this query. When available, consider swapping your AI response with the expert answer before serving the response to your user. """ diff --git a/tests/test_project.py b/tests/test_project.py index bb61e03..4087e86 100644 --- a/tests/test_project.py +++ b/tests/test_project.py @@ -32,8 +32,8 @@ def test_project_validate_with_dict_response( openai_messages_conversational: list["ChatCompletionMessageParam"], ) -> None: expected_result = ProjectValidateResponse( - is_bad_response=True, expert_answer=None, + expert_guardrail_override_explanation=None, eval_scores={ "response_helpfulness": EvalScores( score=0.8, @@ -125,7 +125,7 @@ def test_project_validate_with_tools( openai_tools: list["ChatCompletionToolParam"], ) -> None: expected_result = ProjectValidateResponse( - is_bad_response=True, + expert_guardrail_override_explanation=None, expert_answer=None, eval_scores={ "response_helpfulness": EvalScores(