langchain-google-genai 2.0.6__tar.gz → 2.0.8__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.

Files changed (16) hide show
  1. {langchain_google_genai-2.0.6 → langchain_google_genai-2.0.8}/PKG-INFO +2 -2
  2. {langchain_google_genai-2.0.6 → langchain_google_genai-2.0.8}/langchain_google_genai/_function_utils.py +20 -6
  3. {langchain_google_genai-2.0.6 → langchain_google_genai-2.0.8}/langchain_google_genai/chat_models.py +11 -4
  4. {langchain_google_genai-2.0.6 → langchain_google_genai-2.0.8}/langchain_google_genai/embeddings.py +3 -3
  5. {langchain_google_genai-2.0.6 → langchain_google_genai-2.0.8}/pyproject.toml +12 -2
  6. {langchain_google_genai-2.0.6 → langchain_google_genai-2.0.8}/LICENSE +0 -0
  7. {langchain_google_genai-2.0.6 → langchain_google_genai-2.0.8}/README.md +0 -0
  8. {langchain_google_genai-2.0.6 → langchain_google_genai-2.0.8}/langchain_google_genai/__init__.py +0 -0
  9. {langchain_google_genai-2.0.6 → langchain_google_genai-2.0.8}/langchain_google_genai/_common.py +0 -0
  10. {langchain_google_genai-2.0.6 → langchain_google_genai-2.0.8}/langchain_google_genai/_enums.py +0 -0
  11. {langchain_google_genai-2.0.6 → langchain_google_genai-2.0.8}/langchain_google_genai/_genai_extension.py +0 -0
  12. {langchain_google_genai-2.0.6 → langchain_google_genai-2.0.8}/langchain_google_genai/_image_utils.py +0 -0
  13. {langchain_google_genai-2.0.6 → langchain_google_genai-2.0.8}/langchain_google_genai/genai_aqa.py +0 -0
  14. {langchain_google_genai-2.0.6 → langchain_google_genai-2.0.8}/langchain_google_genai/google_vector_store.py +0 -0
  15. {langchain_google_genai-2.0.6 → langchain_google_genai-2.0.8}/langchain_google_genai/llms.py +0 -0
  16. {langchain_google_genai-2.0.6 → langchain_google_genai-2.0.8}/langchain_google_genai/py.typed +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: langchain-google-genai
3
- Version: 2.0.6
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.15,<0.4)
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
@@ -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 and v.get("properties"):
319
- properties_item["properties"] = _get_properties_from_schema_any(
320
- v.get("properties")
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``` environment variable set with your API key, or
583
- 2. Pass your API key using the google_api_key kwarg to the ChatGoogle
584
- constructor.
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 "gemini-1.5-pro" in self.model or "gemini-1.5-flash" in self.model
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``` environment variable set with your API key, or
31
- 2. Pass your API key using the google_api_key kwarg to the ChatGoogle
32
- constructor.
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
  [tool.poetry]
2
2
  name = "langchain-google-genai"
3
- version = "2.0.6"
3
+ version = "2.0.8"
4
4
  description = "An integration package connecting Google's genai package and LangChain"
5
5
  authors = []
6
6
  readme = "README.md"
@@ -12,7 +12,7 @@ license = "MIT"
12
12
 
13
13
  [tool.poetry.dependencies]
14
14
  python = ">=3.9,<4.0"
15
- langchain-core = ">=0.3.15,<0.4"
15
+ langchain-core = "^0.3.27"
16
16
  google-generativeai = "^0.8.0"
17
17
  pydantic = ">=2,<3"
18
18
  filetype = "^1.2.0"
@@ -34,6 +34,8 @@ langchain-tests = "0.3.1"
34
34
  ignore-words-list = "rouge"
35
35
 
36
36
 
37
+
38
+
37
39
  [tool.poetry.group.codespell]
38
40
  optional = true
39
41
 
@@ -41,6 +43,8 @@ optional = true
41
43
  codespell = "^2.2.0"
42
44
 
43
45
 
46
+
47
+
44
48
  [tool.poetry.group.test_integration]
45
49
  optional = true
46
50
 
@@ -48,6 +52,8 @@ optional = true
48
52
  pytest = "^7.3.0"
49
53
 
50
54
 
55
+
56
+
51
57
  [tool.poetry.group.lint]
52
58
  optional = true
53
59
 
@@ -55,6 +61,8 @@ optional = true
55
61
  ruff = "^0.1.5"
56
62
 
57
63
 
64
+
65
+
58
66
  [tool.poetry.group.typing.dependencies]
59
67
  mypy = "^1.10"
60
68
  types-requests = "^2.28.11.5"
@@ -63,6 +71,8 @@ types-protobuf = "^4.24.0.20240302"
63
71
  numpy = "^1.26.2"
64
72
 
65
73
 
74
+
75
+
66
76
  [tool.poetry.group.dev]
67
77
  optional = true
68
78