From 9b6eeeea992d1ebfd87ef2d67991c80ae56ac649 Mon Sep 17 00:00:00 2001 From: James Briggs Date: Wed, 14 Aug 2024 21:59:28 +0200 Subject: [PATCH] fix: change types for 3.9 --- semantic_router/utils/function_call.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/semantic_router/utils/function_call.py b/semantic_router/utils/function_call.py index d4aea742..3ae14043 100644 --- a/semantic_router/utils/function_call.py +++ b/semantic_router/utils/function_call.py @@ -1,5 +1,5 @@ import inspect -from typing import Any, Callable, Dict, List, Union +from typing import Any, Callable, Dict, List, Optional, Union from pydantic.v1 import BaseModel @@ -14,7 +14,7 @@ class Config: arbitrary_types_allowed = True name: str = Field(description="The name of the parameter") - description: str | None = Field( + description: Optional[str] = Field( default=None, description="The description of the parameter" ) type: str = Field(description="The type of the parameter") @@ -41,7 +41,7 @@ class FunctionSchema: output: str = Field(description="The output of the function") parameters: List[Parameter] = Field(description="The parameters of the function") - def __init__(self, function: Callable | BaseModel): + def __init__(self, function: Union[Callable, BaseModel]): self.function = function if callable(function): self._process_function(function)