Skip to content

Commit a777174

Browse files
Feature - add user feedback to query log (#103)
1 parent 256ce03 commit a777174

File tree

5 files changed

+25
-3
lines changed

5 files changed

+25
-3
lines changed

CHANGELOG.md

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

88
## [Unreleased]
99

10+
## [1.0.27] 2025-08-22
11+
12+
- Add user feedback support for query logs, `project.add_user_feedback()`
13+
1014
## [1.0.26] 2025-07-29
1115

1216
- Add tool call support to `project.validate()`
@@ -124,7 +128,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
124128

125129
- Initial release of the `cleanlab-codex` client library.
126130

127-
[Unreleased]: https://github.com/cleanlab/cleanlab-codex/compare/v1.0.26...HEAD
131+
[Unreleased]: https://github.com/cleanlab/cleanlab-codex/compare/v1.0.27...HEAD
132+
[1.0.27]: https://github.com/cleanlab/cleanlab-codex/compare/v1.0.26...v1.0.27
128133
[1.0.26]: https://github.com/cleanlab/cleanlab-codex/compare/v1.0.25...v1.0.26
129134
[1.0.25]: https://github.com/cleanlab/cleanlab-codex/compare/v1.0.24...v1.0.25
130135
[1.0.24]: https://github.com/cleanlab/cleanlab-codex/compare/v1.0.23...v1.0.24

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.0a24",
29+
"codex-sdk==0.1.0a25",
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.26"
2+
__version__ = "1.0.27"

src/cleanlab_codex/project.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,3 +216,17 @@ def add_remediation(self, question: str, answer: str | None = None) -> None:
216216
answer=answer,
217217
extra_headers=_AnalyticsMetadata().to_headers(),
218218
)
219+
220+
def add_user_feedback(self, log_id: str, key: str) -> None:
221+
"""Add user feedback to a query logged in the project.
222+
223+
Args:
224+
log_id (str): The ID of the query log to add feedback to.
225+
key (str): A key describing the criteria of the feedback, eg 'rating'.
226+
"""
227+
self._sdk_client.projects.query_logs.add_user_feedback(
228+
project_id=self.id,
229+
query_log_id=log_id,
230+
key=key,
231+
extra_headers=_AnalyticsMetadata().to_headers(),
232+
)

tests/test_project.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
FAKE_PROJECT_DESCRIPTION = "Test Description"
2323
DEFAULT_PROJECT_CONFIG = Config()
2424
DUMMY_ACCESS_KEY = "sk-1-EMOh6UrRo7exTEbEi8_azzACAEdtNiib2LLa1IGo6kA"
25+
FAKE_LOG_ID = str(uuid.uuid4())
2526

2627

2728
def test_project_validate_with_dict_response(
@@ -43,6 +44,7 @@ def test_project_validate_with_dict_response(
4344
},
4445
escalated_to_sme=True,
4546
should_guardrail=False,
47+
log_id=FAKE_LOG_ID,
4648
)
4749
mock_client_from_api_key.projects.validate.return_value = expected_result
4850
mock_client_from_api_key.projects.create.return_value.id = FAKE_PROJECT_ID
@@ -135,6 +137,7 @@ def test_project_validate_with_tools(
135137
},
136138
escalated_to_sme=True,
137139
should_guardrail=False,
140+
log_id=FAKE_LOG_ID,
138141
)
139142
mock_client_from_api_key.projects.validate.return_value = expected_result
140143
mock_client_from_api_key.projects.create.return_value.id = FAKE_PROJECT_ID

0 commit comments

Comments
 (0)