DEV: Use 10s timeout when using the completions API (#19)

This commit is contained in:
Roman Rizzi 2023-03-20 16:43:51 -03:00 committed by GitHub
parent 54a1694637
commit fea9041ee1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -9,8 +9,10 @@ module ::DiscourseAi
"Content-Type" => "application/json",
}
connection_opts = { request: { write_timeout: 10, read_timeout: 10, open_timeout: 10 } }
response =
Faraday.post(
Faraday.new(nil, connection_opts).post(
"https://api.openai.com/v1/chat/completions",
{ model: model, messages: content }.to_json,
headers,