google-gemini / generative-ai-python

The official Python library for the Google Gemini API
https://pypi.org/project/google-generativeai/
Apache License 2.0
1.18k stars 223 forks source link

How to use proxy-based proxy clients on google.generativeai #188

Open Blues-star opened 5 months ago

Blues-star commented 5 months ago

Description of the feature request:

In OpenAI's Python SDK, you can implement client-side proxying through the following operation https://github.com/openai/openai-python#configuring-the-http-client

import httpx
from openai import OpenAI

client = OpenAI(
    # Or use the `OPENAI_BASE_URL` env var
    base_url="http://my.test.server.example.com:8083",
    http_client=httpx.Client(
        proxies="http://my.test.proxy.example.com",
        transport=httpx.HTTPTransport(local_address="0.0.0.0"),
    ),
)

I am very curious about how I should implement the above operation in google.generativeai sdk?

What problem are you trying to solve with this feature?

I want to avoid using the system-wide global proxy as much as possible to achieve the above functionality

Any other information you'd like to share?

No response

HawkClaws commented 2 months ago

It is for llamaindex, but I made it. https://github.com/HawkClaws/proxy_gemini

tianlichunhong commented 2 weeks ago

没有找到prox的方法