77from codex .types .projects .access_key_retrieve_project_id_response import (
88 AccessKeyRetrieveProjectIDResponse ,
99)
10- from codex .types .projects .entry_query_response import Entry as SDKEntry
11- from codex .types .projects .entry_query_response import EntryQueryResponse
10+ from codex .types .projects .entry_query_response import (
11+ Entry as SDKEntry ,
12+ )
13+ from codex .types .projects .entry_query_response import (
14+ EntryManagedMetadata ,
15+ EntryManagedMetadataTrustworthiness ,
16+ EntryQueryResponse ,
17+ )
1218
1319from cleanlab_codex .project import MissingProjectError , Project
1420from cleanlab_codex .types .entry import EntryCreate
@@ -143,7 +149,12 @@ def test_init_nonexistent_project_id(mock_client_from_access_key: MagicMock) ->
143149def test_query_question_found_fallback_answer (
144150 mock_client_from_access_key : MagicMock ,
145151) -> None :
146- unanswered_entry = SDKEntry (id = str (uuid .uuid4 ()), question = "What is the capital of France?" , answer = None )
152+ unanswered_entry = SDKEntry (
153+ id = str (uuid .uuid4 ()),
154+ question = "What is the capital of France?" ,
155+ answer = None ,
156+ managed_metadata = EntryManagedMetadata (trustworthiness = EntryManagedMetadataTrustworthiness (scores = [0.95 ])),
157+ )
147158
148159 mock_client_from_access_key .projects .entries .query .return_value = EntryQueryResponse (
149160 entry = unanswered_entry , answer = None
@@ -158,7 +169,12 @@ def test_query_question_found_fallback_answer(
158169def test_query_question_not_found_fallback_answer (
159170 mock_client_from_access_key : MagicMock ,
160171) -> None :
161- mock_entry = SDKEntry (id = "fake-id" , question = "What is the capital of France?" , answer = None )
172+ mock_entry = SDKEntry (
173+ id = "fake-id" ,
174+ question = "What is the capital of France?" ,
175+ answer = None ,
176+ managed_metadata = EntryManagedMetadata (trustworthiness = EntryManagedMetadataTrustworthiness (scores = [0.95 ])),
177+ )
162178 mock_client_from_access_key .projects .entries .query .return_value = EntryQueryResponse (entry = mock_entry , answer = None )
163179
164180 project = Project (mock_client_from_access_key , FAKE_PROJECT_ID )
@@ -173,6 +189,7 @@ def test_query_answer_found(mock_client_from_access_key: MagicMock) -> None:
173189 id = str (uuid .uuid4 ()),
174190 question = "What is the capital of France?" ,
175191 answer = "Paris" ,
192+ managed_metadata = EntryManagedMetadata (trustworthiness = EntryManagedMetadataTrustworthiness (scores = [0.95 ])),
176193 )
177194 mock_client_from_access_key .projects .entries .query .return_value = EntryQueryResponse (
178195 answer = "Paris" , entry = answered_entry
@@ -190,6 +207,7 @@ def test_query_answer_found_with_metadata(mock_client_from_access_key: MagicMock
190207 question = "What is the capital of France?" ,
191208 answer = "Paris" ,
192209 client_query_metadata = [{"trustworthiness_score" : 0.95 }],
210+ managed_metadata = EntryManagedMetadata (trustworthiness = EntryManagedMetadataTrustworthiness (scores = [0.95 ])),
193211 )
194212 mock_client_from_access_key .projects .entries .query .return_value = EntryQueryResponse (
195213 answer = "Paris" , entry = answered_entry
0 commit comments