Skip to content

feat(api): api update #104

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
configured_endpoints: 36
openapi_spec_hash: 1850a850b7e27992c6e47190db9add88
openapi_spec_hash: 8ef89533cd58e3b2ceb53a877832f48b
config_hash: adbedb6317fca6f566f54564cc341846
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,15 @@ from codex import Codex
client = Codex()

project_return_schema = client.projects.create(
config={"max_distance": 0},
config={
"clustering_use_llm_matching": True,
"llm_matching_model": "llm_matching_model",
"llm_matching_quality_preset": "llm_matching_quality_preset",
"lower_llm_match_distance_threshold": 0,
"max_distance": 0,
"query_use_llm_matching": True,
"upper_llm_match_distance_threshold": 0,
},
name="name",
organization_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
)
Expand Down
16 changes: 14 additions & 2 deletions src/codex/resources/projects/entries.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ def query(
project_id: str,
*,
question: str,
use_llm_matching: bool | NotGiven = NOT_GIVEN,
client_metadata: Optional[object] | NotGiven = NOT_GIVEN,
x_client_library_version: str | NotGiven = NOT_GIVEN,
x_integration_type: str | NotGiven = NOT_GIVEN,
Expand Down Expand Up @@ -281,7 +282,11 @@ def query(
entry_query_params.EntryQueryParams,
),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
query=maybe_transform({"use_llm_matching": use_llm_matching}, entry_query_params.EntryQueryParams),
),
cast_to=EntryQueryResponse,
)
Expand Down Expand Up @@ -493,6 +498,7 @@ async def query(
project_id: str,
*,
question: str,
use_llm_matching: bool | NotGiven = NOT_GIVEN,
client_metadata: Optional[object] | NotGiven = NOT_GIVEN,
x_client_library_version: str | NotGiven = NOT_GIVEN,
x_integration_type: str | NotGiven = NOT_GIVEN,
Expand Down Expand Up @@ -540,7 +546,13 @@ async def query(
entry_query_params.EntryQueryParams,
),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
query=await async_maybe_transform(
{"use_llm_matching": use_llm_matching}, entry_query_params.EntryQueryParams
),
),
cast_to=EntryQueryResponse,
)
Expand Down
12 changes: 12 additions & 0 deletions src/codex/types/project_create_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,16 @@ class ProjectCreateParams(TypedDict, total=False):


class Config(TypedDict, total=False):
clustering_use_llm_matching: bool

llm_matching_model: str

llm_matching_quality_preset: str

lower_llm_match_distance_threshold: float

max_distance: float

query_use_llm_matching: bool

upper_llm_match_distance_threshold: float
12 changes: 12 additions & 0 deletions src/codex/types/project_list_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,20 @@


class ProjectConfig(BaseModel):
clustering_use_llm_matching: Optional[bool] = None

llm_matching_model: Optional[str] = None

llm_matching_quality_preset: Optional[str] = None

lower_llm_match_distance_threshold: Optional[float] = None

max_distance: Optional[float] = None

query_use_llm_matching: Optional[bool] = None

upper_llm_match_distance_threshold: Optional[float] = None


class Project(BaseModel):
id: str
Expand Down
12 changes: 12 additions & 0 deletions src/codex/types/project_return_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,20 @@


class Config(BaseModel):
clustering_use_llm_matching: Optional[bool] = None

llm_matching_model: Optional[str] = None

llm_matching_quality_preset: Optional[str] = None

lower_llm_match_distance_threshold: Optional[float] = None

max_distance: Optional[float] = None

query_use_llm_matching: Optional[bool] = None

upper_llm_match_distance_threshold: Optional[float] = None


class ProjectReturnSchema(BaseModel):
id: str
Expand Down
12 changes: 12 additions & 0 deletions src/codex/types/project_update_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,16 @@ class ProjectUpdateParams(TypedDict, total=False):


class Config(TypedDict, total=False):
clustering_use_llm_matching: bool

llm_matching_model: str

llm_matching_quality_preset: str

lower_llm_match_distance_threshold: float

max_distance: float

query_use_llm_matching: bool

upper_llm_match_distance_threshold: float
2 changes: 2 additions & 0 deletions src/codex/types/projects/entry_query_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
class EntryQueryParams(TypedDict, total=False):
question: Required[str]

use_llm_matching: bool

client_metadata: Optional[object]

x_client_library_version: Annotated[str, PropertyInfo(alias="x-client-library-version")]
Expand Down
2 changes: 2 additions & 0 deletions tests/api_resources/projects/test_entries.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ def test_method_query_with_all_params(self, client: Codex) -> None:
entry = client.projects.entries.query(
project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
question="question",
use_llm_matching=True,
client_metadata={},
x_client_library_version="x-client-library-version",
x_integration_type="x-integration-type",
Expand Down Expand Up @@ -556,6 +557,7 @@ async def test_method_query_with_all_params(self, async_client: AsyncCodex) -> N
entry = await async_client.projects.entries.query(
project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
question="question",
use_llm_matching=True,
client_metadata={},
x_client_library_version="x-client-library-version",
x_integration_type="x-integration-type",
Expand Down
40 changes: 36 additions & 4 deletions tests/api_resources/test_projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,15 @@ def test_method_create(self, client: Codex) -> None:
@parametrize
def test_method_create_with_all_params(self, client: Codex) -> None:
project = client.projects.create(
config={"max_distance": 0},
config={
"clustering_use_llm_matching": True,
"llm_matching_model": "llm_matching_model",
"llm_matching_quality_preset": "llm_matching_quality_preset",
"lower_llm_match_distance_threshold": 0,
"max_distance": 0,
"query_use_llm_matching": True,
"upper_llm_match_distance_threshold": 0,
},
name="name",
organization_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
description="description",
Expand Down Expand Up @@ -128,7 +136,15 @@ def test_method_update(self, client: Codex) -> None:
def test_method_update_with_all_params(self, client: Codex) -> None:
project = client.projects.update(
project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
config={"max_distance": 0},
config={
"clustering_use_llm_matching": True,
"llm_matching_model": "llm_matching_model",
"llm_matching_quality_preset": "llm_matching_quality_preset",
"lower_llm_match_distance_threshold": 0,
"max_distance": 0,
"query_use_llm_matching": True,
"upper_llm_match_distance_threshold": 0,
},
name="name",
description="description",
)
Expand Down Expand Up @@ -324,7 +340,15 @@ async def test_method_create(self, async_client: AsyncCodex) -> None:
@parametrize
async def test_method_create_with_all_params(self, async_client: AsyncCodex) -> None:
project = await async_client.projects.create(
config={"max_distance": 0},
config={
"clustering_use_llm_matching": True,
"llm_matching_model": "llm_matching_model",
"llm_matching_quality_preset": "llm_matching_quality_preset",
"lower_llm_match_distance_threshold": 0,
"max_distance": 0,
"query_use_llm_matching": True,
"upper_llm_match_distance_threshold": 0,
},
name="name",
organization_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
description="description",
Expand Down Expand Up @@ -418,7 +442,15 @@ async def test_method_update(self, async_client: AsyncCodex) -> None:
async def test_method_update_with_all_params(self, async_client: AsyncCodex) -> None:
project = await async_client.projects.update(
project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
config={"max_distance": 0},
config={
"clustering_use_llm_matching": True,
"llm_matching_model": "llm_matching_model",
"llm_matching_quality_preset": "llm_matching_quality_preset",
"lower_llm_match_distance_threshold": 0,
"max_distance": 0,
"query_use_llm_matching": True,
"upper_llm_match_distance_threshold": 0,
},
name="name",
description="description",
)
Expand Down