Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class GoogleGenAIDocumentEmbedder:
def __init__(
self,
*,
api_key: Secret = Secret.from_env_var("GOOGLE_API_KEY"),
api_key: Secret = Secret.from_env_var(["GOOGLE_API_KEY", "GEMINI_API_KEY"]),
model: str = "text-embedding-004",
prefix: str = "",
suffix: str = "",
Expand All @@ -54,8 +54,8 @@ def __init__(

:param api_key:
The Google API key.
You can set it with the environment variable `GOOGLE_API_KEY`, or pass it via this parameter
during initialization.
You can set it with the environment variable `GOOGLE_API_KEY` or `GEMINI_API_KEY`, or pass it via
this parameter during initialization.
:param model:
The name of the model to use for calculating embeddings.
The default model is `text-embedding-ada-002`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class GoogleGenAITextEmbedder:
def __init__(
self,
*,
api_key: Secret = Secret.from_env_var("GOOGLE_API_KEY"),
api_key: Secret = Secret.from_env_var(["GOOGLE_API_KEY", "GEMINI_API_KEY"]),
model: str = "text-embedding-004",
prefix: str = "",
suffix: str = "",
Expand All @@ -50,8 +50,8 @@ def __init__(

:param api_key:
The Google API key.
You can set it with the environment variable `GOOGLE_API_KEY`, or pass it via this parameter
during initialization.
You can set it with the environment variable `GOOGLE_API_KEY` or `GEMINI_API_KEY`, or pass it via
this parameter during initialization.
:param model:
The name of the model to use for calculating embeddings.
The default model is `text-embedding-004`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ def weather_function(city: str):
def __init__(
self,
*,
api_key: Secret = Secret.from_env_var("GOOGLE_API_KEY"),
api_key: Secret = Secret.from_env_var(["GOOGLE_API_KEY", "GEMINI_API_KEY"]),
model: str = "gemini-2.0-flash",
generation_kwargs: Optional[Dict[str, Any]] = None,
safety_settings: Optional[List[Dict[str, Any]]] = None,
Expand All @@ -240,7 +240,7 @@ def __init__(
"""
Initialize a GoogleGenAIChatGenerator instance.

:param api_key: Google API key, defaults to the `GOOGLE_API_KEY` environment variable,
:param api_key: Google API key, defaults to the `GOOGLE_API_KEY` and `GEMINI_API_KEY` environment variables,
see https://ai.google.dev/gemini-api/docs/api-key for more information.
:param model: Name of the model to use (e.g., "gemini-2.0-flash")
:param generation_kwargs: Configuration for generation (temperature, max_tokens, etc.)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def test_to_dict(self, monkeypatch):
"progress_bar": True,
"meta_fields_to_embed": [],
"embedding_separator": "\n",
"api_key": {"type": "env_var", "env_vars": ["GOOGLE_API_KEY"], "strict": True},
"api_key": {"type": "env_var", "env_vars": ["GOOGLE_API_KEY", "GEMINI_API_KEY"], "strict": True},
"config": {"task_type": "SEMANTIC_SIMILARITY"},
},
}
Expand Down
4 changes: 2 additions & 2 deletions integrations/google_genai/tests/test_text_embedder.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def test_to_dict(self, monkeypatch):
assert data == {
"type": "haystack_integrations.components.embedders.google_genai.text_embedder.GoogleGenAITextEmbedder",
"init_parameters": {
"api_key": {"type": "env_var", "env_vars": ["GOOGLE_API_KEY"], "strict": True},
"api_key": {"type": "env_var", "env_vars": ["GOOGLE_API_KEY", "GEMINI_API_KEY"], "strict": True},
"model": "text-embedding-004",
"prefix": "",
"suffix": "",
Expand Down Expand Up @@ -91,7 +91,7 @@ def test_from_dict(self, monkeypatch):
data = {
"type": "haystack_integrations.components.embedders.google_genai.text_embedder.GoogleGenAITextEmbedder",
"init_parameters": {
"api_key": {"type": "env_var", "env_vars": ["GOOGLE_API_KEY"], "strict": True},
"api_key": {"type": "env_var", "env_vars": ["GOOGLE_API_KEY", "GEMINI_API_KEY"], "strict": True},
"model": "text-embedding-004",
"prefix": "",
"suffix": "",
Expand Down
Loading