Skip to content

Commit f28da42

Browse files
feat(api): api update (#60)
1 parent d032df2 commit f28da42

File tree

4 files changed

+18
-4
lines changed

4 files changed

+18
-4
lines changed

src/codex/resources/projects/entries.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ def update(
138138
*,
139139
project_id: str,
140140
answer: Optional[str] | NotGiven = NOT_GIVEN,
141+
frequency_count: Optional[int] | NotGiven = NOT_GIVEN,
141142
question: Optional[str] | NotGiven = NOT_GIVEN,
142143
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
143144
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -167,6 +168,7 @@ def update(
167168
body=maybe_transform(
168169
{
169170
"answer": answer,
171+
"frequency_count": frequency_count,
170172
"question": question,
171173
},
172174
entry_update_params.EntryUpdateParams,
@@ -318,8 +320,10 @@ def query(
318320
extra_body: Body | None = None,
319321
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
320322
) -> Optional[Entry]:
321-
"""
322-
Query knowledge for a project.
323+
"""Query knowledge for a project.
324+
325+
Also increments the frequency_count for the
326+
matching entry if found.
323327
324328
Returns the matching entry if found and answered, otherwise returns None. This
325329
allows the client to distinguish between: (1) no matching question found
@@ -451,6 +455,7 @@ async def update(
451455
*,
452456
project_id: str,
453457
answer: Optional[str] | NotGiven = NOT_GIVEN,
458+
frequency_count: Optional[int] | NotGiven = NOT_GIVEN,
454459
question: Optional[str] | NotGiven = NOT_GIVEN,
455460
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
456461
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -480,6 +485,7 @@ async def update(
480485
body=await async_maybe_transform(
481486
{
482487
"answer": answer,
488+
"frequency_count": frequency_count,
483489
"question": question,
484490
},
485491
entry_update_params.EntryUpdateParams,
@@ -631,8 +637,10 @@ async def query(
631637
extra_body: Body | None = None,
632638
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
633639
) -> Optional[Entry]:
634-
"""
635-
Query knowledge for a project.
640+
"""Query knowledge for a project.
641+
642+
Also increments the frequency_count for the
643+
matching entry if found.
636644
637645
Returns the matching entry if found and answered, otherwise returns None. This
638646
allows the client to distinguish between: (1) no matching question found

src/codex/types/projects/entry.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,5 @@ class Entry(BaseModel):
1818
answer: Optional[str] = None
1919

2020
answered_at: Optional[datetime] = None
21+
22+
frequency_count: Optional[int] = None

src/codex/types/projects/entry_update_params.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,6 @@ class EntryUpdateParams(TypedDict, total=False):
1313

1414
answer: Optional[str]
1515

16+
frequency_count: Optional[int]
17+
1618
question: Optional[str]

tests/api_resources/projects/test_entries.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ def test_method_update_with_all_params(self, client: Codex) -> None:
144144
entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
145145
project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
146146
answer="answer",
147+
frequency_count=0,
147148
question="question",
148149
)
149150
assert_matches_type(Entry, entry, path=["response"])
@@ -519,6 +520,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCodex) ->
519520
entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
520521
project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
521522
answer="answer",
523+
frequency_count=0,
522524
question="question",
523525
)
524526
assert_matches_type(Entry, entry, path=["response"])

0 commit comments

Comments
 (0)