Skip to content

Commit

Permalink
feat(api): add support for filtering messages by run_id (#1288)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-bot committed Apr 1, 2024
1 parent aa5920a commit 58d6b77
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/openai/resources/beta/threads/messages/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ def list(
before: str | NotGiven = NOT_GIVEN,
limit: int | NotGiven = NOT_GIVEN,
order: Literal["asc", "desc"] | NotGiven = NOT_GIVEN,
run_id: str | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
Expand Down Expand Up @@ -230,6 +231,8 @@ def list(
order: Sort order by the `created_at` timestamp of the objects. `asc` for ascending
order and `desc` for descending order.
run_id: Filter messages by the run ID that generated them.
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
Expand All @@ -255,6 +258,7 @@ def list(
"before": before,
"limit": limit,
"order": order,
"run_id": run_id,
},
message_list_params.MessageListParams,
),
Expand Down Expand Up @@ -432,6 +436,7 @@ def list(
before: str | NotGiven = NOT_GIVEN,
limit: int | NotGiven = NOT_GIVEN,
order: Literal["asc", "desc"] | NotGiven = NOT_GIVEN,
run_id: str | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
Expand Down Expand Up @@ -459,6 +464,8 @@ def list(
order: Sort order by the `created_at` timestamp of the objects. `asc` for ascending
order and `desc` for descending order.
run_id: Filter messages by the run ID that generated them.
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
Expand All @@ -484,6 +491,7 @@ def list(
"before": before,
"limit": limit,
"order": order,
"run_id": run_id,
},
message_list_params.MessageListParams,
),
Expand Down
3 changes: 3 additions & 0 deletions src/openai/types/beta/threads/message_list_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,6 @@ class MessageListParams(TypedDict, total=False):
`asc` for ascending order and `desc` for descending order.
"""

run_id: str
"""Filter messages by the run ID that generated them."""
2 changes: 2 additions & 0 deletions tests/api_resources/beta/threads/test_messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ def test_method_list_with_all_params(self, client: OpenAI) -> None:
before="string",
limit=0,
order="asc",
run_id="string",
)
assert_matches_type(SyncCursorPage[Message], message, path=["response"])

Expand Down Expand Up @@ -410,6 +411,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncOpenAI) -> N
before="string",
limit=0,
order="asc",
run_id="string",
)
assert_matches_type(AsyncCursorPage[Message], message, path=["response"])

Expand Down

0 comments on commit 58d6b77

Please sign in to comment.