Skip to content

Commit be06884

Browse files
feat(api): api update
1 parent 41b210d commit be06884

File tree

4 files changed

+19
-35
lines changed

4 files changed

+19
-35
lines changed

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
configured_endpoints: 65
2-
openapi_spec_hash: 8bc7a64933cd540d1d2499d055430832
2+
openapi_spec_hash: 5d686da2afda75185dc9e4190a42b75c
33
config_hash: 14b2643a0ec60cf326dfed00939644ff

src/codex/resources/projects/projects.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -212,10 +212,10 @@ def update(
212212
self,
213213
project_id: str,
214214
*,
215-
config: project_update_params.Config,
216-
name: str,
217-
auto_clustering_enabled: bool | NotGiven = NOT_GIVEN,
215+
auto_clustering_enabled: Optional[bool] | NotGiven = NOT_GIVEN,
216+
config: Optional[project_update_params.Config] | NotGiven = NOT_GIVEN,
218217
description: Optional[str] | NotGiven = NOT_GIVEN,
218+
name: Optional[str] | NotGiven = NOT_GIVEN,
219219
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
220220
# The extra values given here take precedence over values defined on the client or passed to this method.
221221
extra_headers: Headers | None = None,
@@ -241,10 +241,10 @@ def update(
241241
f"/api/projects/{project_id}",
242242
body=maybe_transform(
243243
{
244-
"config": config,
245-
"name": name,
246244
"auto_clustering_enabled": auto_clustering_enabled,
245+
"config": config,
247246
"description": description,
247+
"name": name,
248248
},
249249
project_update_params.ProjectUpdateParams,
250250
),
@@ -820,10 +820,10 @@ async def update(
820820
self,
821821
project_id: str,
822822
*,
823-
config: project_update_params.Config,
824-
name: str,
825-
auto_clustering_enabled: bool | NotGiven = NOT_GIVEN,
823+
auto_clustering_enabled: Optional[bool] | NotGiven = NOT_GIVEN,
824+
config: Optional[project_update_params.Config] | NotGiven = NOT_GIVEN,
826825
description: Optional[str] | NotGiven = NOT_GIVEN,
826+
name: Optional[str] | NotGiven = NOT_GIVEN,
827827
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
828828
# The extra values given here take precedence over values defined on the client or passed to this method.
829829
extra_headers: Headers | None = None,
@@ -849,10 +849,10 @@ async def update(
849849
f"/api/projects/{project_id}",
850850
body=await async_maybe_transform(
851851
{
852-
"config": config,
853-
"name": name,
854852
"auto_clustering_enabled": auto_clustering_enabled,
853+
"config": config,
855854
"description": description,
855+
"name": name,
856856
},
857857
project_update_params.ProjectUpdateParams,
858858
),

src/codex/types/project_update_params.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@
2121

2222

2323
class ProjectUpdateParams(TypedDict, total=False):
24-
config: Required[Config]
24+
auto_clustering_enabled: Optional[bool]
2525

26-
name: Required[str]
27-
28-
auto_clustering_enabled: bool
26+
config: Optional[Config]
2927

3028
description: Optional[str]
3129

30+
name: Optional[str]
31+
3232

3333
class ConfigEvalConfigCustomEvalsEvals(TypedDict, total=False):
3434
criteria: Required[str]

tests/api_resources/test_projects.py

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,6 @@ def test_path_params_retrieve(self, client: Codex) -> None:
206206
def test_method_update(self, client: Codex) -> None:
207207
project = client.projects.update(
208208
project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
209-
config={},
210-
name="name",
211209
)
212210
assert_matches_type(ProjectReturnSchema, project, path=["response"])
213211

@@ -216,6 +214,7 @@ def test_method_update(self, client: Codex) -> None:
216214
def test_method_update_with_all_params(self, client: Codex) -> None:
217215
project = client.projects.update(
218216
project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
217+
auto_clustering_enabled=True,
219218
config={
220219
"clustering_use_llm_matching": True,
221220
"eval_config": {
@@ -298,9 +297,8 @@ def test_method_update_with_all_params(self, client: Codex) -> None:
298297
"query_use_llm_matching": True,
299298
"upper_llm_match_distance_threshold": 0,
300299
},
301-
name="name",
302-
auto_clustering_enabled=True,
303300
description="description",
301+
name="name",
304302
)
305303
assert_matches_type(ProjectReturnSchema, project, path=["response"])
306304

@@ -309,8 +307,6 @@ def test_method_update_with_all_params(self, client: Codex) -> None:
309307
def test_raw_response_update(self, client: Codex) -> None:
310308
response = client.projects.with_raw_response.update(
311309
project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
312-
config={},
313-
name="name",
314310
)
315311

316312
assert response.is_closed is True
@@ -323,8 +319,6 @@ def test_raw_response_update(self, client: Codex) -> None:
323319
def test_streaming_response_update(self, client: Codex) -> None:
324320
with client.projects.with_streaming_response.update(
325321
project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
326-
config={},
327-
name="name",
328322
) as response:
329323
assert not response.is_closed
330324
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
@@ -340,8 +334,6 @@ def test_path_params_update(self, client: Codex) -> None:
340334
with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"):
341335
client.projects.with_raw_response.update(
342336
project_id="",
343-
config={},
344-
name="name",
345337
)
346338

347339
@pytest.mark.skip()
@@ -919,8 +911,6 @@ async def test_path_params_retrieve(self, async_client: AsyncCodex) -> None:
919911
async def test_method_update(self, async_client: AsyncCodex) -> None:
920912
project = await async_client.projects.update(
921913
project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
922-
config={},
923-
name="name",
924914
)
925915
assert_matches_type(ProjectReturnSchema, project, path=["response"])
926916

@@ -929,6 +919,7 @@ async def test_method_update(self, async_client: AsyncCodex) -> None:
929919
async def test_method_update_with_all_params(self, async_client: AsyncCodex) -> None:
930920
project = await async_client.projects.update(
931921
project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
922+
auto_clustering_enabled=True,
932923
config={
933924
"clustering_use_llm_matching": True,
934925
"eval_config": {
@@ -1011,9 +1002,8 @@ async def test_method_update_with_all_params(self, async_client: AsyncCodex) ->
10111002
"query_use_llm_matching": True,
10121003
"upper_llm_match_distance_threshold": 0,
10131004
},
1014-
name="name",
1015-
auto_clustering_enabled=True,
10161005
description="description",
1006+
name="name",
10171007
)
10181008
assert_matches_type(ProjectReturnSchema, project, path=["response"])
10191009

@@ -1022,8 +1012,6 @@ async def test_method_update_with_all_params(self, async_client: AsyncCodex) ->
10221012
async def test_raw_response_update(self, async_client: AsyncCodex) -> None:
10231013
response = await async_client.projects.with_raw_response.update(
10241014
project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
1025-
config={},
1026-
name="name",
10271015
)
10281016

10291017
assert response.is_closed is True
@@ -1036,8 +1024,6 @@ async def test_raw_response_update(self, async_client: AsyncCodex) -> None:
10361024
async def test_streaming_response_update(self, async_client: AsyncCodex) -> None:
10371025
async with async_client.projects.with_streaming_response.update(
10381026
project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
1039-
config={},
1040-
name="name",
10411027
) as response:
10421028
assert not response.is_closed
10431029
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
@@ -1053,8 +1039,6 @@ async def test_path_params_update(self, async_client: AsyncCodex) -> None:
10531039
with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"):
10541040
await async_client.projects.with_raw_response.update(
10551041
project_id="",
1056-
config={},
1057-
name="name",
10581042
)
10591043

10601044
@pytest.mark.skip()

0 commit comments

Comments
 (0)