camel.runtime.utils package#
Submodules#
camel.runtime.utils.function_risk_toolkit module#
- class camel.runtime.utils.function_risk_toolkit.FunctionRiskToolkit(verbose: bool | None = False)[source]#
Bases:
BaseToolkit
A toolkit for assessing the risk associated with functions.
- Parameters:
verbose (Optional[bool]) β Whether to print verbose output. (default:
False
)
- function_risk(score: int, reason: str)[source]#
- Provides an assessment of the potential risk associated
with a function.
- Parameters:
score (int) β
The risk level associated with the function, ranging from 1 to 3:
- 1: No harm
(e.g., simple math operations, content searches)
2: Minimal harm (e.g., accessing user files)
- 3: Risk present
(e.g., deleting files, modifying the file system)
reason (str) β A brief explanation of the reasoning behind the assigned score, describing the specific aspects that contribute to the assessed risk.
- get_tools() List[FunctionTool] [source]#
Returns a list of FunctionTool objects representing the functions in the toolkit.
- Returns:
- A list of FunctionTool objects
representing the functions in the toolkit.
- Return type:
List[FunctionTool]
camel.runtime.utils.ignore_risk_toolkit module#
- class camel.runtime.utils.ignore_risk_toolkit.IgnoreRiskToolkit(function_name: List[str] | None = None, verbose: bool | None = False)[source]#
Bases:
BaseToolkit
A toolkit for ignoring risks associated with functions.
- Parameters:
function_names (Optional[List[str]]) β A list of function names to ignore risks for. (default:
None
)verbose (Optional[bool]) β Whether to print verbose output. (default:
False
)
- add(name: str)[source]#
Adds a function to the toolkit.
- Parameters:
name (str) β The name of the function to add.
- get_tools() List[FunctionTool] [source]#
Returns a list of FunctionTool objects representing the functions in the toolkit.
- Returns:
- A list of FunctionTool objects representing
the functions in the toolkit.
- Return type:
List[FunctionTool]
- ignore_risk(name: str, reason: str) str [source]#
Force ignores the risk associated with named function. This ONLY ignores the RISK for the NEXT Function Call.
- Parameters:
name (str) β The name of the function to ignore.
reason (str) β A brief explanation of the reasoning behind the decision to ignore the risk.
Module contents#
- class camel.runtime.utils.FunctionRiskToolkit(verbose: bool | None = False)[source]#
Bases:
BaseToolkit
A toolkit for assessing the risk associated with functions.
- Parameters:
verbose (Optional[bool]) β Whether to print verbose output. (default:
False
)
- function_risk(score: int, reason: str)[source]#
- Provides an assessment of the potential risk associated
with a function.
- Parameters:
score (int) β
The risk level associated with the function, ranging from 1 to 3:
- 1: No harm
(e.g., simple math operations, content searches)
2: Minimal harm (e.g., accessing user files)
- 3: Risk present
(e.g., deleting files, modifying the file system)
reason (str) β A brief explanation of the reasoning behind the assigned score, describing the specific aspects that contribute to the assessed risk.
- get_tools() List[FunctionTool] [source]#
Returns a list of FunctionTool objects representing the functions in the toolkit.
- Returns:
- A list of FunctionTool objects
representing the functions in the toolkit.
- Return type:
List[FunctionTool]
- class camel.runtime.utils.IgnoreRiskToolkit(function_name: List[str] | None = None, verbose: bool | None = False)[source]#
Bases:
BaseToolkit
A toolkit for ignoring risks associated with functions.
- Parameters:
function_names (Optional[List[str]]) β A list of function names to ignore risks for. (default:
None
)verbose (Optional[bool]) β Whether to print verbose output. (default:
False
)
- add(name: str)[source]#
Adds a function to the toolkit.
- Parameters:
name (str) β The name of the function to add.
- get_tools() List[FunctionTool] [source]#
Returns a list of FunctionTool objects representing the functions in the toolkit.
- Returns:
- A list of FunctionTool objects representing
the functions in the toolkit.
- Return type:
List[FunctionTool]
- ignore_risk(name: str, reason: str) str [source]#
Force ignores the risk associated with named function. This ONLY ignores the RISK for the NEXT Function Call.
- Parameters:
name (str) β The name of the function to ignore.
reason (str) β A brief explanation of the reasoning behind the decision to ignore the risk.