Skip to content

Commit 4abd0f4

Browse files
feat(api): api update (#104)
1 parent c360da6 commit 4abd0f4

File tree

10 files changed

+112
-8
lines changed

10 files changed

+112
-8
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: 36
2-
openapi_spec_hash: 1850a850b7e27992c6e47190db9add88
2+
openapi_spec_hash: 8ef89533cd58e3b2ceb53a877832f48b
33
config_hash: adbedb6317fca6f566f54564cc341846

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,15 @@ from codex import Codex
155155
client = Codex()
156156

157157
project_return_schema = client.projects.create(
158-
config={"max_distance": 0},
158+
config={
159+
"clustering_use_llm_matching": True,
160+
"llm_matching_model": "llm_matching_model",
161+
"llm_matching_quality_preset": "llm_matching_quality_preset",
162+
"lower_llm_match_distance_threshold": 0,
163+
"max_distance": 0,
164+
"query_use_llm_matching": True,
165+
"upper_llm_match_distance_threshold": 0,
166+
},
159167
name="name",
160168
organization_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
161169
)

src/codex/resources/projects/entries.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ def query(
234234
project_id: str,
235235
*,
236236
question: str,
237+
use_llm_matching: bool | NotGiven = NOT_GIVEN,
237238
client_metadata: Optional[object] | NotGiven = NOT_GIVEN,
238239
x_client_library_version: str | NotGiven = NOT_GIVEN,
239240
x_integration_type: str | NotGiven = NOT_GIVEN,
@@ -281,7 +282,11 @@ def query(
281282
entry_query_params.EntryQueryParams,
282283
),
283284
options=make_request_options(
284-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
285+
extra_headers=extra_headers,
286+
extra_query=extra_query,
287+
extra_body=extra_body,
288+
timeout=timeout,
289+
query=maybe_transform({"use_llm_matching": use_llm_matching}, entry_query_params.EntryQueryParams),
285290
),
286291
cast_to=EntryQueryResponse,
287292
)
@@ -493,6 +498,7 @@ async def query(
493498
project_id: str,
494499
*,
495500
question: str,
501+
use_llm_matching: bool | NotGiven = NOT_GIVEN,
496502
client_metadata: Optional[object] | NotGiven = NOT_GIVEN,
497503
x_client_library_version: str | NotGiven = NOT_GIVEN,
498504
x_integration_type: str | NotGiven = NOT_GIVEN,
@@ -540,7 +546,13 @@ async def query(
540546
entry_query_params.EntryQueryParams,
541547
),
542548
options=make_request_options(
543-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
549+
extra_headers=extra_headers,
550+
extra_query=extra_query,
551+
extra_body=extra_body,
552+
timeout=timeout,
553+
query=await async_maybe_transform(
554+
{"use_llm_matching": use_llm_matching}, entry_query_params.EntryQueryParams
555+
),
544556
),
545557
cast_to=EntryQueryResponse,
546558
)

src/codex/types/project_create_params.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,16 @@ class ProjectCreateParams(TypedDict, total=False):
1919

2020

2121
class Config(TypedDict, total=False):
22+
clustering_use_llm_matching: bool
23+
24+
llm_matching_model: str
25+
26+
llm_matching_quality_preset: str
27+
28+
lower_llm_match_distance_threshold: float
29+
2230
max_distance: float
31+
32+
query_use_llm_matching: bool
33+
34+
upper_llm_match_distance_threshold: float

src/codex/types/project_list_response.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,20 @@
99

1010

1111
class ProjectConfig(BaseModel):
12+
clustering_use_llm_matching: Optional[bool] = None
13+
14+
llm_matching_model: Optional[str] = None
15+
16+
llm_matching_quality_preset: Optional[str] = None
17+
18+
lower_llm_match_distance_threshold: Optional[float] = None
19+
1220
max_distance: Optional[float] = None
1321

22+
query_use_llm_matching: Optional[bool] = None
23+
24+
upper_llm_match_distance_threshold: Optional[float] = None
25+
1426

1527
class Project(BaseModel):
1628
id: str

src/codex/types/project_return_schema.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,20 @@
99

1010

1111
class Config(BaseModel):
12+
clustering_use_llm_matching: Optional[bool] = None
13+
14+
llm_matching_model: Optional[str] = None
15+
16+
llm_matching_quality_preset: Optional[str] = None
17+
18+
lower_llm_match_distance_threshold: Optional[float] = None
19+
1220
max_distance: Optional[float] = None
1321

22+
query_use_llm_matching: Optional[bool] = None
23+
24+
upper_llm_match_distance_threshold: Optional[float] = None
25+
1426

1527
class ProjectReturnSchema(BaseModel):
1628
id: str

src/codex/types/project_update_params.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,16 @@ class ProjectUpdateParams(TypedDict, total=False):
1717

1818

1919
class Config(TypedDict, total=False):
20+
clustering_use_llm_matching: bool
21+
22+
llm_matching_model: str
23+
24+
llm_matching_quality_preset: str
25+
26+
lower_llm_match_distance_threshold: float
27+
2028
max_distance: float
29+
30+
query_use_llm_matching: bool
31+
32+
upper_llm_match_distance_threshold: float

src/codex/types/projects/entry_query_params.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
class EntryQueryParams(TypedDict, total=False):
1414
question: Required[str]
1515

16+
use_llm_matching: bool
17+
1618
client_metadata: Optional[object]
1719

1820
x_client_library_version: Annotated[str, PropertyInfo(alias="x-client-library-version")]

tests/api_resources/projects/test_entries.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ def test_method_query_with_all_params(self, client: Codex) -> None:
262262
entry = client.projects.entries.query(
263263
project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
264264
question="question",
265+
use_llm_matching=True,
265266
client_metadata={},
266267
x_client_library_version="x-client-library-version",
267268
x_integration_type="x-integration-type",
@@ -556,6 +557,7 @@ async def test_method_query_with_all_params(self, async_client: AsyncCodex) -> N
556557
entry = await async_client.projects.entries.query(
557558
project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
558559
question="question",
560+
use_llm_matching=True,
559561
client_metadata={},
560562
x_client_library_version="x-client-library-version",
561563
x_integration_type="x-integration-type",

tests/api_resources/test_projects.py

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,15 @@ def test_method_create(self, client: Codex) -> None:
3434
@parametrize
3535
def test_method_create_with_all_params(self, client: Codex) -> None:
3636
project = client.projects.create(
37-
config={"max_distance": 0},
37+
config={
38+
"clustering_use_llm_matching": True,
39+
"llm_matching_model": "llm_matching_model",
40+
"llm_matching_quality_preset": "llm_matching_quality_preset",
41+
"lower_llm_match_distance_threshold": 0,
42+
"max_distance": 0,
43+
"query_use_llm_matching": True,
44+
"upper_llm_match_distance_threshold": 0,
45+
},
3846
name="name",
3947
organization_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
4048
description="description",
@@ -128,7 +136,15 @@ def test_method_update(self, client: Codex) -> None:
128136
def test_method_update_with_all_params(self, client: Codex) -> None:
129137
project = client.projects.update(
130138
project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
131-
config={"max_distance": 0},
139+
config={
140+
"clustering_use_llm_matching": True,
141+
"llm_matching_model": "llm_matching_model",
142+
"llm_matching_quality_preset": "llm_matching_quality_preset",
143+
"lower_llm_match_distance_threshold": 0,
144+
"max_distance": 0,
145+
"query_use_llm_matching": True,
146+
"upper_llm_match_distance_threshold": 0,
147+
},
132148
name="name",
133149
description="description",
134150
)
@@ -324,7 +340,15 @@ async def test_method_create(self, async_client: AsyncCodex) -> None:
324340
@parametrize
325341
async def test_method_create_with_all_params(self, async_client: AsyncCodex) -> None:
326342
project = await async_client.projects.create(
327-
config={"max_distance": 0},
343+
config={
344+
"clustering_use_llm_matching": True,
345+
"llm_matching_model": "llm_matching_model",
346+
"llm_matching_quality_preset": "llm_matching_quality_preset",
347+
"lower_llm_match_distance_threshold": 0,
348+
"max_distance": 0,
349+
"query_use_llm_matching": True,
350+
"upper_llm_match_distance_threshold": 0,
351+
},
328352
name="name",
329353
organization_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
330354
description="description",
@@ -418,7 +442,15 @@ async def test_method_update(self, async_client: AsyncCodex) -> None:
418442
async def test_method_update_with_all_params(self, async_client: AsyncCodex) -> None:
419443
project = await async_client.projects.update(
420444
project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
421-
config={"max_distance": 0},
445+
config={
446+
"clustering_use_llm_matching": True,
447+
"llm_matching_model": "llm_matching_model",
448+
"llm_matching_quality_preset": "llm_matching_quality_preset",
449+
"lower_llm_match_distance_threshold": 0,
450+
"max_distance": 0,
451+
"query_use_llm_matching": True,
452+
"upper_llm_match_distance_threshold": 0,
453+
},
422454
name="name",
423455
description="description",
424456
)

0 commit comments

Comments
 (0)