Skip to content

Commit fbd211a

Browse files
authored
update to use new expert answer endpoint for adding expert answers (#118)
* update to use new expert answer endpoint * update changelog * bump version
1 parent 88db708 commit fbd211a

File tree

4 files changed

+30
-6
lines changed

4 files changed

+30
-6
lines changed

CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [1.0.34] 2025-11-18
11+
12+
- Add `Project.add_expert_answer()` method to add an expert answer to a project
13+
- Deprecate `Project.add_remediation()` method
14+
- Upgrade codex-python version to v0.1.0a33
15+
1016
## [1.0.33] 2025-11-05
1117

1218
- Upgrade codex-python version to v0.1.0a32
@@ -154,7 +160,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
154160

155161
- Initial release of the `cleanlab-codex` client library.
156162

157-
[Unreleased]: https://github.com/cleanlab/cleanlab-codex/compare/v1.0.33...HEAD
163+
[Unreleased]: https://github.com/cleanlab/cleanlab-codex/compare/v1.0.34...HEAD
164+
[1.0.34]: https://github.com/cleanlab/cleanlab-codex/compare/v1.0.33...v1.0.34
158165
[1.0.33]: https://github.com/cleanlab/cleanlab-codex/compare/v1.0.32...v1.0.33
159166
[1.0.32]: https://github.com/cleanlab/cleanlab-codex/compare/v1.0.31...v1.0.32
160167
[1.0.31]: https://github.com/cleanlab/cleanlab-codex/compare/v1.0.30...v1.0.31

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ classifiers = [
2626
]
2727
dependencies = [
2828
"cleanlab-tlm~=1.1,>=1.1.14",
29-
"codex-sdk==0.1.0a32",
29+
"codex-sdk==0.1.0a33",
3030
"pydantic>=2.0.0, <3",
3131
]
3232

src/cleanlab_codex/__about__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# SPDX-License-Identifier: MIT
2-
__version__ = "1.0.33"
2+
__version__ = "1.0.34"

src/cleanlab_codex/project.py

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,17 +238,34 @@ def validate(
238238
eval_scores=eval_scores,
239239
)
240240

241+
def add_expert_answer(self, question: str, answer: str) -> None:
242+
"""Add an expert answer to the project. An expert answer represents a query and answer pair that is expert verified
243+
and should be used to answer future queries to the AI system that are similar to the query.
244+
245+
Args:
246+
query (str): The query to add to the project.
247+
answer (str): The expert answer for the query.
248+
"""
249+
self._sdk_client.projects.remediations.expert_answers.create(
250+
project_id=self.id,
251+
query=question,
252+
answer=answer,
253+
extra_headers=_AnalyticsMetadata().to_headers(),
254+
)
255+
241256
def add_remediation(self, question: str, answer: str | None = None) -> None:
242-
"""Add a remediation to the project. A remediation represents a question and answer pair that is expert verified
257+
"""DEPRECATED: Use `add_expert_answer` instead.
258+
259+
Add a remediation to the project. A remediation represents a question and answer pair that is expert verified
243260
and should be used to answer future queries to the AI system that are similar to the question.
244261
245262
Args:
246263
question (str): The question to add to the project.
247264
answer (str, optional): The expert answer for the question. If not provided, the question will be added to the project without an expert answer.
248265
"""
249-
self._sdk_client.projects.remediations.create(
266+
self._sdk_client.projects.remediations.expert_answers.create(
250267
project_id=self.id,
251-
question=question,
268+
query=question,
252269
answer=answer,
253270
extra_headers=_AnalyticsMetadata().to_headers(),
254271
)

0 commit comments

Comments
 (0)