You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In chat.go and completion.go and edits.go temperature and top P are defined with json modifier omitempty:
chat.go: Temperature float32 `json:"temperature,omitempty"`
chat.go: TopP float32 `json:"top_p,omitempty"`
completion.go: Temperature float32 `json:"temperature,omitempty"`
completion.go: TopP float32 `json:"top_p,omitempty"`
edits.go: Temperature float32 `json:"temperature,omitempty"`
edits.go: TopP float32 `json:"top_p,omitempty"`
omitempty applies when the value is 0 and hence no temperature or topP value is set in the output JSON. In the case of chat and completions, the documented default value for temperature and top-p is 1, so someone explicitly setting the value to 0 will instead get the value of 1 applied. However, 0 is actually a valid value for temperature and top-p - these curl commands return success:
curl https://api.openai.com/v1/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-d '{
"model": "gpt-3.5-turbo-instruct",
"prompt": "Say this is a test",
"max_tokens": 7,
"temperature": 0,
"top_p": 0,
}'
In chat.go and completion.go and edits.go temperature and top P are defined with json modifier omitempty:
omitempty applies when the value is 0 and hence no temperature or topP value is set in the output JSON. In the case of chat and completions, the documented default value for temperature and top-p is 1, so someone explicitly setting the value to 0 will instead get the value of 1 applied. However, 0 is actually a valid value for temperature and top-p - these curl commands return success:
and
So 0 is a valid value, even thought there is some debate about how exactly a value of 0 is interpreted:
The text was updated successfully, but these errors were encountered: