Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug Assistant] temperature setting not working #1362

Closed
1 task done
ayansengupta17 opened this issue Apr 24, 2024 · 6 comments
Closed
1 task done

[Bug Assistant] temperature setting not working #1362

ayansengupta17 opened this issue Apr 24, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@ayansengupta17
Copy link

ayansengupta17 commented Apr 24, 2024

Confirm this is an issue with the Python library and not an underlying OpenAI API

  • This is an issue with the Python library

Describe the bug

Even if I change temperature for assistant, the response shows temperature is set to 1.0

To Reproduce

Create an assistant and pass a temperature value.

Code snippets

assistant = client.beta.assistants.create(
        name=f"temperature_test_assistant",
        instructions="",
        model=model_name,
        tools=[{"type": "code_interpreter"}],
        temperature=0.2,
        
    )

OS

Linux

Python version

python 3.11

Library version

openai==1.23.3

@ayansengupta17 ayansengupta17 added the bug Something isn't working label Apr 24, 2024
@ayansengupta17
Copy link
Author

ayansengupta17 commented Apr 24, 2024

Update:
It seems the assistants created on the platform has correct temperature, but when I fetch it by client.beta.threads.runs.retrieve() It shows incorrect temperature.

@derekharmon
Copy link

This matches the behavior specified in the API documentation,

temperature number or null
The sampling temperature used for this run. If not set, defaults to 1.

This is problematic because 1 is a valid value within the domain [0,2] of temperature. None | NOT_GIVEN might be better, but could break existing code consuming the run object (i.e., AttributeError: no property with name 'temperature' exists or ValueError 'temperature' is None); if the code hadn't been written to check for None.

There are a few workarounds you may be able to try, although they are inconvenient:

  • When the temperature == 1 then you could use the assistant_id on the run to retrieve the corresponding assistant, and read the correct temperature from there. Otherwise, you know the value of temperature on run must have been set.
  • When creating the run object with create, always pass-in the assistant.temperature as the temperature argument so that it never depends on this default value.
  • Adopt the convention to not use 1 as a temperature in the application; instead use values such as 0.99 or 1.01 that are close enough to 1 for your needs. Then you'll know that if the run has a temperature of 1 then you can treat it as if it had not been set.

@rattrayalex
Copy link
Collaborator

Thanks for the report – I agree this sounds confusing.

This sounds like an issue for the underlying OpenAI API and not the Python library, so I'm going to go ahead and close this issue.

Would you mind reposting at community.openai.com?

@rattrayalex rattrayalex closed this as not planned Won't fix, can't repro, duplicate, stale May 13, 2024
@nknj
Copy link
Member

nknj commented May 13, 2024

Thanks for reporting this and sorry for the trouble -- this is a bug on our end and we'll rollout a fix very soon.

@ayansengupta17
Copy link
Author

@nknj Appreciate the help. @rattrayalex I already posted an initial post on https://community.openai.com/t/bug-or-feature-temperature-setting-in-assistant-v2-confusing/727312 but sadly it got overlooked.

@erinkav-openai
Copy link

So sorry for the bug here! The fix rolled out, please let me know if you see other issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants