From da14b32012cc43a240f3daab78d6d9ab92794d66 Mon Sep 17 00:00:00 2001 From: Shroominic Date: Mon, 22 Jan 2024 22:05:16 +0000 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Support=20union=20output=20types.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/funcchain/schema/signature.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/funcchain/schema/signature.py b/src/funcchain/schema/signature.py index 62bc832..5e1cb7f 100644 --- a/src/funcchain/schema/signature.py +++ b/src/funcchain/schema/signature.py @@ -1,3 +1,4 @@ +from types import UnionType from typing import Any, Generic, TypeVar from langchain_core.messages import BaseMessage @@ -27,7 +28,7 @@ class Signature(BaseModel, Generic[T]): # -> e.g. Callbacks adds custom callbacks # -> e.g. SystemMessage adds a system message - output_type: type[T] + output_type: type[T] | UnionType """ Type to parse the output into. """ # todo: is history really needed? maybe this could be a background optimization