langchain-google-genai 0.0.11__tar.gz → 1.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of langchain-google-genai might be problematic. Click here for more details.
- {langchain_google_genai-0.0.11 → langchain_google_genai-1.0.1}/PKG-INFO +1 -1
- {langchain_google_genai-0.0.11 → langchain_google_genai-1.0.1}/langchain_google_genai/chat_models.py +17 -10
- {langchain_google_genai-0.0.11 → langchain_google_genai-1.0.1}/langchain_google_genai/embeddings.py +26 -12
- {langchain_google_genai-0.0.11 → langchain_google_genai-1.0.1}/langchain_google_genai/llms.py +22 -12
- {langchain_google_genai-0.0.11 → langchain_google_genai-1.0.1}/pyproject.toml +1 -1
- {langchain_google_genai-0.0.11 → langchain_google_genai-1.0.1}/LICENSE +0 -0
- {langchain_google_genai-0.0.11 → langchain_google_genai-1.0.1}/README.md +0 -0
- {langchain_google_genai-0.0.11 → langchain_google_genai-1.0.1}/langchain_google_genai/__init__.py +0 -0
- {langchain_google_genai-0.0.11 → langchain_google_genai-1.0.1}/langchain_google_genai/_common.py +0 -0
- {langchain_google_genai-0.0.11 → langchain_google_genai-1.0.1}/langchain_google_genai/_enums.py +0 -0
- {langchain_google_genai-0.0.11 → langchain_google_genai-1.0.1}/langchain_google_genai/_function_utils.py +0 -0
- {langchain_google_genai-0.0.11 → langchain_google_genai-1.0.1}/langchain_google_genai/_genai_extension.py +0 -0
- {langchain_google_genai-0.0.11 → langchain_google_genai-1.0.1}/langchain_google_genai/genai_aqa.py +0 -0
- {langchain_google_genai-0.0.11 → langchain_google_genai-1.0.1}/langchain_google_genai/google_vector_store.py +0 -0
- {langchain_google_genai-0.0.11 → langchain_google_genai-1.0.1}/langchain_google_genai/py.typed +0 -0
{langchain_google_genai-0.0.11 → langchain_google_genai-1.0.1}/langchain_google_genai/chat_models.py
RENAMED
|
@@ -483,17 +483,24 @@ class ChatGoogleGenerativeAI(_BaseGoogleGenerativeAI, BaseChatModel):
|
|
|
483
483
|
@root_validator()
|
|
484
484
|
def validate_environment(cls, values: Dict) -> Dict:
|
|
485
485
|
"""Validates params and passes them to google-generativeai package."""
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
486
|
+
if values.get("credentials"):
|
|
487
|
+
genai.configure(
|
|
488
|
+
credentials=values.get("credentials"),
|
|
489
|
+
transport=values.get("transport"),
|
|
490
|
+
client_options=values.get("client_options"),
|
|
491
|
+
)
|
|
492
|
+
else:
|
|
493
|
+
google_api_key = get_from_dict_or_env(
|
|
494
|
+
values, "google_api_key", "GOOGLE_API_KEY"
|
|
495
|
+
)
|
|
496
|
+
if isinstance(google_api_key, SecretStr):
|
|
497
|
+
google_api_key = google_api_key.get_secret_value()
|
|
491
498
|
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
499
|
+
genai.configure(
|
|
500
|
+
api_key=google_api_key,
|
|
501
|
+
transport=values.get("transport"),
|
|
502
|
+
client_options=values.get("client_options"),
|
|
503
|
+
)
|
|
497
504
|
if (
|
|
498
505
|
values.get("temperature") is not None
|
|
499
506
|
and not 0 <= values["temperature"] <= 1
|
{langchain_google_genai-0.0.11 → langchain_google_genai-1.0.1}/langchain_google_genai/embeddings.py
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing import Dict, List, Optional
|
|
1
|
+
from typing import Any, Dict, List, Optional
|
|
2
2
|
|
|
3
3
|
# TODO: remove ignore once the google package is published with types
|
|
4
4
|
import google.generativeai as genai # type: ignore[import]
|
|
@@ -43,6 +43,13 @@ class GoogleGenerativeAIEmbeddings(BaseModel, Embeddings):
|
|
|
43
43
|
description="The Google API key to use. If not provided, "
|
|
44
44
|
"the GOOGLE_API_KEY environment variable will be used.",
|
|
45
45
|
)
|
|
46
|
+
credentials: Any = Field(
|
|
47
|
+
default=None,
|
|
48
|
+
exclude=True,
|
|
49
|
+
description="The default custom credentials "
|
|
50
|
+
"(google.auth.credentials.Credentials) to use when making API calls. If not "
|
|
51
|
+
"provided, credentials will be ascertained from the GOOGLE_API_KEY envvar",
|
|
52
|
+
)
|
|
46
53
|
client_options: Optional[Dict] = Field(
|
|
47
54
|
None,
|
|
48
55
|
description=(
|
|
@@ -58,17 +65,24 @@ class GoogleGenerativeAIEmbeddings(BaseModel, Embeddings):
|
|
|
58
65
|
@root_validator()
|
|
59
66
|
def validate_environment(cls, values: Dict) -> Dict:
|
|
60
67
|
"""Validates params and passes them to google-generativeai package."""
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
68
|
+
if values.get("credentials"):
|
|
69
|
+
genai.configure(
|
|
70
|
+
credentials=values.get("credentials"),
|
|
71
|
+
transport=values.get("transport"),
|
|
72
|
+
client_options=values.get("client_options"),
|
|
73
|
+
)
|
|
74
|
+
else:
|
|
75
|
+
google_api_key = get_from_dict_or_env(
|
|
76
|
+
values, "google_api_key", "GOOGLE_API_KEY"
|
|
77
|
+
)
|
|
78
|
+
if isinstance(google_api_key, SecretStr):
|
|
79
|
+
google_api_key = google_api_key.get_secret_value()
|
|
80
|
+
|
|
81
|
+
genai.configure(
|
|
82
|
+
api_key=google_api_key,
|
|
83
|
+
transport=values.get("transport"),
|
|
84
|
+
client_options=values.get("client_options"),
|
|
85
|
+
)
|
|
72
86
|
return values
|
|
73
87
|
|
|
74
88
|
def _embed(
|
{langchain_google_genai-0.0.11 → langchain_google_genai-1.0.1}/langchain_google_genai/llms.py
RENAMED
|
@@ -122,6 +122,10 @@ Supported examples:
|
|
|
122
122
|
)
|
|
123
123
|
"""Model name to use."""
|
|
124
124
|
google_api_key: Optional[SecretStr] = None
|
|
125
|
+
credentials: Any = None
|
|
126
|
+
"The default custom credentials (google.auth.credentials.Credentials) to use "
|
|
127
|
+
"when making API calls. If not provided, credentials will be ascertained from "
|
|
128
|
+
"the GOOGLE_API_KEY envvar"
|
|
125
129
|
temperature: float = 0.7
|
|
126
130
|
"""Run inference with this temperature. Must by in the closed interval
|
|
127
131
|
[0.0, 1.0]."""
|
|
@@ -203,22 +207,28 @@ class GoogleGenerativeAI(_BaseGoogleGenerativeAI, BaseLLM):
|
|
|
203
207
|
@root_validator()
|
|
204
208
|
def validate_environment(cls, values: Dict) -> Dict:
|
|
205
209
|
"""Validates params and passes them to google-generativeai package."""
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
210
|
+
if values.get("credentials"):
|
|
211
|
+
genai.configure(
|
|
212
|
+
credentials=values.get("credentials"),
|
|
213
|
+
transport=values.get("transport"),
|
|
214
|
+
client_options=values.get("client_options"),
|
|
215
|
+
)
|
|
216
|
+
else:
|
|
217
|
+
google_api_key = get_from_dict_or_env(
|
|
218
|
+
values, "google_api_key", "GOOGLE_API_KEY"
|
|
219
|
+
)
|
|
220
|
+
if isinstance(google_api_key, SecretStr):
|
|
221
|
+
google_api_key = google_api_key.get_secret_value()
|
|
222
|
+
genai.configure(
|
|
223
|
+
api_key=google_api_key,
|
|
224
|
+
transport=values.get("transport"),
|
|
225
|
+
client_options=values.get("client_options"),
|
|
226
|
+
)
|
|
227
|
+
|
|
209
228
|
model_name = values["model"]
|
|
210
229
|
|
|
211
230
|
safety_settings = values["safety_settings"]
|
|
212
231
|
|
|
213
|
-
if isinstance(google_api_key, SecretStr):
|
|
214
|
-
google_api_key = google_api_key.get_secret_value()
|
|
215
|
-
|
|
216
|
-
genai.configure(
|
|
217
|
-
api_key=google_api_key,
|
|
218
|
-
transport=values.get("transport"),
|
|
219
|
-
client_options=values.get("client_options"),
|
|
220
|
-
)
|
|
221
|
-
|
|
222
232
|
if safety_settings and (
|
|
223
233
|
not GoogleModelFamily(model_name) == GoogleModelFamily.GEMINI
|
|
224
234
|
):
|
|
File without changes
|
|
File without changes
|
{langchain_google_genai-0.0.11 → langchain_google_genai-1.0.1}/langchain_google_genai/__init__.py
RENAMED
|
File without changes
|
{langchain_google_genai-0.0.11 → langchain_google_genai-1.0.1}/langchain_google_genai/_common.py
RENAMED
|
File without changes
|
{langchain_google_genai-0.0.11 → langchain_google_genai-1.0.1}/langchain_google_genai/_enums.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{langchain_google_genai-0.0.11 → langchain_google_genai-1.0.1}/langchain_google_genai/genai_aqa.py
RENAMED
|
File without changes
|
|
File without changes
|
{langchain_google_genai-0.0.11 → langchain_google_genai-1.0.1}/langchain_google_genai/py.typed
RENAMED
|
File without changes
|