feat: Sandboxing for tool execution (#2040)
Co-authored-by: Caren Thomas <carenthomas@Jeffs-MacBook-Pro-2.local> Co-authored-by: Caren Thomas <carenthomas@jeffs-mbp-2.lan> Co-authored-by: Caren Thomas <carenthomas@Jeffs-MBP-2.hsd1.ca.comcast.net> Co-authored-by: Sarah Wooders <sarahwooders@gmail.com>
This commit is contained in:
@@ -93,9 +93,14 @@ def generate_schema(function, name: Optional[str] = None, description: Optional[
|
||||
|
||||
for param in sig.parameters.values():
|
||||
# Exclude 'self' parameter
|
||||
# TODO: eventually remove this (only applies to BASE_TOOLS)
|
||||
if param.name == "self":
|
||||
continue
|
||||
|
||||
# exclude 'agent_state' parameter
|
||||
if param.name == "agent_state":
|
||||
continue
|
||||
|
||||
# Assert that the parameter has a type annotation
|
||||
if param.annotation == inspect.Parameter.empty:
|
||||
raise TypeError(f"Parameter '{param.name}' in function '{function.__name__}' lacks a type annotation")
|
||||
@@ -129,6 +134,7 @@ def generate_schema(function, name: Optional[str] = None, description: Optional[
|
||||
|
||||
# append the heartbeat
|
||||
# TODO: don't hard-code
|
||||
# TODO: if terminal, don't include this
|
||||
if function.__name__ not in ["send_message", "pause_heartbeats"]:
|
||||
schema["parameters"]["properties"]["request_heartbeat"] = {
|
||||
"type": "boolean",
|
||||
|
||||
Reference in New Issue
Block a user