From 4111a74094a91c2e349838a69c2c4e61610b7520 Mon Sep 17 00:00:00 2001 From: ChihYu Yeh Date: Wed, 2 Oct 2024 16:09:03 +0800 Subject: [PATCH] leave comment for vertex ai model support --- wren-ai-service/src/providers/llm/openai.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/wren-ai-service/src/providers/llm/openai.py b/wren-ai-service/src/providers/llm/openai.py index 0bc0b3d67..0b1978926 100644 --- a/wren-ai-service/src/providers/llm/openai.py +++ b/wren-ai-service/src/providers/llm/openai.py @@ -60,6 +60,9 @@ def __init__( ) # check if the model is actually Vertex AI model + # currently we support Vertex AI through openai api compatible way + # in the near future, we might use litellm instead, so we can more easily support different kinds of llm providers + # this is workaround as of now self._vertexai_creds = None if model.startswith("google/"): self._vertexai_creds, _ = google.auth.default( @@ -67,7 +70,7 @@ def __init__( ) def __getattr__(self, name: str) -> Any: - # dealing with auto-refreshing expired credential + # dealing with auto-refreshing expired credential for Vertex AI model # https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/call-vertex-using-openai-library#refresh_your_credentials if self._vertexai_creds and not self._vertexai_creds.valid: auth_req = google.auth.transport.requests.Request()