Commit 53bca49e

Stainless Bot <107565488+stainless-bot@users.noreply.github.com>
2023-12-20 07:17:29
feat(api): add additional instructions for runs (#995)
1 parent a893a19
Changed files (3)
src
openai
resources
beta
threads
runs
types
tests
api_resources
beta
threads
src/openai/resources/beta/threads/runs/runs.py
@@ -42,6 +42,7 @@ class Runs(SyncAPIResource):
         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 @@ class Runs(SyncAPIResource):
               [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 @@ class Runs(SyncAPIResource):
             body=maybe_transform(
                 {
                     "assistant_id": assistant_id,
+                    "additional_instructions": additional_instructions,
                     "instructions": instructions,
                     "metadata": metadata,
                     "model": model,
@@ -332,6 +339,7 @@ class AsyncRuns(AsyncAPIResource):
         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 @@ class AsyncRuns(AsyncAPIResource):
               [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 @@ class AsyncRuns(AsyncAPIResource):
             body=maybe_transform(
                 {
                     "assistant_id": assistant_id,
+                    "additional_instructions": additional_instructions,
                     "instructions": instructions,
                     "metadata": metadata,
                     "model": model,
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]
tests/api_resources/beta/threads/test_runs.py
@@ -34,6 +34,7 @@ class TestRuns:
         run = client.beta.threads.runs.create(
             "string",
             assistant_id="string",
+            additional_instructions="string",
             instructions="string",
             metadata={},
             model="string",
@@ -180,6 +181,7 @@ class TestAsyncRuns:
         run = await client.beta.threads.runs.create(
             "string",
             assistant_id="string",
+            additional_instructions="string",
             instructions="string",
             metadata={},
             model="string",