OpenAISwift icon indicating copy to clipboard operation
OpenAISwift copied to clipboard

The cause of 'The request timed out.' error

Open bluepixeltech opened this issue 2 years ago • 3 comments

Hi, thanks for great library! I am wondering if there's a way to deal with 'The request timed out.' error which happens after a period of inactivity. Or is there a way to deactivate it?

bluepixeltech avatar Apr 10 '23 16:04 bluepixeltech

+1 on this. I tried to extend the timeout on the URL session but it still happens.

        // Create a URLSessionConfiguration with a custom timeout because GPT takes a while
        let configuration = URLSessionConfiguration.default
        configuration.timeoutIntervalForRequest = 360 // Timeout in seconds
        // Create a URLSession with the custom configuration
        let customSession = URLSession(configuration: configuration)
        let sessionConfig = OpenAISwift.Config(session: customSession)

elprl avatar Apr 11 '23 13:04 elprl

Unlike this solution does not work for large requests on MacOS for me :( I will be investigating this problem anyway.

zSOLz avatar Apr 15 '23 19:04 zSOLz

It appears to be using the default timeout of 60s, which is far too short for more complex completions.

jscalo avatar May 16 '23 02:05 jscalo