Skip to content

Commit 99c2fc7

Browse files
author
Stainless Bot
committed
feat(api): add file search result details to run steps (#1681)
1 parent 05fa732 commit 99c2fc7

File tree

14 files changed

+342
-36
lines changed

14 files changed

+342
-36
lines changed

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
configured_endpoints: 68
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-8ff62fa1091460d68fbd36d72c17d91b709917bebf2983c9c4de5784bc384a2e.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-1dbac0e95bdb5a89a0dd3d93265475a378214551b7d8c22862928e0d87ace94b.yml

api.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,7 @@ from openai.types.beta.threads.runs import (
365365
RunStepDelta,
366366
RunStepDeltaEvent,
367367
RunStepDeltaMessageDelta,
368+
RunStepInclude,
368369
ToolCall,
369370
ToolCallDelta,
370371
ToolCallDeltaObject,
@@ -374,7 +375,7 @@ from openai.types.beta.threads.runs import (
374375

375376
Methods:
376377

377-
- <code title="get /threads/{thread_id}/runs/{run_id}/steps/{step_id}">client.beta.threads.runs.steps.<a href="./src/openai/resources/beta/threads/runs/steps.py">retrieve</a>(step_id, \*, thread_id, run_id) -> <a href="./src/openai/types/beta/threads/runs/run_step.py">RunStep</a></code>
378+
- <code title="get /threads/{thread_id}/runs/{run_id}/steps/{step_id}">client.beta.threads.runs.steps.<a href="./src/openai/resources/beta/threads/runs/steps.py">retrieve</a>(step_id, \*, thread_id, run_id, \*\*<a href="src/openai/types/beta/threads/runs/step_retrieve_params.py">params</a>) -> <a href="./src/openai/types/beta/threads/runs/run_step.py">RunStep</a></code>
378379
- <code title="get /threads/{thread_id}/runs/{run_id}/steps">client.beta.threads.runs.steps.<a href="./src/openai/resources/beta/threads/runs/steps.py">list</a>(run_id, \*, thread_id, \*\*<a href="src/openai/types/beta/threads/runs/step_list_params.py">params</a>) -> <a href="./src/openai/types/beta/threads/runs/run_step.py">SyncCursorPage[RunStep]</a></code>
379380

380381
### Messages

src/openai/resources/beta/threads/runs/runs.py

Lines changed: 71 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from __future__ import annotations
44

55
import typing_extensions
6-
from typing import Union, Iterable, Optional, overload
6+
from typing import List, Union, Iterable, Optional, overload
77
from functools import partial
88
from typing_extensions import Literal
99

@@ -49,6 +49,7 @@
4949
from .....types.beta.threads.run import Run
5050
from .....types.beta.assistant_tool_param import AssistantToolParam
5151
from .....types.beta.assistant_stream_event import AssistantStreamEvent
52+
from .....types.beta.threads.runs.run_step_include import RunStepInclude
5253
from .....types.beta.assistant_tool_choice_option_param import AssistantToolChoiceOptionParam
5354
from .....types.beta.assistant_response_format_option_param import AssistantResponseFormatOptionParam
5455

@@ -74,6 +75,7 @@ def create(
7475
thread_id: str,
7576
*,
7677
assistant_id: str,
78+
include: List[RunStepInclude] | NotGiven = NOT_GIVEN,
7779
additional_instructions: Optional[str] | NotGiven = NOT_GIVEN,
7880
additional_messages: Optional[Iterable[run_create_params.AdditionalMessage]] | NotGiven = NOT_GIVEN,
7981
instructions: Optional[str] | NotGiven = NOT_GIVEN,
@@ -104,6 +106,14 @@ def create(
104106
[assistant](https://platform.openai.com/docs/api-reference/assistants) to use to
105107
execute this run.
106108
109+
include: A list of additional fields to include in the response. Currently the only
110+
supported value is `step_details.tool_calls[*].file_search.results[*].content`
111+
to fetch the file search result content.
112+
113+
See the
114+
[file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search/customizing-file-search-settings)
115+
for more information.
116+
107117
additional_instructions: Appends additional instructions at the end of the instructions for the run. This
108118
is useful for modifying the behavior on a per-run basis without overriding other
109119
instructions.
@@ -206,6 +216,7 @@ def create(
206216
*,
207217
assistant_id: str,
208218
stream: Literal[True],
219+
include: List[RunStepInclude] | NotGiven = NOT_GIVEN,
209220
additional_instructions: Optional[str] | NotGiven = NOT_GIVEN,
210221
additional_messages: Optional[Iterable[run_create_params.AdditionalMessage]] | NotGiven = NOT_GIVEN,
211222
instructions: Optional[str] | NotGiven = NOT_GIVEN,
@@ -239,6 +250,14 @@ def create(
239250
events, terminating when the Run enters a terminal state with a `data: [DONE]`
240251
message.
241252
253+
include: A list of additional fields to include in the response. Currently the only
254+
supported value is `step_details.tool_calls[*].file_search.results[*].content`
255+
to fetch the file search result content.
256+
257+
See the
258+
[file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search/customizing-file-search-settings)
259+
for more information.
260+
242261
additional_instructions: Appends additional instructions at the end of the instructions for the run. This
243262
is useful for modifying the behavior on a per-run basis without overriding other
244263
instructions.
@@ -337,6 +356,7 @@ def create(
337356
*,
338357
assistant_id: str,
339358
stream: bool,
359+
include: List[RunStepInclude] | NotGiven = NOT_GIVEN,
340360
additional_instructions: Optional[str] | NotGiven = NOT_GIVEN,
341361
additional_messages: Optional[Iterable[run_create_params.AdditionalMessage]] | NotGiven = NOT_GIVEN,
342362
instructions: Optional[str] | NotGiven = NOT_GIVEN,
@@ -370,6 +390,14 @@ def create(
370390
events, terminating when the Run enters a terminal state with a `data: [DONE]`
371391
message.
372392
393+
include: A list of additional fields to include in the response. Currently the only
394+
supported value is `step_details.tool_calls[*].file_search.results[*].content`
395+
to fetch the file search result content.
396+
397+
See the
398+
[file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search/customizing-file-search-settings)
399+
for more information.
400+
373401
additional_instructions: Appends additional instructions at the end of the instructions for the run. This
374402
is useful for modifying the behavior on a per-run basis without overriding other
375403
instructions.
@@ -467,6 +495,7 @@ def create(
467495
thread_id: str,
468496
*,
469497
assistant_id: str,
498+
include: List[RunStepInclude] | NotGiven = NOT_GIVEN,
470499
additional_instructions: Optional[str] | NotGiven = NOT_GIVEN,
471500
additional_messages: Optional[Iterable[run_create_params.AdditionalMessage]] | NotGiven = NOT_GIVEN,
472501
instructions: Optional[str] | NotGiven = NOT_GIVEN,
@@ -516,7 +545,11 @@ def create(
516545
run_create_params.RunCreateParams,
517546
),
518547
options=make_request_options(
519-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
548+
extra_headers=extra_headers,
549+
extra_query=extra_query,
550+
extra_body=extra_body,
551+
timeout=timeout,
552+
query=maybe_transform({"include": include}, run_create_params.RunCreateParams),
520553
),
521554
cast_to=Run,
522555
stream=stream or False,
@@ -958,6 +991,7 @@ def stream(
958991
self,
959992
*,
960993
assistant_id: str,
994+
include: List[RunStepInclude] | NotGiven = NOT_GIVEN,
961995
additional_instructions: Optional[str] | NotGiven = NOT_GIVEN,
962996
additional_messages: Optional[Iterable[run_create_params.AdditionalMessage]] | NotGiven = NOT_GIVEN,
963997
instructions: Optional[str] | NotGiven = NOT_GIVEN,
@@ -988,6 +1022,7 @@ def stream(
9881022
self,
9891023
*,
9901024
assistant_id: str,
1025+
include: List[RunStepInclude] | NotGiven = NOT_GIVEN,
9911026
additional_instructions: Optional[str] | NotGiven = NOT_GIVEN,
9921027
additional_messages: Optional[Iterable[run_create_params.AdditionalMessage]] | NotGiven = NOT_GIVEN,
9931028
instructions: Optional[str] | NotGiven = NOT_GIVEN,
@@ -1018,6 +1053,7 @@ def stream(
10181053
self,
10191054
*,
10201055
assistant_id: str,
1056+
include: List[RunStepInclude] | NotGiven = NOT_GIVEN,
10211057
additional_instructions: Optional[str] | NotGiven = NOT_GIVEN,
10221058
additional_messages: Optional[Iterable[run_create_params.AdditionalMessage]] | NotGiven = NOT_GIVEN,
10231059
instructions: Optional[str] | NotGiven = NOT_GIVEN,
@@ -1057,6 +1093,7 @@ def stream(
10571093
body=maybe_transform(
10581094
{
10591095
"assistant_id": assistant_id,
1096+
"include": include,
10601097
"additional_instructions": additional_instructions,
10611098
"additional_messages": additional_messages,
10621099
"instructions": instructions,
@@ -1417,6 +1454,14 @@ async def create(
14171454
[assistant](https://platform.openai.com/docs/api-reference/assistants) to use to
14181455
execute this run.
14191456
1457+
include: A list of additional fields to include in the response. Currently the only
1458+
supported value is `step_details.tool_calls[*].file_search.results[*].content`
1459+
to fetch the file search result content.
1460+
1461+
See the
1462+
[file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search/customizing-file-search-settings)
1463+
for more information.
1464+
14201465
additional_instructions: Appends additional instructions at the end of the instructions for the run. This
14211466
is useful for modifying the behavior on a per-run basis without overriding other
14221467
instructions.
@@ -1519,6 +1564,7 @@ async def create(
15191564
*,
15201565
assistant_id: str,
15211566
stream: Literal[True],
1567+
include: List[RunStepInclude] | NotGiven = NOT_GIVEN,
15221568
additional_instructions: Optional[str] | NotGiven = NOT_GIVEN,
15231569
additional_messages: Optional[Iterable[run_create_params.AdditionalMessage]] | NotGiven = NOT_GIVEN,
15241570
instructions: Optional[str] | NotGiven = NOT_GIVEN,
@@ -1552,6 +1598,14 @@ async def create(
15521598
events, terminating when the Run enters a terminal state with a `data: [DONE]`
15531599
message.
15541600
1601+
include: A list of additional fields to include in the response. Currently the only
1602+
supported value is `step_details.tool_calls[*].file_search.results[*].content`
1603+
to fetch the file search result content.
1604+
1605+
See the
1606+
[file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search/customizing-file-search-settings)
1607+
for more information.
1608+
15551609
additional_instructions: Appends additional instructions at the end of the instructions for the run. This
15561610
is useful for modifying the behavior on a per-run basis without overriding other
15571611
instructions.
@@ -1650,6 +1704,7 @@ async def create(
16501704
*,
16511705
assistant_id: str,
16521706
stream: bool,
1707+
include: List[RunStepInclude] | NotGiven = NOT_GIVEN,
16531708
additional_instructions: Optional[str] | NotGiven = NOT_GIVEN,
16541709
additional_messages: Optional[Iterable[run_create_params.AdditionalMessage]] | NotGiven = NOT_GIVEN,
16551710
instructions: Optional[str] | NotGiven = NOT_GIVEN,
@@ -1683,6 +1738,14 @@ async def create(
16831738
events, terminating when the Run enters a terminal state with a `data: [DONE]`
16841739
message.
16851740
1741+
include: A list of additional fields to include in the response. Currently the only
1742+
supported value is `step_details.tool_calls[*].file_search.results[*].content`
1743+
to fetch the file search result content.
1744+
1745+
See the
1746+
[file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search/customizing-file-search-settings)
1747+
for more information.
1748+
16861749
additional_instructions: Appends additional instructions at the end of the instructions for the run. This
16871750
is useful for modifying the behavior on a per-run basis without overriding other
16881751
instructions.
@@ -1780,6 +1843,7 @@ async def create(
17801843
thread_id: str,
17811844
*,
17821845
assistant_id: str,
1846+
include: List[RunStepInclude] | NotGiven = NOT_GIVEN,
17831847
additional_instructions: Optional[str] | NotGiven = NOT_GIVEN,
17841848
additional_messages: Optional[Iterable[run_create_params.AdditionalMessage]] | NotGiven = NOT_GIVEN,
17851849
instructions: Optional[str] | NotGiven = NOT_GIVEN,
@@ -1829,7 +1893,11 @@ async def create(
18291893
run_create_params.RunCreateParams,
18301894
),
18311895
options=make_request_options(
1832-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1896+
extra_headers=extra_headers,
1897+
extra_query=extra_query,
1898+
extra_body=extra_body,
1899+
timeout=timeout,
1900+
query=await async_maybe_transform({"include": include}, run_create_params.RunCreateParams),
18331901
),
18341902
cast_to=Run,
18351903
stream=stream or False,

0 commit comments

Comments
 (0)