Skip to content

Commit e80bee9

Browse files
feat(api): remove entries routes
1 parent bc15e90 commit e80bee9

File tree

5 files changed

+43
-378
lines changed

5 files changed

+43
-378
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
configured_endpoints: 55
2-
openapi_spec_hash: 922886934580d0b2addcb6e26ada0e09
3-
config_hash: 14b2643a0ec60cf326dfed00939644ff
2+
openapi_spec_hash: f17890d85522687a4c68702da9ad2efb
3+
config_hash: e62d723b4a5c564dc05390753a876f31

src/codex/pagination.py

Lines changed: 0 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
"AsyncMyOffsetPageTopLevelArray",
1515
"SyncOffsetPageClusters",
1616
"AsyncOffsetPageClusters",
17-
"SyncOffsetPageEntries",
18-
"AsyncOffsetPageEntries",
1917
]
2018

2119
_BaseModelT = TypeVar("_BaseModelT", bound=BaseModel)
@@ -143,63 +141,3 @@ def next_page_info(self) -> Optional[PageInfo]:
143141
return PageInfo(params={"offset": current_count})
144142

145143
return None
146-
147-
148-
class SyncOffsetPageEntries(BaseSyncPage[_T], BasePage[_T], Generic[_T]):
149-
entries: List[_T]
150-
total_count: Optional[int] = None
151-
152-
@override
153-
def _get_page_items(self) -> List[_T]:
154-
entries = self.entries
155-
if not entries:
156-
return []
157-
return entries
158-
159-
@override
160-
def next_page_info(self) -> Optional[PageInfo]:
161-
offset = self._options.params.get("offset") or 0
162-
if not isinstance(offset, int):
163-
raise ValueError(f'Expected "offset" param to be an integer but got {offset}')
164-
165-
length = len(self._get_page_items())
166-
current_count = offset + length
167-
168-
total_count = self.total_count
169-
if total_count is None:
170-
return None
171-
172-
if current_count < total_count:
173-
return PageInfo(params={"offset": current_count})
174-
175-
return None
176-
177-
178-
class AsyncOffsetPageEntries(BaseAsyncPage[_T], BasePage[_T], Generic[_T]):
179-
entries: List[_T]
180-
total_count: Optional[int] = None
181-
182-
@override
183-
def _get_page_items(self) -> List[_T]:
184-
entries = self.entries
185-
if not entries:
186-
return []
187-
return entries
188-
189-
@override
190-
def next_page_info(self) -> Optional[PageInfo]:
191-
offset = self._options.params.get("offset") or 0
192-
if not isinstance(offset, int):
193-
raise ValueError(f'Expected "offset" param to be an integer but got {offset}')
194-
195-
length = len(self._get_page_items())
196-
current_count = offset + length
197-
198-
total_count = self.total_count
199-
if total_count is None:
200-
return None
201-
202-
if current_count < total_count:
203-
return PageInfo(params={"offset": current_count})
204-
205-
return None

src/codex/resources/projects/projects.py

Lines changed: 14 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -488,18 +488,17 @@ def validate(
488488
project_id: str,
489489
*,
490490
context: str,
491+
prompt: str,
491492
query: str,
492-
response: project_validate_params.Response,
493+
response: str,
493494
use_llm_matching: bool | NotGiven = NOT_GIVEN,
494495
constrain_outputs: Optional[List[str]] | NotGiven = NOT_GIVEN,
495496
custom_eval_thresholds: Optional[Dict[str, float]] | NotGiven = NOT_GIVEN,
496497
custom_metadata: Optional[object] | NotGiven = NOT_GIVEN,
497498
eval_scores: Optional[Dict[str, float]] | NotGiven = NOT_GIVEN,
498-
messages: Iterable[project_validate_params.Message] | NotGiven = NOT_GIVEN,
499+
messages: Optional[Iterable[project_validate_params.Message]] | NotGiven = NOT_GIVEN,
499500
options: Optional[project_validate_params.Options] | NotGiven = NOT_GIVEN,
500-
prompt: Optional[str] | NotGiven = NOT_GIVEN,
501501
quality_preset: Literal["best", "high", "medium", "low", "base"] | NotGiven = NOT_GIVEN,
502-
rewritten_question: Optional[str] | NotGiven = NOT_GIVEN,
503502
task: Optional[str] | NotGiven = NOT_GIVEN,
504503
x_client_library_version: str | NotGiven = NOT_GIVEN,
505504
x_integration_type: str | NotGiven = NOT_GIVEN,
@@ -527,8 +526,9 @@ def validate(
527526
eval_scores: Scores assessing different aspects of the RAG system. If not provided, TLM will
528527
be used to generate scores.
529528
530-
messages: Message history to provide conversation context for the query. Messages contain
531-
up to and including the latest user prompt to the LLM.
529+
messages: Optional message history to provide conversation context for the query. Used to
530+
rewrite query into a self-contained version of itself. If not provided, the
531+
query will be treated as self-contained.
532532
533533
options: Typed dict of advanced configuration options for the Trustworthy Language Model.
534534
Many of these configurations are determined by the quality preset selected
@@ -615,14 +615,8 @@ def validate(
615615
- name: Name of the evaluation criteria.
616616
- criteria: Instructions specifying the evaluation criteria.
617617
618-
prompt: The prompt to use for the TLM call. If not provided, the prompt will be
619-
generated from the messages.
620-
621618
quality_preset: The quality preset to use for the TLM or Trustworthy RAG API.
622619
623-
rewritten_question: The re-written query if it was provided by the client to Codex from a user to be
624-
used instead of the original query.
625-
626620
extra_headers: Send extra headers
627621
628622
extra_query: Add additional query parameters to the request
@@ -649,6 +643,7 @@ def validate(
649643
body=maybe_transform(
650644
{
651645
"context": context,
646+
"prompt": prompt,
652647
"query": query,
653648
"response": response,
654649
"constrain_outputs": constrain_outputs,
@@ -657,9 +652,7 @@ def validate(
657652
"eval_scores": eval_scores,
658653
"messages": messages,
659654
"options": options,
660-
"prompt": prompt,
661655
"quality_preset": quality_preset,
662-
"rewritten_question": rewritten_question,
663656
"task": task,
664657
},
665658
project_validate_params.ProjectValidateParams,
@@ -1097,18 +1090,17 @@ async def validate(
10971090
project_id: str,
10981091
*,
10991092
context: str,
1093+
prompt: str,
11001094
query: str,
1101-
response: project_validate_params.Response,
1095+
response: str,
11021096
use_llm_matching: bool | NotGiven = NOT_GIVEN,
11031097
constrain_outputs: Optional[List[str]] | NotGiven = NOT_GIVEN,
11041098
custom_eval_thresholds: Optional[Dict[str, float]] | NotGiven = NOT_GIVEN,
11051099
custom_metadata: Optional[object] | NotGiven = NOT_GIVEN,
11061100
eval_scores: Optional[Dict[str, float]] | NotGiven = NOT_GIVEN,
1107-
messages: Iterable[project_validate_params.Message] | NotGiven = NOT_GIVEN,
1101+
messages: Optional[Iterable[project_validate_params.Message]] | NotGiven = NOT_GIVEN,
11081102
options: Optional[project_validate_params.Options] | NotGiven = NOT_GIVEN,
1109-
prompt: Optional[str] | NotGiven = NOT_GIVEN,
11101103
quality_preset: Literal["best", "high", "medium", "low", "base"] | NotGiven = NOT_GIVEN,
1111-
rewritten_question: Optional[str] | NotGiven = NOT_GIVEN,
11121104
task: Optional[str] | NotGiven = NOT_GIVEN,
11131105
x_client_library_version: str | NotGiven = NOT_GIVEN,
11141106
x_integration_type: str | NotGiven = NOT_GIVEN,
@@ -1136,8 +1128,9 @@ async def validate(
11361128
eval_scores: Scores assessing different aspects of the RAG system. If not provided, TLM will
11371129
be used to generate scores.
11381130
1139-
messages: Message history to provide conversation context for the query. Messages contain
1140-
up to and including the latest user prompt to the LLM.
1131+
messages: Optional message history to provide conversation context for the query. Used to
1132+
rewrite query into a self-contained version of itself. If not provided, the
1133+
query will be treated as self-contained.
11411134
11421135
options: Typed dict of advanced configuration options for the Trustworthy Language Model.
11431136
Many of these configurations are determined by the quality preset selected
@@ -1224,14 +1217,8 @@ async def validate(
12241217
- name: Name of the evaluation criteria.
12251218
- criteria: Instructions specifying the evaluation criteria.
12261219
1227-
prompt: The prompt to use for the TLM call. If not provided, the prompt will be
1228-
generated from the messages.
1229-
12301220
quality_preset: The quality preset to use for the TLM or Trustworthy RAG API.
12311221
1232-
rewritten_question: The re-written query if it was provided by the client to Codex from a user to be
1233-
used instead of the original query.
1234-
12351222
extra_headers: Send extra headers
12361223
12371224
extra_query: Add additional query parameters to the request
@@ -1258,6 +1245,7 @@ async def validate(
12581245
body=await async_maybe_transform(
12591246
{
12601247
"context": context,
1248+
"prompt": prompt,
12611249
"query": query,
12621250
"response": response,
12631251
"constrain_outputs": constrain_outputs,
@@ -1266,9 +1254,7 @@ async def validate(
12661254
"eval_scores": eval_scores,
12671255
"messages": messages,
12681256
"options": options,
1269-
"prompt": prompt,
12701257
"quality_preset": quality_preset,
1271-
"rewritten_question": rewritten_question,
12721258
"task": task,
12731259
},
12741260
project_validate_params.ProjectValidateParams,

0 commit comments

Comments
 (0)