Skip to content
Snippets Groups Projects
Unverified Commit 9b6eeeea authored by James Briggs's avatar James Briggs
Browse files

fix: change types for 3.9

parent 9bb9921d
No related branches found
No related tags found
No related merge requests found
import inspect import inspect
from typing import Any, Callable, Dict, List, Union from typing import Any, Callable, Dict, List, Optional, Union
from pydantic.v1 import BaseModel from pydantic.v1 import BaseModel
...@@ -14,7 +14,7 @@ class Parameter(BaseModel): ...@@ -14,7 +14,7 @@ class Parameter(BaseModel):
arbitrary_types_allowed = True arbitrary_types_allowed = True
name: str = Field(description="The name of the parameter") 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" default=None, description="The description of the parameter"
) )
type: str = Field(description="The type of the parameter") type: str = Field(description="The type of the parameter")
...@@ -41,7 +41,7 @@ class FunctionSchema: ...@@ -41,7 +41,7 @@ class FunctionSchema:
output: str = Field(description="The output of the function") output: str = Field(description="The output of the function")
parameters: List[Parameter] = Field(description="The parameters 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 self.function = function
if callable(function): if callable(function):
self._process_function(function) self._process_function(function)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment