Skip to content

Commit

Permalink
feat(api): add additional instructions for runs (openai#995)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-bot authored and megamanics committed Aug 14, 2024
1 parent 4b40722 commit e8e21f2
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 7 deletions.
22 changes: 18 additions & 4 deletions src/openai/resources/beta/threads/runs/runs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand Down Expand Up @@ -91,6 +97,7 @@ def create(
body=maybe_transform(
{
"assistant_id": assistant_id,
"additional_instructions": additional_instructions,
"instructions": instructions,
"metadata": metadata,
"model": model,
Expand Down Expand Up @@ -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,
Expand All @@ -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
Expand Down Expand Up @@ -381,6 +394,7 @@ async def create(
body=maybe_transform(
{
"assistant_id": assistant_id,
"additional_instructions": additional_instructions,
"instructions": instructions,
"metadata": metadata,
"model": model,
Expand Down
14 changes: 11 additions & 3 deletions src/openai/types/beta/threads/run_create_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 2 additions & 0 deletions tests/api_resources/beta/threads/test_runs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit e8e21f2

Please sign in to comment.