langchain-google-genai 2.0.5__tar.gz → 2.0.7__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.5 → langchain_google_genai-2.0.7}/PKG-INFO +2 -1
  2. {langchain_google_genai-2.0.5 → langchain_google_genai-2.0.7}/langchain_google_genai/_function_utils.py +0 -2
  3. {langchain_google_genai-2.0.5 → langchain_google_genai-2.0.7}/langchain_google_genai/_image_utils.py +7 -0
  4. {langchain_google_genai-2.0.5 → langchain_google_genai-2.0.7}/langchain_google_genai/chat_models.py +8 -4
  5. {langchain_google_genai-2.0.5 → langchain_google_genai-2.0.7}/langchain_google_genai/embeddings.py +3 -3
  6. {langchain_google_genai-2.0.5 → langchain_google_genai-2.0.7}/pyproject.toml +2 -1
  7. {langchain_google_genai-2.0.5 → langchain_google_genai-2.0.7}/LICENSE +0 -0
  8. {langchain_google_genai-2.0.5 → langchain_google_genai-2.0.7}/README.md +0 -0
  9. {langchain_google_genai-2.0.5 → langchain_google_genai-2.0.7}/langchain_google_genai/__init__.py +0 -0
  10. {langchain_google_genai-2.0.5 → langchain_google_genai-2.0.7}/langchain_google_genai/_common.py +0 -0
  11. {langchain_google_genai-2.0.5 → langchain_google_genai-2.0.7}/langchain_google_genai/_enums.py +0 -0
  12. {langchain_google_genai-2.0.5 → langchain_google_genai-2.0.7}/langchain_google_genai/_genai_extension.py +0 -0
  13. {langchain_google_genai-2.0.5 → langchain_google_genai-2.0.7}/langchain_google_genai/genai_aqa.py +0 -0
  14. {langchain_google_genai-2.0.5 → langchain_google_genai-2.0.7}/langchain_google_genai/google_vector_store.py +0 -0
  15. {langchain_google_genai-2.0.5 → langchain_google_genai-2.0.7}/langchain_google_genai/llms.py +0 -0
  16. {langchain_google_genai-2.0.5 → langchain_google_genai-2.0.7}/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.5
3
+ Version: 2.0.7
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
@@ -11,6 +11,7 @@ Classifier: Programming Language :: Python :: 3.9
11
11
  Classifier: Programming Language :: Python :: 3.10
12
12
  Classifier: Programming Language :: Python :: 3.11
13
13
  Classifier: Programming Language :: Python :: 3.12
14
+ Requires-Dist: filetype (>=1.2.0,<2.0.0)
14
15
  Requires-Dist: google-generativeai (>=0.8.0,<0.9.0)
15
16
  Requires-Dist: langchain-core (>=0.3.15,<0.4)
16
17
  Requires-Dist: pydantic (>=2,<3)
@@ -342,8 +342,6 @@ def _get_items_from_schema(schema: Union[Dict, List, str]) -> Dict[str, Any]:
342
342
  items["type_"] = _get_type_from_schema(schema)
343
343
  if items["type_"] == glm.Type.OBJECT and "properties" in schema:
344
344
  items["properties"] = _get_properties_from_schema_any(schema["properties"])
345
- if "title" in schema:
346
- items["title"] = schema
347
345
  if "title" in schema or "description" in schema:
348
346
  items["description"] = (
349
347
  schema.get("description") or schema.get("title") or ""
@@ -8,6 +8,7 @@ from enum import Enum
8
8
  from typing import Any, Dict
9
9
  from urllib.parse import urlparse
10
10
 
11
+ import filetype # type: ignore[import]
11
12
  import requests
12
13
  from google.ai.generativelanguage_v1beta.types import Part
13
14
 
@@ -87,7 +88,13 @@ class ImageBytesLoader:
87
88
  raise ValueError(msg)
88
89
 
89
90
  inline_data: Dict[str, Any] = {"data": bytes_}
91
+
90
92
  mime_type, _ = mimetypes.guess_type(image_string)
93
+ if not mime_type:
94
+ kind = filetype.guess(bytes_)
95
+ if kind:
96
+ mime_type = kind.mime
97
+
91
98
  if mime_type:
92
99
  inline_data["mime_type"] = mime_type
93
100
 
@@ -579,9 +579,9 @@ class ChatGoogleGenerativeAI(_BaseGoogleGenerativeAI, BaseChatModel):
579
579
  Instantiation:
580
580
  To use, you must have either:
581
581
 
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.
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
584
+ to the ChatGoogleGenerativeAI constructor.
585
585
 
586
586
  .. code-block:: python
587
587
 
@@ -1374,7 +1374,11 @@ class ChatGoogleGenerativeAI(_BaseGoogleGenerativeAI, BaseChatModel):
1374
1374
 
1375
1375
  @property
1376
1376
  def _supports_tool_choice(self) -> bool:
1377
- return "gemini-1.5-pro" in self.model or "gemini-1.5-flash" in self.model
1377
+ return (
1378
+ "gemini-1.5-pro" in self.model
1379
+ or "gemini-1.5-flash" in self.model
1380
+ or "gemini-2" in self.model
1381
+ )
1378
1382
 
1379
1383
 
1380
1384
  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.5"
3
+ version = "2.0.7"
4
4
  description = "An integration package connecting Google's genai package and LangChain"
5
5
  authors = []
6
6
  readme = "README.md"
@@ -15,6 +15,7 @@ python = ">=3.9,<4.0"
15
15
  langchain-core = ">=0.3.15,<0.4"
16
16
  google-generativeai = "^0.8.0"
17
17
  pydantic = ">=2,<3"
18
+ filetype = "^1.2.0"
18
19
 
19
20
  [tool.poetry.group.test]
20
21
  optional = true