From 724614a0840610f1031bd19f3cfd5351a8ea9192 Mon Sep 17 00:00:00 2001 From: Erick Friis Date: Fri, 2 Feb 2024 12:05:36 -0800 Subject: [PATCH] use optional union didnt work --- libs/core/langchain_core/tools.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/core/langchain_core/tools.py b/libs/core/langchain_core/tools.py index 627dfb4b789..7e1d82e226e 100644 --- a/libs/core/langchain_core/tools.py +++ b/libs/core/langchain_core/tools.py @@ -49,7 +49,7 @@ def _create_subset_model( # this isn't perfect but should work for most functions field.outer_type_ if field.required and not field.allow_none - else Union[field.outer_type_, None] + else Optional[field.outer_type_] ) fields[field_name] = (t, field.field_info) rtn = create_model(name, **fields) # type: ignore