minimaxir / simpleaichat

Python package for easily interfacing with chat apps, with robust features and minimal code complexity.
MIT License
3.49k stars 229 forks source link

Calls to ChatGPT may benefit from a timeout #88

Open hedleyroos opened 1 year ago

hedleyroos commented 1 year ago

Calls like https://github.com/minimaxir/simpleaichat/blob/main/simpleaichat/chatgpt.py#L311 may cause us to wait very long for a response. Things go wrong with networks and OpenAI, and the call will only be terminated when the TCP timeout limit is reached and the socket destroyed.

The code already retrieves the OpenAI API key from an env var, so perhaps the same approach can be used for timeouts?