Skip to content

feat(api): api update #98

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 3, 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: d84beeafebbb22261946b77758a506a6
openapi_spec_hash: 6a5cfa54c19b354978b1654c152b0431
config_hash: adbedb6317fca6f566f54564cc341846
24 changes: 21 additions & 3 deletions src/codex/resources/projects/entries.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from __future__ import annotations

from typing import Optional
from typing import Iterable, Optional

import httpx

Expand Down Expand Up @@ -54,6 +54,7 @@ def create(
*,
question: str,
answer: Optional[str] | NotGiven = NOT_GIVEN,
client_query_metadata: Iterable[object] | NotGiven = NOT_GIVEN,
draft_answer: Optional[str] | NotGiven = NOT_GIVEN,
x_client_library_version: str | NotGiven = NOT_GIVEN,
x_integration_type: str | NotGiven = NOT_GIVEN,
Expand Down Expand Up @@ -97,6 +98,7 @@ def create(
{
"question": question,
"answer": answer,
"client_query_metadata": client_query_metadata,
"draft_answer": draft_answer,
},
entry_create_params.EntryCreateParams,
Expand Down Expand Up @@ -232,6 +234,7 @@ def query(
project_id: str,
*,
question: str,
client_metadata: Optional[object] | NotGiven = NOT_GIVEN,
x_client_library_version: str | NotGiven = NOT_GIVEN,
x_integration_type: str | NotGiven = NOT_GIVEN,
x_source: str | NotGiven = NOT_GIVEN,
Expand Down Expand Up @@ -270,7 +273,13 @@ def query(
}
return self._post(
f"/api/projects/{project_id}/entries/query",
body=maybe_transform({"question": question}, entry_query_params.EntryQueryParams),
body=maybe_transform(
{
"question": question,
"client_metadata": client_metadata,
},
entry_query_params.EntryQueryParams,
),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
Expand Down Expand Up @@ -304,6 +313,7 @@ async def create(
*,
question: str,
answer: Optional[str] | NotGiven = NOT_GIVEN,
client_query_metadata: Iterable[object] | NotGiven = NOT_GIVEN,
draft_answer: Optional[str] | NotGiven = NOT_GIVEN,
x_client_library_version: str | NotGiven = NOT_GIVEN,
x_integration_type: str | NotGiven = NOT_GIVEN,
Expand Down Expand Up @@ -347,6 +357,7 @@ async def create(
{
"question": question,
"answer": answer,
"client_query_metadata": client_query_metadata,
"draft_answer": draft_answer,
},
entry_create_params.EntryCreateParams,
Expand Down Expand Up @@ -482,6 +493,7 @@ async def query(
project_id: str,
*,
question: str,
client_metadata: Optional[object] | NotGiven = NOT_GIVEN,
x_client_library_version: str | NotGiven = NOT_GIVEN,
x_integration_type: str | NotGiven = NOT_GIVEN,
x_source: str | NotGiven = NOT_GIVEN,
Expand Down Expand Up @@ -520,7 +532,13 @@ async def query(
}
return await self._post(
f"/api/projects/{project_id}/entries/query",
body=await async_maybe_transform({"question": question}, entry_query_params.EntryQueryParams),
body=await async_maybe_transform(
{
"question": question,
"client_metadata": client_metadata,
},
entry_query_params.EntryQueryParams,
),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
Expand Down
4 changes: 3 additions & 1 deletion src/codex/types/projects/cluster_list_response.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import Optional
from typing import List, Optional
from datetime import datetime
from typing_extensions import Literal

Expand All @@ -26,6 +26,8 @@ class ClusterListResponse(BaseModel):

answered_at: Optional[datetime] = None

client_query_metadata: Optional[List[object]] = None

draft_answer: Optional[str] = None

draft_answer_last_edited: Optional[datetime] = None
Expand Down
4 changes: 3 additions & 1 deletion src/codex/types/projects/entry.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import Optional
from typing import List, Optional
from datetime import datetime
from typing_extensions import Literal

Expand All @@ -24,6 +24,8 @@ class Entry(BaseModel):

answered_at: Optional[datetime] = None

client_query_metadata: Optional[List[object]] = None

draft_answer: Optional[str] = None

draft_answer_last_edited: Optional[datetime] = None
4 changes: 3 additions & 1 deletion src/codex/types/projects/entry_create_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from __future__ import annotations

from typing import Optional
from typing import Iterable, Optional
from typing_extensions import Required, Annotated, TypedDict

from ..._utils import PropertyInfo
Expand All @@ -15,6 +15,8 @@ class EntryCreateParams(TypedDict, total=False):

answer: Optional[str]

client_query_metadata: Iterable[object]

draft_answer: Optional[str]

x_client_library_version: Annotated[str, PropertyInfo(alias="x-client-library-version")]
Expand Down
3 changes: 3 additions & 0 deletions src/codex/types/projects/entry_query_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from __future__ import annotations

from typing import Optional
from typing_extensions import Required, Annotated, TypedDict

from ..._utils import PropertyInfo
Expand All @@ -12,6 +13,8 @@
class EntryQueryParams(TypedDict, total=False):
question: Required[str]

client_metadata: Optional[object]

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

x_integration_type: Annotated[str, PropertyInfo(alias="x-integration-type")]
Expand Down
4 changes: 3 additions & 1 deletion src/codex/types/projects/entry_query_response.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import Optional
from typing import List, Optional

from ..._models import BaseModel

Expand All @@ -14,6 +14,8 @@ class Entry(BaseModel):

answer: Optional[str] = None

client_query_metadata: Optional[List[object]] = None

draft_answer: Optional[str] = None


Expand Down
4 changes: 4 additions & 0 deletions tests/api_resources/projects/test_entries.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def test_method_create_with_all_params(self, client: Codex) -> None:
project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
question="question",
answer="answer",
client_query_metadata=[{}],
draft_answer="draft_answer",
x_client_library_version="x-client-library-version",
x_integration_type="x-integration-type",
Expand Down Expand Up @@ -261,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",
client_metadata={},
x_client_library_version="x-client-library-version",
x_integration_type="x-integration-type",
x_source="x-source",
Expand Down Expand Up @@ -325,6 +327,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCodex) ->
project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
question="question",
answer="answer",
client_query_metadata=[{}],
draft_answer="draft_answer",
x_client_library_version="x-client-library-version",
x_integration_type="x-integration-type",
Expand Down Expand Up @@ -553,6 +556,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",
client_metadata={},
x_client_library_version="x-client-library-version",
x_integration_type="x-integration-type",
x_source="x-source",
Expand Down