mscraftsman / generative-ai

Gemini AI SDK for .NET and ASP.NET Core enables developers to use Google's state-of-the-art generative AI models to build AI-powered features and applications.
https://mscraftsman.github.io/generative-ai/
Apache License 2.0
55 stars 11 forks source link

Can support custom httpproxy? #40

Open DummyAppTest opened 1 month ago

DummyAppTest commented 1 month ago

Can support custom httpproxy?

jochenkirstaetter commented 1 month ago

Hello @DummyAppTest

Thanks for the question. Not yet. I'm using SocketsHttpHandler in .NET compared to the HttpClientHandler in .NET Framework.

I'll add this to the roadmap.

Cheers, JoKi

jochenkirstaetter commented 1 month ago

Hello @DummyAppTest

After looking further into this. I found that the SocketsHttpHandler could use a proxy by default. See here: https://github.com/dotnet/runtime/blob/6221ddb3051463309801c9008f332b34361da798/src/libraries/Common/src/System/Net/Http/HttpHandlerDefaults.cs#L24

The current implementation of the SDK does not set any value, hence the default behaviour applies. You should be able to specify proxy settings using the default mechanism to read proxy information from the settings file.

Anyway, I'll keep this on my roadmap, and see how a Proxy property could be exposed publicly.

Cheers, JoKi