From 757f4670037e01e029f276adcf35d49bdac8bac6 Mon Sep 17 00:00:00 2001 From: Chester Curme Date: Fri, 21 Feb 2025 09:57:25 -0500 Subject: [PATCH 1/2] bump core and increment version --- libs/genai/poetry.lock | 10 +++++----- libs/genai/pyproject.toml | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/libs/genai/poetry.lock b/libs/genai/poetry.lock index 126cbec9..eb9f85db 100644 --- a/libs/genai/poetry.lock +++ b/libs/genai/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.8.2 and should not be changed by hand. [[package]] name = "annotated-types" @@ -591,13 +591,13 @@ files = [ [[package]] name = "langchain-core" -version = "0.3.35" +version = "0.3.37" description = "Building applications with LLMs through composability" optional = false python-versions = "<4.0,>=3.9" files = [ - {file = "langchain_core-0.3.35-py3-none-any.whl", hash = "sha256:81a4097226e180fa6c64e2d2ab38dcacbbc23b64fc109fb15622910fe8951670"}, - {file = "langchain_core-0.3.35.tar.gz", hash = "sha256:328688228ece259da734417d477994a69cf8202dea9ed4271f2d792e3575c6fc"}, + {file = "langchain_core-0.3.37-py3-none-any.whl", hash = "sha256:8202fd6506ce139a3a1b1c4c3006216b1c7fffa40bdd1779f7d2c67f75eb5f79"}, + {file = "langchain_core-0.3.37.tar.gz", hash = "sha256:cda8786e616caa2f68f7cc9e811b9b50e3b63fb2094333318b348e5961a7ea01"}, ] [package.dependencies] @@ -1556,4 +1556,4 @@ watchmedo = ["PyYAML (>=3.10)"] [metadata] lock-version = "2.0" python-versions = ">=3.9,<4.0" -content-hash = "6307b1d23e5d426cca539974c849d5f69966efddb80f438a41c7db1acd82db7a" +content-hash = "58963de42952a9351c588029b83e79305cf5f3c2659b2202affeef4a6dd05fcc" diff --git a/libs/genai/pyproject.toml b/libs/genai/pyproject.toml index d717b9bb..4369722c 100644 --- a/libs/genai/pyproject.toml +++ b/libs/genai/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "langchain-google-genai" -version = "2.0.9" +version = "2.0.10" description = "An integration package connecting Google's genai package and LangChain" authors = [] readme = "README.md" @@ -12,7 +12,7 @@ license = "MIT" [tool.poetry.dependencies] python = ">=3.9,<4.0" -langchain-core = "^0.3.35" +langchain-core = "^0.3.37" google-generativeai = "^0.8.0" pydantic = ">=2,<3" filetype = "^1.2.0" From 0dcfc2846a281ccf438c28908d8f138ae575369f Mon Sep 17 00:00:00 2001 From: Chester Curme Date: Fri, 21 Feb 2025 10:05:35 -0500 Subject: [PATCH 2/2] accommodate dict schema --- libs/genai/langchain_google_genai/_function_utils.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libs/genai/langchain_google_genai/_function_utils.py b/libs/genai/langchain_google_genai/_function_utils.py index e6e983dd..5afafef7 100644 --- a/libs/genai/langchain_google_genai/_function_utils.py +++ b/libs/genai/langchain_google_genai/_function_utils.py @@ -235,13 +235,16 @@ def _format_base_tool_to_function_declaration( ), ) - if issubclass(tool.args_schema, BaseModel): + if isinstance(tool.args_schema, dict): + schema = tool.args_schema + elif issubclass(tool.args_schema, BaseModel): schema = tool.args_schema.model_json_schema() elif issubclass(tool.args_schema, BaseModelV1): schema = tool.args_schema.schema() else: raise NotImplementedError( - f"args_schema must be a Pydantic BaseModel, got {tool.args_schema}." + "args_schema must be a Pydantic BaseModel or JSON schema, " + f"got {tool.args_schema}." ) parameters = _dict_to_gapic_schema(schema)