langchain-google-genai 1.0.4__tar.gz → 1.0.5__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.
- {langchain_google_genai-1.0.4 → langchain_google_genai-1.0.5}/PKG-INFO +2 -2
- {langchain_google_genai-1.0.4 → langchain_google_genai-1.0.5}/langchain_google_genai/chat_models.py +31 -7
- {langchain_google_genai-1.0.4 → langchain_google_genai-1.0.5}/pyproject.toml +2 -2
- {langchain_google_genai-1.0.4 → langchain_google_genai-1.0.5}/LICENSE +0 -0
- {langchain_google_genai-1.0.4 → langchain_google_genai-1.0.5}/README.md +0 -0
- {langchain_google_genai-1.0.4 → langchain_google_genai-1.0.5}/langchain_google_genai/__init__.py +0 -0
- {langchain_google_genai-1.0.4 → langchain_google_genai-1.0.5}/langchain_google_genai/_common.py +0 -0
- {langchain_google_genai-1.0.4 → langchain_google_genai-1.0.5}/langchain_google_genai/_enums.py +0 -0
- {langchain_google_genai-1.0.4 → langchain_google_genai-1.0.5}/langchain_google_genai/_function_utils.py +0 -0
- {langchain_google_genai-1.0.4 → langchain_google_genai-1.0.5}/langchain_google_genai/_genai_extension.py +0 -0
- {langchain_google_genai-1.0.4 → langchain_google_genai-1.0.5}/langchain_google_genai/_image_utils.py +0 -0
- {langchain_google_genai-1.0.4 → langchain_google_genai-1.0.5}/langchain_google_genai/embeddings.py +0 -0
- {langchain_google_genai-1.0.4 → langchain_google_genai-1.0.5}/langchain_google_genai/genai_aqa.py +0 -0
- {langchain_google_genai-1.0.4 → langchain_google_genai-1.0.5}/langchain_google_genai/google_vector_store.py +0 -0
- {langchain_google_genai-1.0.4 → langchain_google_genai-1.0.5}/langchain_google_genai/llms.py +0 -0
- {langchain_google_genai-1.0.4 → langchain_google_genai-1.0.5}/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: 1.0.
|
|
3
|
+
Version: 1.0.5
|
|
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
|
Provides-Extra: images
|
|
15
15
|
Requires-Dist: google-generativeai (>=0.5.2,<0.6.0)
|
|
16
|
-
Requires-Dist: langchain-core (>=0.
|
|
16
|
+
Requires-Dist: langchain-core (>=0.2.0,<0.3)
|
|
17
17
|
Requires-Dist: pillow (>=10.1.0,<11.0.0) ; extra == "images"
|
|
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
|
{langchain_google_genai-1.0.4 → langchain_google_genai-1.0.5}/langchain_google_genai/chat_models.py
RENAMED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
+
import asyncio
|
|
3
4
|
import base64
|
|
4
5
|
import json
|
|
5
6
|
import logging
|
|
@@ -558,6 +559,14 @@ def _response_to_result(
|
|
|
558
559
|
return ChatResult(generations=generations, llm_output=llm_output)
|
|
559
560
|
|
|
560
561
|
|
|
562
|
+
def _is_event_loop_running() -> bool:
|
|
563
|
+
try:
|
|
564
|
+
asyncio.get_running_loop()
|
|
565
|
+
return True
|
|
566
|
+
except RuntimeError:
|
|
567
|
+
return False
|
|
568
|
+
|
|
569
|
+
|
|
561
570
|
class ChatGoogleGenerativeAI(_BaseGoogleGenerativeAI, BaseChatModel):
|
|
562
571
|
"""`Google Generative AI` Chat models API.
|
|
563
572
|
|
|
@@ -639,13 +648,22 @@ class ChatGoogleGenerativeAI(_BaseGoogleGenerativeAI, BaseChatModel):
|
|
|
639
648
|
client_options=values.get("client_options"),
|
|
640
649
|
transport=transport,
|
|
641
650
|
)
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
)
|
|
651
|
+
|
|
652
|
+
# NOTE: genaix.build_generative_async_service requires
|
|
653
|
+
# a running event loop, which causes an error
|
|
654
|
+
# when initialized inside a ThreadPoolExecutor.
|
|
655
|
+
# this check ensures that async client is only initialized
|
|
656
|
+
# within an asyncio event loop to avoid the error
|
|
657
|
+
if _is_event_loop_running():
|
|
658
|
+
values["async_client"] = genaix.build_generative_async_service(
|
|
659
|
+
credentials=values.get("credentials"),
|
|
660
|
+
api_key=google_api_key,
|
|
661
|
+
client_info=client_info,
|
|
662
|
+
client_options=values.get("client_options"),
|
|
663
|
+
transport=transport,
|
|
664
|
+
)
|
|
665
|
+
else:
|
|
666
|
+
values["async_client"] = None
|
|
649
667
|
|
|
650
668
|
return values
|
|
651
669
|
|
|
@@ -724,6 +742,12 @@ class ChatGoogleGenerativeAI(_BaseGoogleGenerativeAI, BaseChatModel):
|
|
|
724
742
|
generation_config: Optional[Dict[str, Any]] = None,
|
|
725
743
|
**kwargs: Any,
|
|
726
744
|
) -> ChatResult:
|
|
745
|
+
if not self.async_client:
|
|
746
|
+
raise RuntimeError(
|
|
747
|
+
"Initialize ChatGoogleGenerativeAI with a running event loop "
|
|
748
|
+
"to use async methods."
|
|
749
|
+
)
|
|
750
|
+
|
|
727
751
|
request = self._prepare_request(
|
|
728
752
|
messages,
|
|
729
753
|
stop=stop,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "langchain-google-genai"
|
|
3
|
-
version = "1.0.
|
|
3
|
+
version = "1.0.5"
|
|
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.
|
|
15
|
+
langchain-core = ">=0.2.0,<0.3"
|
|
16
16
|
google-generativeai = "^0.5.2"
|
|
17
17
|
pillow = { version = "^10.1.0", optional = true }
|
|
18
18
|
|
|
File without changes
|
|
File without changes
|
{langchain_google_genai-1.0.4 → langchain_google_genai-1.0.5}/langchain_google_genai/__init__.py
RENAMED
|
File without changes
|
{langchain_google_genai-1.0.4 → langchain_google_genai-1.0.5}/langchain_google_genai/_common.py
RENAMED
|
File without changes
|
{langchain_google_genai-1.0.4 → langchain_google_genai-1.0.5}/langchain_google_genai/_enums.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{langchain_google_genai-1.0.4 → langchain_google_genai-1.0.5}/langchain_google_genai/_image_utils.py
RENAMED
|
File without changes
|
{langchain_google_genai-1.0.4 → langchain_google_genai-1.0.5}/langchain_google_genai/embeddings.py
RENAMED
|
File without changes
|
{langchain_google_genai-1.0.4 → langchain_google_genai-1.0.5}/langchain_google_genai/genai_aqa.py
RENAMED
|
File without changes
|
|
File without changes
|
{langchain_google_genai-1.0.4 → langchain_google_genai-1.0.5}/langchain_google_genai/llms.py
RENAMED
|
File without changes
|
{langchain_google_genai-1.0.4 → langchain_google_genai-1.0.5}/langchain_google_genai/py.typed
RENAMED
|
File without changes
|