Runs.create() got an unexpected keyword argument 'additional_instructions'

Trying to add some additional instructions to my assistant call, as I do in the playground:

But I’m getting this error:
TypeError: Runs.create() got an unexpected keyword argument ‘additional_instructions’

This is the code I’m using:

run = client.beta.threads.runs.create(
    thread_id=thread.id,
    assistant_id=assistant.id,
    additional_instructions="Today is 07/March/2024."
)

I’m using the 1.13.3 library, and this parameter should be allowed according to https://platform.openai.com/docs/api-reference/runs/createRun#runs-createrun-additional_instructions

What am I doing wrong? How can I pass these additional instructions to the run?

It seem the library is being an unwanted nanny again, operating outside of the scope of what a developer would want, and “validating” input before it can be sent. In this case, the code does not have the parameter, but it could be added to your local install by editing in a copy of “instructions”.

1 Like

This should work out of the box. Are you sure the correct version of the library is being pulled into your Python environment? Try printing print(openai.__version__) in your code to verify that it is the latest one.

The SDK accepts this parameter here: openai-python/src/openai/types/beta/threads/run_create_params.py at main · openai/openai-python · GitHub

1 Like

Thanks for the correction, where we see the parameter was committed Dec 19, 2023.

Maybe still the library can not be a validation nanny and instead favor forward-compatibility, letting the API itself deny…

Thanks @atty-openai , fixed by reconciliating the different versions through the different environments.

Found out that the output of
print(importlib.metadata.version(‘openai’))
and
print(openai.version)
can be different.

Working fine with the current 1.13.3 version.