- Issue created by @dan_metille
- 🇩🇪Germany marcus_johansson
Changing the issue to a feature request and adding the possibility to set timeouts based on fine grained level.
The problem right now is that your guzzle client times out due to global settings, you can fix this similar to how you see here: https://www.jeffgeerling.com/blog/2016/increase-guzzle-http-client-reque.... But this not recommmeded.
- 🇰🇬Kyrgyzstan dan_metille
Thanks Marcus. In the meanwhile, I will give a try to that linked solution in my dev environment.
- Assigned to marcus_johansson
- 🇸🇰Slovakia poker10
When chatting with AI assistant in Drupal CMS (AI recipe), I am unable to get any response and still getting
Error invoking model response: cURL error 28: Operation timed out after 30001 milliseconds with 0 bytes received (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://api.openai.com/v1/chat/completions
This issue seems more serious? The chat only displays
Error, please try again.
which if effectively draining your tokens again and again, but the error is only in watchdog, which could probably be not obvious for an unexperienced site builder to look at first..I disagree this is an error in the guzzle library, because Drupal CMS orchestrate everything and you cannot expect that ambitious site builders will start changing such values.
I am using OpenAI provider. Example prompt which returns the curl error:
List all fields of Basic page content type
- First commit to issue fork.
- 🇺🇸United States phenaproxima Massachusetts
This issue is starting to worry some folks in the Drupal CMS issue queue.
So as a possible workaround, why not make
\Drupal\ai\Base\AiProviderClientBase::create()
support a$configuration['timeout']
value that defaults to a generous 60 seconds, and gets passed to the HTTP client factory service to create the HTTP client? There is no need to override anything in settings.php.I've submitted an MR with exactly this change, and I'm hoping that it can be merged quickly and put into a new 1.0.1 tag that Drupal CMS could use. That should allay some concerns and solidify the inclusion of the AI module in the 1.0.0 release.
- 🇩🇪Germany marcus_johansson
Tested and working against spoof Mockoon API with a timeout of 59 seconds. Will be merged. Thanks @phenaproxima.
- 🇩🇪Germany marcus_johansson
@poker10 - just FYI a follow up issues that might make the UX better when this happens: 📌 Better error handling in the Chatbot Active and ✨ Add Javascript Orchestration for Chatbot/Assistant Active .
- 🇮🇳India abhishek@kumar
- Modify the module's configuration schema in ai_translate.settings.yml:
timeout: type: integer label: 'API Call Timeout' default: 30 # Default timeout in seconds
- Update the cURL request logic to use this configurable timeout value:
$timeout = \Drupal::config('ai_translate.settings')->get('timeout') ?: 30; curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
- Review and replace the deprecated usage of explode() where applicable.
- Example replacement
// Replace this: list($key, $value) = explode(':', $string); // With this: [$key, $value] = explode(':', $string, 2);