googleapis / googleapis/python-aiplatform
Add support for custom headers in vertexai.init function
- 主要言語
- Python
- スター
- 905
- フォーク
- 465
- 平均マージ
- 1日 13時間
- マージ済み PR(30日)
- 44
説明
**Is your feature request related to a problem? Please describe.**
I cannot find option for adding custom headers to VertexAI Gemini API.
**Describe the solution you'd like**
I'm trying to implement proxy between end client and VertexAI Gemini API. In my implementation custom HTTP headers are must have requirement. I would like to ask for adding option to vertexai.init or any other place to add HTTP headers, similar as it is in genai gemini library.
**Describe alternatives you've considered**
Actually there are no alternatives. Headers are must have.
**Additional context**
Example for custom headers in google.generativeai (https://github.com/google/generative-ai-python)
```
import google.generativeai as genai
genai.configure(
api_key="mytoken",
transport="rest",
client_options={
"api_endpoint": "https://my/custom/proxy"
},
default_metadata=tuple(my_headers.items()),
)
```
My proposal for vertexai.init:
```
import vertexai
from vertexai.generative_models import GenerativeModel
vertexai.init(
api_endpoint="https://my/custom/proxy",
api_transport="rest",
default_metadata=tuple(my_headers.items()), # New argument
)
multimodal_model = GenerativeModel("gemini-1.0-pro-vision")
response = multimodal_model.generate_content(
[
"How are you",
]
)
```
コントリビューションガイド
評価
この issue はまだ評価されていません。