From 7bf9b75067905449e83e828c12eb384022cff6ca Mon Sep 17 00:00:00 2001 From: Stainless Bot <107565488+stainless-bot@users.noreply.github.com> Date: Tue, 19 Dec 2023 18:17:29 -0500 Subject: [PATCH] feat(api): add additional instructions for runs (#995) --- .../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 969bfab70..aea3b8cef 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 df92f4fd2..a4f41a933 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 d323dfc35..494cae265 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",