tool
¶
SchemaTool
¶
Bases: BaseTool
The Tool that has a fixed schema.
Source code in src/appl/core/tool.py
Tool
¶
Bases: BaseTool
The Tool built from a Python function, can be called by LLMs.
Parameters:
-
func
(Callable
) –The function to create the tool from.
-
use_short_desc
(bool
, default:False
) –Whether to use the short description instead of the full description.
-
predefined
(Any
, default:{}
) –Additional arguments for the tool.
Source code in src/appl/core/tool.py
examples
class-attribute
instance-attribute
¶
The examples of the Tool.
info
class-attribute
instance-attribute
¶
info: Dict = Field(
{}, description="Additional information of the Tool"
)
Additional information of the Tool.
long_desc
class-attribute
instance-attribute
¶
long_desc: str = Field(
"", description="The long description of the Tool"
)
The long description of the Tool.
name
class-attribute
instance-attribute
¶
name: str = Field(..., description='The name of the Tool')
The name of the Tool.
params
class-attribute
instance-attribute
¶
params: type[BaseModel] = Field(
..., description="The parameters of the Tool"
)
The parameters of the Tool.
raises
class-attribute
instance-attribute
¶
raises: List[Dict[str, Optional[str]]] = Field(
[], description="The exceptions raised by the Tool"
)
The exceptions raised by the Tool.
returns
class-attribute
instance-attribute
¶
returns: type[BaseModel] = Field(
..., description="The return of the Tool"
)
The return of the Tool.
short_desc
class-attribute
instance-attribute
¶
short_desc: str = Field(
"", description="The short description of the Tool"
)
The short description of the Tool.
parse_data
classmethod
¶
parse_data(
sig: Signature,
docstring: Optional[str],
predefined: Dict[str, Any],
) -> Dict[str, Any]
Parse data from the signature and docstring of a function.
Source code in src/appl/core/tool.py
ToolCall
¶
ToolCall(**kwargs: Any)
Bases: BaseModel
The class representing a tool call.
Source code in src/appl/core/tool.py
args
class-attribute
instance-attribute
¶
args: str = Field(
...,
description="The arguments to call the function with.",
)
The arguments to call the function with.
id
class-attribute
instance-attribute
¶
id: str = Field(..., description="The ID of the tool call.")
The ID of the tool call.
name
class-attribute
instance-attribute
¶
name: str = Field(
..., description="The name of the function to call."
)
The name of the function to call.
from_dict
classmethod
¶
Create a ToolCall from a dictionary in the OpenAI format.
Source code in src/appl/core/tool.py
from_openai_tool_call
classmethod
¶
from_openai_tool_call(
call: ChatCompletionMessageToolCall,
) -> ToolCall
Create a ToolCall from an OpenAI tool call.
get_dict
¶
Get the OpenAI format dictionary representation of the tool call.