langchain-google-genai 2.0.6__py3-none-any.whl → 2.0.8__py3-none-any.whl
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/_function_utils.py +20 -6
- langchain_google_genai/chat_models.py +11 -4
- langchain_google_genai/embeddings.py +3 -3
- {langchain_google_genai-2.0.6.dist-info → langchain_google_genai-2.0.8.dist-info}/METADATA +2 -2
- {langchain_google_genai-2.0.6.dist-info → langchain_google_genai-2.0.8.dist-info}/RECORD +7 -7
- {langchain_google_genai-2.0.6.dist-info → langchain_google_genai-2.0.8.dist-info}/LICENSE +0 -0
- {langchain_google_genai-2.0.6.dist-info → langchain_google_genai-2.0.8.dist-info}/WHEEL +0 -0
|
@@ -315,10 +315,26 @@ def _get_properties_from_schema(schema: Dict) -> Dict[str, Any]:
|
|
|
315
315
|
if properties_item.get("type_") == glm.Type.ARRAY and v.get("items"):
|
|
316
316
|
properties_item["items"] = _get_items_from_schema_any(v.get("items"))
|
|
317
317
|
|
|
318
|
-
if properties_item.get("type_") == glm.Type.OBJECT
|
|
319
|
-
|
|
320
|
-
v.get("
|
|
321
|
-
|
|
318
|
+
if properties_item.get("type_") == glm.Type.OBJECT:
|
|
319
|
+
if (
|
|
320
|
+
v.get("anyOf")
|
|
321
|
+
and isinstance(v["anyOf"], list)
|
|
322
|
+
and isinstance(v["anyOf"][0], dict)
|
|
323
|
+
):
|
|
324
|
+
v = v["anyOf"][0]
|
|
325
|
+
v_properties = v.get("properties")
|
|
326
|
+
if v_properties:
|
|
327
|
+
properties_item["properties"] = _get_properties_from_schema_any(
|
|
328
|
+
v_properties
|
|
329
|
+
)
|
|
330
|
+
if isinstance(v_properties, dict):
|
|
331
|
+
properties_item["required"] = [
|
|
332
|
+
k for k, v in v_properties.items() if "default" not in v
|
|
333
|
+
]
|
|
334
|
+
else:
|
|
335
|
+
# Providing dummy type for object without properties
|
|
336
|
+
properties_item["type_"] = glm.Type.STRING
|
|
337
|
+
|
|
322
338
|
if k == "title" and "description" not in properties_item:
|
|
323
339
|
properties_item["description"] = k + " is " + str(v)
|
|
324
340
|
|
|
@@ -342,8 +358,6 @@ def _get_items_from_schema(schema: Union[Dict, List, str]) -> Dict[str, Any]:
|
|
|
342
358
|
items["type_"] = _get_type_from_schema(schema)
|
|
343
359
|
if items["type_"] == glm.Type.OBJECT and "properties" in schema:
|
|
344
360
|
items["properties"] = _get_properties_from_schema_any(schema["properties"])
|
|
345
|
-
if "title" in schema:
|
|
346
|
-
items["title"] = schema
|
|
347
361
|
if "title" in schema or "description" in schema:
|
|
348
362
|
items["description"] = (
|
|
349
363
|
schema.get("description") or schema.get("title") or ""
|
|
@@ -419,6 +419,9 @@ def _parse_response_candidate(
|
|
|
419
419
|
for part in response_candidate.content.parts:
|
|
420
420
|
try:
|
|
421
421
|
text: Optional[str] = part.text
|
|
422
|
+
# Remove erroneous newline character if present
|
|
423
|
+
if text is not None:
|
|
424
|
+
text = text.rstrip("\n")
|
|
422
425
|
except AttributeError:
|
|
423
426
|
text = None
|
|
424
427
|
|
|
@@ -579,9 +582,9 @@ class ChatGoogleGenerativeAI(_BaseGoogleGenerativeAI, BaseChatModel):
|
|
|
579
582
|
Instantiation:
|
|
580
583
|
To use, you must have either:
|
|
581
584
|
|
|
582
|
-
1. The ``GOOGLE_API_KEY
|
|
583
|
-
2. Pass your API key using the google_api_key kwarg
|
|
584
|
-
|
|
585
|
+
1. The ``GOOGLE_API_KEY`` environment variable set with your API key, or
|
|
586
|
+
2. Pass your API key using the google_api_key kwarg
|
|
587
|
+
to the ChatGoogleGenerativeAI constructor.
|
|
585
588
|
|
|
586
589
|
.. code-block:: python
|
|
587
590
|
|
|
@@ -1374,7 +1377,11 @@ class ChatGoogleGenerativeAI(_BaseGoogleGenerativeAI, BaseChatModel):
|
|
|
1374
1377
|
|
|
1375
1378
|
@property
|
|
1376
1379
|
def _supports_tool_choice(self) -> bool:
|
|
1377
|
-
return
|
|
1380
|
+
return (
|
|
1381
|
+
"gemini-1.5-pro" in self.model
|
|
1382
|
+
or "gemini-1.5-flash" in self.model
|
|
1383
|
+
or "gemini-2" in self.model
|
|
1384
|
+
)
|
|
1378
1385
|
|
|
1379
1386
|
|
|
1380
1387
|
def _get_tool_name(
|
|
@@ -27,9 +27,9 @@ class GoogleGenerativeAIEmbeddings(BaseModel, Embeddings):
|
|
|
27
27
|
|
|
28
28
|
To use, you must have either:
|
|
29
29
|
|
|
30
|
-
1. The ``GOOGLE_API_KEY
|
|
31
|
-
2. Pass your API key using the google_api_key kwarg
|
|
32
|
-
|
|
30
|
+
1. The ``GOOGLE_API_KEY`` environment variable set with your API key, or
|
|
31
|
+
2. Pass your API key using the google_api_key kwarg
|
|
32
|
+
to the GoogleGenerativeAIEmbeddings constructor.
|
|
33
33
|
|
|
34
34
|
Example:
|
|
35
35
|
.. code-block:: python
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: langchain-google-genai
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.8
|
|
4
4
|
Summary: An integration package connecting Google's genai package and LangChain
|
|
5
5
|
Home-page: https://github.com/langchain-ai/langchain-google
|
|
6
6
|
License: MIT
|
|
@@ -13,7 +13,7 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.12
|
|
14
14
|
Requires-Dist: filetype (>=1.2.0,<2.0.0)
|
|
15
15
|
Requires-Dist: google-generativeai (>=0.8.0,<0.9.0)
|
|
16
|
-
Requires-Dist: langchain-core (>=0.3.
|
|
16
|
+
Requires-Dist: langchain-core (>=0.3.27,<0.4.0)
|
|
17
17
|
Requires-Dist: pydantic (>=2,<3)
|
|
18
18
|
Project-URL: Repository, https://github.com/langchain-ai/langchain-google
|
|
19
19
|
Project-URL: Source Code, https://github.com/langchain-ai/langchain-google/tree/main/libs/genai
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
langchain_google_genai/__init__.py,sha256=Oji-S2KYWrku1wyQEskY84IOfY8MfRhujjJ4d7hbsk4,2758
|
|
2
2
|
langchain_google_genai/_common.py,sha256=ASlwE8hEbvOm55BVF_D4rf2nl7RYsnpsi5xbM6DW3Cc,1576
|
|
3
3
|
langchain_google_genai/_enums.py,sha256=KLPmxS1K83K4HjBIXFaXoL_sFEOv8Hq-2B2PDMKyDgo,197
|
|
4
|
-
langchain_google_genai/_function_utils.py,sha256=
|
|
4
|
+
langchain_google_genai/_function_utils.py,sha256=xcUwX2DmGM4UwH7bhBC6W9E5oVAE8k_l9lMYzJUJwA0,17433
|
|
5
5
|
langchain_google_genai/_genai_extension.py,sha256=81a4ly5ZHlqMf37uJfdB8K41qE6J5ujLnbUypIfFf2o,20775
|
|
6
6
|
langchain_google_genai/_image_utils.py,sha256=tPrQyMvVmO8xkuow1SvA91omxUEv9ZUy1EMHNGjMAKY,5202
|
|
7
|
-
langchain_google_genai/chat_models.py,sha256=
|
|
8
|
-
langchain_google_genai/embeddings.py,sha256=
|
|
7
|
+
langchain_google_genai/chat_models.py,sha256=OXm70GS_N6ror9A8imm6TIFVAfQ-DgdhIMbSZKExyVE,54450
|
|
8
|
+
langchain_google_genai/embeddings.py,sha256=jQRWPXD9twXoVBlXJQG7Duz0fb8UC0kgRzzwAmW3Dic,10146
|
|
9
9
|
langchain_google_genai/genai_aqa.py,sha256=qB6h3-BSXqe0YLR3eeVllYzmNKK6ofI6xJLdBahUVZo,4300
|
|
10
10
|
langchain_google_genai/google_vector_store.py,sha256=4wvhIiOmc3Fo046FyafPmT9NBCLek-9bgluvuTfrbpQ,16148
|
|
11
11
|
langchain_google_genai/llms.py,sha256=EPUgkz5aqKOyKbztT7br8w60Uo5D_X_bF5qP-zd6iLs,14593
|
|
12
12
|
langchain_google_genai/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
13
|
-
langchain_google_genai-2.0.
|
|
14
|
-
langchain_google_genai-2.0.
|
|
15
|
-
langchain_google_genai-2.0.
|
|
16
|
-
langchain_google_genai-2.0.
|
|
13
|
+
langchain_google_genai-2.0.8.dist-info/LICENSE,sha256=DppmdYJVSc1jd0aio6ptnMUn5tIHrdAhQ12SclEBfBg,1072
|
|
14
|
+
langchain_google_genai-2.0.8.dist-info/METADATA,sha256=HiODJnDpI3kyP8KioKDXiJItnXQsVc_AC-wamxdeyMY,3594
|
|
15
|
+
langchain_google_genai-2.0.8.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
|
|
16
|
+
langchain_google_genai-2.0.8.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|