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
Workaround openai issue with temperature: 0 being omitted from request
This PR adds a workaround for [this GitHub discussion][gh], describing
how chat completion requests which explicitly set temperature = 0 are
marshalled to JSON incorrectly (due to the 0 being indistinguishable
from the zero value of the field).
To do so we add a custom unmarshal method which checks whether the field
was defined and set to zero, and explicitly set the temperature to
`math.SmallestNonzeroFloat32` in such cases. This isn't perfect but is
likely to get very similar results in practice.
[gh]: sashabaranov/go-openai#9 (comment)
0 commit comments