The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
langchain_community.chat_models.oci_generative_ai: Fix a bug when using optional parameters in tools (#28829)
Emmanuel Leroyc8db5a19ce8c
diff --git a/libs/community/langchain_community/chat_models/oci_generative_ai.py b/libs/community/langchain_community/chat_models/oci_generative_ai.pyindex f66449bc56..0c64592fb9 100644--- a/libs/community/langchain_community/chat_models/oci_generative_ai.py+++ b/libs/community/langchain_community/chat_models/oci_generative_ai.py@@ -61,6 +61,7 @@ JSON_TO_PYTHON_TYPES = {"integer": "int","array": "List","object": "Dict",+ "any": "any",}@@ -323,7 +324,7 @@ class CohereProvider(Provider):if "description" in p_defelse "",type=JSON_TO_PYTHON_TYPES.get(- p_def.get("type"), p_def.get("type")+ p_def.get("type"), p_def.get("type", "any")),is_required="default" not in p_def,)@@ -342,7 +343,7 @@ class CohereProvider(Provider):p_name: self.oci_tool_param(description=p_def.get("description"),type=JSON_TO_PYTHON_TYPES.get(- p_def.get("type"), p_def.get("type")+ p_def.get("type"), p_def.get("type", "any")),is_required="default" not in p_def,)@@ -363,7 +364,7 @@ class CohereProvider(Provider):p_name: self.oci_tool_param(description=p_def.get("description"),type=JSON_TO_PYTHON_TYPES.get(- p_def.get("type"), p_def.get("type")+ p_def.get("type"), p_def.get("type", "any")),is_required=p_name in parameters.get("required", []),)