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:
Matthew Zhou
2024-11-22 10:34:08 -08:00
committed by GitHub
parent 355fe1b4cf
commit 69730988ce
39 changed files with 2845 additions and 864 deletions

View File

@@ -8,7 +8,7 @@ client.set_default_embedding_config(EmbeddingConfig.default_config(model_name="t
# define a function with a docstring
def roll_d20(self) -> str:
def roll_d20() -> str:
"""
Simulate the roll of a 20-sided die (d20).

View File

@@ -31,14 +31,14 @@ config_file = os.path.join(llm_config_dir, "openai-gpt-4o.json")
"""Contrived tools for this test case"""
def first_secret_word(self: "Agent"):
def first_secret_word():
"""
Call this to retrieve the first secret word, which you will need for the second_secret_word function.
"""
return "v0iq020i0g"
def second_secret_word(self: "Agent", prev_secret_word: str):
def second_secret_word(prev_secret_word: str):
"""
Call this to retrieve the second secret word, which you will need for the third_secret_word function. If you get the word wrong, this function will error.
@@ -51,7 +51,7 @@ def second_secret_word(self: "Agent", prev_secret_word: str):
return "4rwp2b4gxq"
def third_secret_word(self: "Agent", prev_secret_word: str):
def third_secret_word(prev_secret_word: str):
"""
Call this to retrieve the third secret word, which you will need for the fourth_secret_word function. If you get the word wrong, this function will error.
@@ -64,7 +64,7 @@ def third_secret_word(self: "Agent", prev_secret_word: str):
return "hj2hwibbqm"
def fourth_secret_word(self: "Agent", prev_secret_word: str):
def fourth_secret_word(prev_secret_word: str):
"""
Call this to retrieve the last secret word, which you will need to output in a send_message later. If you get the word wrong, this function will error.
@@ -77,7 +77,7 @@ def fourth_secret_word(self: "Agent", prev_secret_word: str):
return "banana"
def auto_error(self: "Agent"):
def auto_error():
"""
If you call this function, it will throw an error automatically.
"""