From 645b714352323ba28e334cf645aa53b8ac89f460 Mon Sep 17 00:00:00 2001 From: Stainless Bot Date: Tue, 19 Dec 2023 23:17:25 +0000 Subject: [PATCH] feat(api): add additional instructions for runs --- .../resources/beta/threads/runs/runs.py | 22 +++++++++++++++---- .../types/beta/threads/run_create_params.py | 14 +++++++++--- tests/api_resources/beta/threads/test_runs.py | 2 ++ 3 files changed, 31 insertions(+), 7 deletions(-) diff --git a/src/openai/resources/beta/threads/runs/runs.py b/src/openai/resources/beta/threads/runs/runs.py index 969bfab70a..aea3b8cefc 100644 --- a/src/openai/resources/beta/threads/runs/runs.py +++ b/src/openai/resources/beta/threads/runs/runs.py @@ -42,6 +42,7 @@ def create( thread_id: str, *, assistant_id: str, + additional_instructions: Optional[str] | NotGiven = NOT_GIVEN, instructions: Optional[str] | NotGiven = NOT_GIVEN, metadata: Optional[object] | NotGiven = NOT_GIVEN, model: Optional[str] | NotGiven = NOT_GIVEN, @@ -61,8 +62,13 @@ def create( [assistant](https://platform.openai.com/docs/api-reference/assistants) to use to execute this run. - instructions: Override the default system message of the assistant. This is useful for - modifying the behavior on a per-run basis. + additional_instructions: Appends additional instructions at the end of the instructions for the run. This + is useful for modifying the behavior on a per-run basis without overriding other + instructions. + + instructions: Overrides the + [instructions](https://platform.openai.com/docs/api-reference/assistants/createAssistant) + of the assistant. This is useful for modifying the behavior on a per-run basis. metadata: Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys @@ -91,6 +97,7 @@ def create( body=maybe_transform( { "assistant_id": assistant_id, + "additional_instructions": additional_instructions, "instructions": instructions, "metadata": metadata, "model": model, @@ -332,6 +339,7 @@ async def create( thread_id: str, *, assistant_id: str, + additional_instructions: Optional[str] | NotGiven = NOT_GIVEN, instructions: Optional[str] | NotGiven = NOT_GIVEN, metadata: Optional[object] | NotGiven = NOT_GIVEN, model: Optional[str] | NotGiven = NOT_GIVEN, @@ -351,8 +359,13 @@ async def create( [assistant](https://platform.openai.com/docs/api-reference/assistants) to use to execute this run. - instructions: Override the default system message of the assistant. This is useful for - modifying the behavior on a per-run basis. + additional_instructions: Appends additional instructions at the end of the instructions for the run. This + is useful for modifying the behavior on a per-run basis without overriding other + instructions. + + instructions: Overrides the + [instructions](https://platform.openai.com/docs/api-reference/assistants/createAssistant) + of the assistant. This is useful for modifying the behavior on a per-run basis. metadata: Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys @@ -381,6 +394,7 @@ async def create( body=maybe_transform( { "assistant_id": assistant_id, + "additional_instructions": additional_instructions, "instructions": instructions, "metadata": metadata, "model": model, diff --git a/src/openai/types/beta/threads/run_create_params.py b/src/openai/types/beta/threads/run_create_params.py index df92f4fd2c..a4f41a9338 100644 --- a/src/openai/types/beta/threads/run_create_params.py +++ b/src/openai/types/beta/threads/run_create_params.py @@ -24,10 +24,18 @@ class RunCreateParams(TypedDict, total=False): execute this run. """ - instructions: Optional[str] - """Override the default system message of the assistant. + additional_instructions: Optional[str] + """Appends additional instructions at the end of the instructions for the run. - This is useful for modifying the behavior on a per-run basis. + This is useful for modifying the behavior on a per-run basis without overriding + other instructions. + """ + + instructions: Optional[str] + """ + Overrides the + [instructions](https://platform.openai.com/docs/api-reference/assistants/createAssistant) + of the assistant. This is useful for modifying the behavior on a per-run basis. """ metadata: Optional[object] diff --git a/tests/api_resources/beta/threads/test_runs.py b/tests/api_resources/beta/threads/test_runs.py index d323dfc354..494cae2656 100644 --- a/tests/api_resources/beta/threads/test_runs.py +++ b/tests/api_resources/beta/threads/test_runs.py @@ -34,6 +34,7 @@ def test_method_create_with_all_params(self, client: OpenAI) -> None: run = client.beta.threads.runs.create( "string", assistant_id="string", + additional_instructions="string", instructions="string", metadata={}, model="string", @@ -180,6 +181,7 @@ async def test_method_create_with_all_params(self, client: AsyncOpenAI) -> None: run = await client.beta.threads.runs.create( "string", assistant_id="string", + additional_instructions="string", instructions="string", metadata={}, model="string",