Fix/typos (#2308)
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
from pydantic import BaseModel
|
||||
from typing import Dict, Optional, Any, List
|
||||
|
||||
from core.tools.entities.tool_entities import ToolProviderType, ToolParamter
|
||||
from core.tools.entities.tool_entities import ToolProviderType, ToolParameter
|
||||
|
||||
class ApiBasedToolBundle(BaseModel):
|
||||
"""
|
||||
@@ -16,7 +16,7 @@ class ApiBasedToolBundle(BaseModel):
|
||||
# operation_id
|
||||
operation_id: str = None
|
||||
# parameters
|
||||
parameters: Optional[List[ToolParamter]] = None
|
||||
parameters: Optional[List[ToolParameter]] = None
|
||||
# author
|
||||
author: str
|
||||
# icon
|
||||
|
@@ -88,11 +88,11 @@ class ToolInvokeMessageBinary(BaseModel):
|
||||
url: str = Field(..., description="The url of the binary")
|
||||
save_as: str = ''
|
||||
|
||||
class ToolParamterOption(BaseModel):
|
||||
class ToolParameterOption(BaseModel):
|
||||
value: str = Field(..., description="The value of the option")
|
||||
label: I18nObject = Field(..., description="The label of the option")
|
||||
|
||||
class ToolParamter(BaseModel):
|
||||
class ToolParameter(BaseModel):
|
||||
class ToolParameterType(Enum):
|
||||
STRING = "string"
|
||||
NUMBER = "number"
|
||||
@@ -114,12 +114,12 @@ class ToolParamter(BaseModel):
|
||||
default: Optional[str] = None
|
||||
min: Optional[Union[float, int]] = None
|
||||
max: Optional[Union[float, int]] = None
|
||||
options: Optional[List[ToolParamterOption]] = None
|
||||
options: Optional[List[ToolParameterOption]] = None
|
||||
|
||||
@classmethod
|
||||
def get_simple_instance(cls,
|
||||
name: str, llm_description: str, type: ToolParameterType,
|
||||
required: bool, options: Optional[List[str]] = None) -> 'ToolParamter':
|
||||
required: bool, options: Optional[List[str]] = None) -> 'ToolParameter':
|
||||
"""
|
||||
get a simple tool parameter
|
||||
|
||||
@@ -129,9 +129,9 @@ class ToolParamter(BaseModel):
|
||||
:param required: if the parameter is required
|
||||
:param options: the options of the parameter
|
||||
"""
|
||||
# convert options to ToolParamterOption
|
||||
# convert options to ToolParameterOption
|
||||
if options:
|
||||
options = [ToolParamterOption(value=option, label=I18nObject(en_US=option, zh_Hans=option)) for option in options]
|
||||
options = [ToolParameterOption(value=option, label=I18nObject(en_US=option, zh_Hans=option)) for option in options]
|
||||
return cls(
|
||||
name=name,
|
||||
label=I18nObject(en_US='', zh_Hans=''),
|
||||
@@ -183,7 +183,7 @@ class ToolProviderCredentials(BaseModel):
|
||||
raise ValueError(f'invalid mode value {value}')
|
||||
|
||||
@staticmethod
|
||||
def defaut(value: str) -> str:
|
||||
def default(value: str) -> str:
|
||||
return ""
|
||||
|
||||
name: str = Field(..., description="The name of the credentials")
|
||||
|
@@ -4,7 +4,7 @@ from typing import List, Dict, Optional
|
||||
|
||||
from core.tools.entities.common_entities import I18nObject
|
||||
from core.tools.entities.tool_entities import ToolProviderCredentials
|
||||
from core.tools.tool.tool import ToolParamter
|
||||
from core.tools.tool.tool import ToolParameter
|
||||
|
||||
class UserToolProvider(BaseModel):
|
||||
class ProviderType(Enum):
|
||||
@@ -45,4 +45,4 @@ class UserTool(BaseModel):
|
||||
name: str # identifier
|
||||
label: I18nObject # label
|
||||
description: I18nObject
|
||||
parameters: Optional[List[ToolParamter]]
|
||||
parameters: Optional[List[ToolParameter]]
|
Reference in New Issue
Block a user