When calling the chat method, the parameters used when calling it are being altered, specifically the parameters[:stream] entry:
parameters = {
model: "gpt-3.5-turbo", # Required.
messages: [{ role: "user", content: "Describe a character called Anna!"}], # Required.
temperature: 0.7,
stream: proc do |chunk, _bytesize|
print chunk.dig("choices", 0, "delta", "content")
end
}
client.chat(parameters: parameters)
puts parameters[:stream]
# true
This can cause bugs as parameters should remain unchanged, we noticed it when we tried retrying the request on some OpenAi network failures, we called the method again with the same parameters and noticed streaming wouldn't work then.
Impact: This change does not affect the external behavior of the chat method but ensures parameter integrity across multiple calls.
This PR was made in collaboration with @vickymadrid03 and @nicastelo 👏
Description:
When calling the
chat
method, the parameters used when calling it are being altered, specifically the parameters[:stream] entry:This can cause bugs as parameters should remain unchanged, we noticed it when we tried retrying the request on some OpenAi network failures, we called the method again with the same parameters and noticed streaming wouldn't work then.
Impact: This change does not affect the external behavior of the chat method but ensures parameter integrity across multiple calls.
This PR was made in collaboration with @vickymadrid03 and @nicastelo 👏