Skip to content

Commit e8e21f2

Browse files
stainless-botmegamanics
authored andcommitted
feat(api): add additional instructions for runs (openai#995)
1 parent 4b40722 commit e8e21f2

File tree

3 files changed

+31
-7
lines changed

3 files changed

+31
-7
lines changed

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

+18-4
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ def create(
4242
thread_id: str,
4343
*,
4444
assistant_id: str,
45+
additional_instructions: Optional[str] | NotGiven = NOT_GIVEN,
4546
instructions: Optional[str] | NotGiven = NOT_GIVEN,
4647
metadata: Optional[object] | NotGiven = NOT_GIVEN,
4748
model: Optional[str] | NotGiven = NOT_GIVEN,
@@ -61,8 +62,13 @@ def create(
6162
[assistant](https://platform.openai.com/docs/api-reference/assistants) to use to
6263
execute this run.
6364
64-
instructions: Override the default system message of the assistant. This is useful for
65-
modifying the behavior on a per-run basis.
65+
additional_instructions: Appends additional instructions at the end of the instructions for the run. This
66+
is useful for modifying the behavior on a per-run basis without overriding other
67+
instructions.
68+
69+
instructions: Overrides the
70+
[instructions](https://platform.openai.com/docs/api-reference/assistants/createAssistant)
71+
of the assistant. This is useful for modifying the behavior on a per-run basis.
6672
6773
metadata: Set of 16 key-value pairs that can be attached to an object. This can be useful
6874
for storing additional information about the object in a structured format. Keys
@@ -91,6 +97,7 @@ def create(
9197
body=maybe_transform(
9298
{
9399
"assistant_id": assistant_id,
100+
"additional_instructions": additional_instructions,
94101
"instructions": instructions,
95102
"metadata": metadata,
96103
"model": model,
@@ -332,6 +339,7 @@ async def create(
332339
thread_id: str,
333340
*,
334341
assistant_id: str,
342+
additional_instructions: Optional[str] | NotGiven = NOT_GIVEN,
335343
instructions: Optional[str] | NotGiven = NOT_GIVEN,
336344
metadata: Optional[object] | NotGiven = NOT_GIVEN,
337345
model: Optional[str] | NotGiven = NOT_GIVEN,
@@ -351,8 +359,13 @@ async def create(
351359
[assistant](https://platform.openai.com/docs/api-reference/assistants) to use to
352360
execute this run.
353361
354-
instructions: Override the default system message of the assistant. This is useful for
355-
modifying the behavior on a per-run basis.
362+
additional_instructions: Appends additional instructions at the end of the instructions for the run. This
363+
is useful for modifying the behavior on a per-run basis without overriding other
364+
instructions.
365+
366+
instructions: Overrides the
367+
[instructions](https://platform.openai.com/docs/api-reference/assistants/createAssistant)
368+
of the assistant. This is useful for modifying the behavior on a per-run basis.
356369
357370
metadata: Set of 16 key-value pairs that can be attached to an object. This can be useful
358371
for storing additional information about the object in a structured format. Keys
@@ -381,6 +394,7 @@ async def create(
381394
body=maybe_transform(
382395
{
383396
"assistant_id": assistant_id,
397+
"additional_instructions": additional_instructions,
384398
"instructions": instructions,
385399
"metadata": metadata,
386400
"model": model,

src/openai/types/beta/threads/run_create_params.py

+11-3
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,18 @@ class RunCreateParams(TypedDict, total=False):
2424
execute this run.
2525
"""
2626

27-
instructions: Optional[str]
28-
"""Override the default system message of the assistant.
27+
additional_instructions: Optional[str]
28+
"""Appends additional instructions at the end of the instructions for the run.
2929
30-
This is useful for modifying the behavior on a per-run basis.
30+
This is useful for modifying the behavior on a per-run basis without overriding
31+
other instructions.
32+
"""
33+
34+
instructions: Optional[str]
35+
"""
36+
Overrides the
37+
[instructions](https://platform.openai.com/docs/api-reference/assistants/createAssistant)
38+
of the assistant. This is useful for modifying the behavior on a per-run basis.
3139
"""
3240

3341
metadata: Optional[object]

tests/api_resources/beta/threads/test_runs.py

+2
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ def test_method_create_with_all_params(self, client: OpenAI) -> None:
3434
run = client.beta.threads.runs.create(
3535
"string",
3636
assistant_id="string",
37+
additional_instructions="string",
3738
instructions="string",
3839
metadata={},
3940
model="string",
@@ -180,6 +181,7 @@ async def test_method_create_with_all_params(self, client: AsyncOpenAI) -> None:
180181
run = await client.beta.threads.runs.create(
181182
"string",
182183
assistant_id="string",
184+
additional_instructions="string",
183185
instructions="string",
184186
metadata={},
185187
model="string",

0 commit comments

Comments
 (0)