Skip to content

Commit 8efca3a

Browse files
committed
feat(api): add support for filtering messages by run_id (#1288)
1 parent 0707908 commit 8efca3a

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

Diff for: src/openai/resources/beta/threads/messages/messages.py

+8
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ def list(
203203
before: str | NotGiven = NOT_GIVEN,
204204
limit: int | NotGiven = NOT_GIVEN,
205205
order: Literal["asc", "desc"] | NotGiven = NOT_GIVEN,
206+
run_id: str | NotGiven = NOT_GIVEN,
206207
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
207208
# The extra values given here take precedence over values defined on the client or passed to this method.
208209
extra_headers: Headers | None = None,
@@ -230,6 +231,8 @@ def list(
230231
order: Sort order by the `created_at` timestamp of the objects. `asc` for ascending
231232
order and `desc` for descending order.
232233
234+
run_id: Filter messages by the run ID that generated them.
235+
233236
extra_headers: Send extra headers
234237
235238
extra_query: Add additional query parameters to the request
@@ -255,6 +258,7 @@ def list(
255258
"before": before,
256259
"limit": limit,
257260
"order": order,
261+
"run_id": run_id,
258262
},
259263
message_list_params.MessageListParams,
260264
),
@@ -432,6 +436,7 @@ def list(
432436
before: str | NotGiven = NOT_GIVEN,
433437
limit: int | NotGiven = NOT_GIVEN,
434438
order: Literal["asc", "desc"] | NotGiven = NOT_GIVEN,
439+
run_id: str | NotGiven = NOT_GIVEN,
435440
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
436441
# The extra values given here take precedence over values defined on the client or passed to this method.
437442
extra_headers: Headers | None = None,
@@ -459,6 +464,8 @@ def list(
459464
order: Sort order by the `created_at` timestamp of the objects. `asc` for ascending
460465
order and `desc` for descending order.
461466
467+
run_id: Filter messages by the run ID that generated them.
468+
462469
extra_headers: Send extra headers
463470
464471
extra_query: Add additional query parameters to the request
@@ -484,6 +491,7 @@ def list(
484491
"before": before,
485492
"limit": limit,
486493
"order": order,
494+
"run_id": run_id,
487495
},
488496
message_list_params.MessageListParams,
489497
),

Diff for: src/openai/types/beta/threads/message_list_params.py

+3
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,6 @@ class MessageListParams(TypedDict, total=False):
3737
3838
`asc` for ascending order and `desc` for descending order.
3939
"""
40+
41+
run_id: str
42+
"""Filter messages by the run ID that generated them."""

Diff for: tests/api_resources/beta/threads/test_messages.py

+2
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ def test_method_list_with_all_params(self, client: OpenAI) -> None:
195195
before="string",
196196
limit=0,
197197
order="asc",
198+
run_id="string",
198199
)
199200
assert_matches_type(SyncCursorPage[Message], message, path=["response"])
200201

@@ -410,6 +411,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncOpenAI) -> N
410411
before="string",
411412
limit=0,
412413
order="asc",
414+
run_id="string",
413415
)
414416
assert_matches_type(AsyncCursorPage[Message], message, path=["response"])
415417

0 commit comments

Comments
 (0)