googleapis / googleapis/python-aiplatform

Proxy settings configuration for Vertex AI SDK

Offen
#4,810 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
api: vertex-ai
Vorherrschende Sprache
Python
Sterne
905
Forks
465
Ø Merge
1 T. 13 Std.
Gemergte PRs (30 T.)
44

Beschreibung

Hello !

I'm using the Vertex AI Python SDK with a generative model in my application as follows:

```python
import vertexai
vertexai.init(...)
model = GenerativeModel("...")
generation_config = GenerationConfig("...")
model.generate_content(..., stream=True)
```

I want the `generate_content` method to route its requests through a proxy.

From my research, I found that, with this library, proxies can be configured using the `https_proxy` and `http_proxy` environment variables or programmatically within the Python code, for example:

```python
import os
os.environ["https_proxy"] = "http://my_proxy:8080"
```

However, I would like to know if there is another way to configure a proxy for this call without relying on `os.environ` or setting environment variables.

This is important because modifying `os.environ` or system-level environment variables could unintentionally affect other parts of the application.
I'd appreciate any suggestions on alternative approaches.
Thanks!

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.