Skip to content

Commit f5449c0

Browse files
Stainless Botdgellow
Stainless Bot
authored andcommitted
feat(api): add file search result details to run steps (#1681)
1 parent 05fa732 commit f5449c0

File tree

14 files changed

+351
-36
lines changed

14 files changed

+351
-36
lines changed

.stats.yml

+1-1
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

+2-1
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

+80-3
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,
@@ -712,6 +745,7 @@ def create_and_poll(
712745
self,
713746
*,
714747
assistant_id: str,
748+
include: List[RunStepInclude] | NotGiven = NOT_GIVEN,
715749
additional_instructions: Optional[str] | NotGiven = NOT_GIVEN,
716750
additional_messages: Optional[Iterable[run_create_params.AdditionalMessage]] | NotGiven = NOT_GIVEN,
717751
instructions: Optional[str] | NotGiven = NOT_GIVEN,
@@ -743,6 +777,7 @@ def create_and_poll(
743777
run = self.create(
744778
thread_id=thread_id,
745779
assistant_id=assistant_id,
780+
include=include,
746781
additional_instructions=additional_instructions,
747782
additional_messages=additional_messages,
748783
instructions=instructions,
@@ -958,6 +993,7 @@ def stream(
958993
self,
959994
*,
960995
assistant_id: str,
996+
include: List[RunStepInclude] | NotGiven = NOT_GIVEN,
961997
additional_instructions: Optional[str] | NotGiven = NOT_GIVEN,
962998
additional_messages: Optional[Iterable[run_create_params.AdditionalMessage]] | NotGiven = NOT_GIVEN,
963999
instructions: Optional[str] | NotGiven = NOT_GIVEN,
@@ -988,6 +1024,7 @@ def stream(
9881024
self,
9891025
*,
9901026
assistant_id: str,
1027+
include: List[RunStepInclude] | NotGiven = NOT_GIVEN,
9911028
additional_instructions: Optional[str] | NotGiven = NOT_GIVEN,
9921029
additional_messages: Optional[Iterable[run_create_params.AdditionalMessage]] | NotGiven = NOT_GIVEN,
9931030
instructions: Optional[str] | NotGiven = NOT_GIVEN,
@@ -1018,6 +1055,7 @@ def stream(
10181055
self,
10191056
*,
10201057
assistant_id: str,
1058+
include: List[RunStepInclude] | NotGiven = NOT_GIVEN,
10211059
additional_instructions: Optional[str] | NotGiven = NOT_GIVEN,
10221060
additional_messages: Optional[Iterable[run_create_params.AdditionalMessage]] | NotGiven = NOT_GIVEN,
10231061
instructions: Optional[str] | NotGiven = NOT_GIVEN,
@@ -1057,6 +1095,7 @@ def stream(
10571095
body=maybe_transform(
10581096
{
10591097
"assistant_id": assistant_id,
1098+
"include": include,
10601099
"additional_instructions": additional_instructions,
10611100
"additional_messages": additional_messages,
10621101
"instructions": instructions,
@@ -1387,6 +1426,7 @@ async def create(
13871426
thread_id: str,
13881427
*,
13891428
assistant_id: str,
1429+
include: List[RunStepInclude] | NotGiven = NOT_GIVEN,
13901430
additional_instructions: Optional[str] | NotGiven = NOT_GIVEN,
13911431
additional_messages: Optional[Iterable[run_create_params.AdditionalMessage]] | NotGiven = NOT_GIVEN,
13921432
instructions: Optional[str] | NotGiven = NOT_GIVEN,
@@ -1417,6 +1457,14 @@ async def create(
14171457
[assistant](https://platform.openai.com/docs/api-reference/assistants) to use to
14181458
execute this run.
14191459
1460+
include: A list of additional fields to include in the response. Currently the only
1461+
supported value is `step_details.tool_calls[*].file_search.results[*].content`
1462+
to fetch the file search result content.
1463+
1464+
See the
1465+
[file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search/customizing-file-search-settings)
1466+
for more information.
1467+
14201468
additional_instructions: Appends additional instructions at the end of the instructions for the run. This
14211469
is useful for modifying the behavior on a per-run basis without overriding other
14221470
instructions.
@@ -1519,6 +1567,7 @@ async def create(
15191567
*,
15201568
assistant_id: str,
15211569
stream: Literal[True],
1570+
include: List[RunStepInclude] | NotGiven = NOT_GIVEN,
15221571
additional_instructions: Optional[str] | NotGiven = NOT_GIVEN,
15231572
additional_messages: Optional[Iterable[run_create_params.AdditionalMessage]] | NotGiven = NOT_GIVEN,
15241573
instructions: Optional[str] | NotGiven = NOT_GIVEN,
@@ -1552,6 +1601,14 @@ async def create(
15521601
events, terminating when the Run enters a terminal state with a `data: [DONE]`
15531602
message.
15541603
1604+
include: A list of additional fields to include in the response. Currently the only
1605+
supported value is `step_details.tool_calls[*].file_search.results[*].content`
1606+
to fetch the file search result content.
1607+
1608+
See the
1609+
[file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search/customizing-file-search-settings)
1610+
for more information.
1611+
15551612
additional_instructions: Appends additional instructions at the end of the instructions for the run. This
15561613
is useful for modifying the behavior on a per-run basis without overriding other
15571614
instructions.
@@ -1650,6 +1707,7 @@ async def create(
16501707
*,
16511708
assistant_id: str,
16521709
stream: bool,
1710+
include: List[RunStepInclude] | NotGiven = NOT_GIVEN,
16531711
additional_instructions: Optional[str] | NotGiven = NOT_GIVEN,
16541712
additional_messages: Optional[Iterable[run_create_params.AdditionalMessage]] | NotGiven = NOT_GIVEN,
16551713
instructions: Optional[str] | NotGiven = NOT_GIVEN,
@@ -1683,6 +1741,14 @@ async def create(
16831741
events, terminating when the Run enters a terminal state with a `data: [DONE]`
16841742
message.
16851743
1744+
include: A list of additional fields to include in the response. Currently the only
1745+
supported value is `step_details.tool_calls[*].file_search.results[*].content`
1746+
to fetch the file search result content.
1747+
1748+
See the
1749+
[file search tool documentation](https://platform.openai.com/docs/assistants/tools/file-search/customizing-file-search-settings)
1750+
for more information.
1751+
16861752
additional_instructions: Appends additional instructions at the end of the instructions for the run. This
16871753
is useful for modifying the behavior on a per-run basis without overriding other
16881754
instructions.
@@ -1780,6 +1846,7 @@ async def create(
17801846
thread_id: str,
17811847
*,
17821848
assistant_id: str,
1849+
include: List[RunStepInclude] | NotGiven = NOT_GIVEN,
17831850
additional_instructions: Optional[str] | NotGiven = NOT_GIVEN,
17841851
additional_messages: Optional[Iterable[run_create_params.AdditionalMessage]] | NotGiven = NOT_GIVEN,
17851852
instructions: Optional[str] | NotGiven = NOT_GIVEN,
@@ -1810,6 +1877,7 @@ async def create(
18101877
body=await async_maybe_transform(
18111878
{
18121879
"assistant_id": assistant_id,
1880+
"include": include,
18131881
"additional_instructions": additional_instructions,
18141882
"additional_messages": additional_messages,
18151883
"instructions": instructions,
@@ -1829,7 +1897,11 @@ async def create(
18291897
run_create_params.RunCreateParams,
18301898
),
18311899
options=make_request_options(
1832-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1900+
extra_headers=extra_headers,
1901+
extra_query=extra_query,
1902+
extra_body=extra_body,
1903+
timeout=timeout,
1904+
query=await async_maybe_transform({"include": include}, run_create_params.RunCreateParams),
18331905
),
18341906
cast_to=Run,
18351907
stream=stream or False,
@@ -2025,6 +2097,7 @@ async def create_and_poll(
20252097
self,
20262098
*,
20272099
assistant_id: str,
2100+
include: List[RunStepInclude] | NotGiven = NOT_GIVEN,
20282101
additional_instructions: Optional[str] | NotGiven = NOT_GIVEN,
20292102
additional_messages: Optional[Iterable[run_create_params.AdditionalMessage]] | NotGiven = NOT_GIVEN,
20302103
instructions: Optional[str] | NotGiven = NOT_GIVEN,
@@ -2056,6 +2129,7 @@ async def create_and_poll(
20562129
run = await self.create(
20572130
thread_id=thread_id,
20582131
assistant_id=assistant_id,
2132+
include=include,
20592133
additional_instructions=additional_instructions,
20602134
additional_messages=additional_messages,
20612135
instructions=instructions,
@@ -2303,6 +2377,7 @@ def stream(
23032377
self,
23042378
*,
23052379
assistant_id: str,
2380+
include: List[RunStepInclude] | NotGiven = NOT_GIVEN,
23062381
additional_instructions: Optional[str] | NotGiven = NOT_GIVEN,
23072382
additional_messages: Optional[Iterable[run_create_params.AdditionalMessage]] | NotGiven = NOT_GIVEN,
23082383
instructions: Optional[str] | NotGiven = NOT_GIVEN,
@@ -2333,6 +2408,7 @@ def stream(
23332408
self,
23342409
*,
23352410
assistant_id: str,
2411+
include: List[RunStepInclude] | NotGiven = NOT_GIVEN,
23362412
additional_instructions: Optional[str] | NotGiven = NOT_GIVEN,
23372413
additional_messages: Optional[Iterable[run_create_params.AdditionalMessage]] | NotGiven = NOT_GIVEN,
23382414
instructions: Optional[str] | NotGiven = NOT_GIVEN,
@@ -2374,6 +2450,7 @@ def stream(
23742450
body=maybe_transform(
23752451
{
23762452
"assistant_id": assistant_id,
2453+
"include": include,
23772454
"additional_instructions": additional_instructions,
23782455
"additional_messages": additional_messages,
23792456
"instructions": instructions,

0 commit comments

Comments
 (0)