- Issue created by @olegiv
- 🇱🇹Lithuania mindaugasd
Hi @olegiv,
based on "Steps to reproduce" - proxy should already work if it is configured.
Observe that the setup fails because the test request is not routed through the configured proxy.
How did you configure it?
Here I pushed a code change which plugged Drupal HTTP client to OpenAI library.
- https://www.drupal.org/project/ai/issues/3453589#comment-15641623 📌 OpenAI LLM Provider Active
- https://git.drupalcode.org/project/ai/-/merge_requests/1/diffs?commit_id...
So that middleware could be used, which enables change or log anything about HTTP request.
So with OpenAI you can already setup proxy by writing some middleware code:
* https://docs.guzzlephp.org/en/stable/request-options.html#proxyOr setup in other way (depending how you did it), maybe some modules exists for that?
BUT for all other providers (Anthropic etc.) you have to study case by case how the request is made in code, and if it does not use Drupal HTTP client, change to use it if possible (maybe push merge request like I did). Let me know what you find.
- 🇱🇹Lithuania mindaugasd
If you really configured proxy, another thing to try -> turn off streaming feature.
Streaming may not be supported by proxy.
It is limitation of guzzle and/or PHP.
- 🇱🇹Lithuania mindaugasd
By default guzzle use https://curl.se/, but for streaming it use PHP native streaming wrappers https://www.php.net/manual/en/wrappers.php, which has limited functionality and proxied requests, AI just said to me, it is not supported.
Example issue on Github: https://github.com/guzzle/guzzle/issues/2616 - 🇱🇹Lithuania mindaugasd
Or maybe it does support, proxy is listed as configuration option https://www.php.net/manual/en/context.http.php