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

Override OpenAI temperature #20805

Open
1 task done
Araz-g opened this issue Nov 18, 2024 · 4 comments
Open
1 task done

Override OpenAI temperature #20805

Araz-g opened this issue Nov 18, 2024 · 4 comments
Labels
ai Improvement related to Assistant, Copilot, or other AI features assistant AI feedback for Assistant (inline or panel) enhancement [core label]

Comments

@Araz-g
Copy link

Araz-g commented Nov 18, 2024

Check for existing issues

  • Completed

Describe the feature

Support passing temperature to OpenAI models.

Environment

none

@Araz-g Araz-g changed the title Override OpenAPI temperature Override OpenAI temperature Nov 18, 2024
@notpeter
Copy link
Member

There are a handful of POST request keys which are supported on certain OpenAI models via the v1/chat/completions endpoint:

parameter values default description
temperature 0.0-2.0 1.0 What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or top_p but not both.
top_p 0.0-1.0 1.0 An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or temperature but not both.
presence_penalty -2.0 - 2.0 0 Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics.
metadata {} null Developer-defined tags and values used for filtering completions in the dashboard.
seed integer null The seed controls the reproducibility of the job. Passing in the same seed and job parameters should produce the same results, but may differ in rare cases. If a seed is not specified, one will be generated for you.

Source

Note, for some models, notably o1, it is invalid to provide these explicitly. As a result, and of the configurations should be done via the available_models objects and cannot be done at the provider level.

temperature and top_p are fixed at 1, while presence_penalty and frequency_penalty are fixed at 0.

I'm not sure whether it makes sense to specifically add support for just temperature, a subset or all of these. Maybe it would make sense to add support for an extra object which would be merged with the POST request object. Not sure.

@notpeter notpeter reopened this Nov 18, 2024
@notpeter notpeter added ai Improvement related to Assistant, Copilot, or other AI features assistant AI feedback for Assistant (inline or panel) and removed triage labels Nov 18, 2024
@KhazAkar
Copy link

I'm personally in favor of adding such option to OpenAI, as well as for Ollama. It applies extra, when you use non-default openAI endpoint, like LocalAI, groq or cerebras

@notpeter
Copy link
Member

As reported in:

Some OpenAI API compatible models (deepseek-reasoner) do not support temperature. In supporting customizable temp settings, setting it to null should also prevent it from being included as a parameter altogether.

@amojury
Copy link

amojury commented Feb 6, 2025

Add a parameter: reasoning_effort, which determines whether o3-mini-high, o3-mini-mid, or o3-mini-low, and the differences between them are significant. https://platform.openai.com/docs/guides/reasoning

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ai Improvement related to Assistant, Copilot, or other AI features assistant AI feedback for Assistant (inline or panel) enhancement [core label]
Projects
None yet
Development

No branches or pull requests

4 participants