-
Notifications
You must be signed in to change notification settings - Fork 195
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* planner and coder to handle interaction type * add interaction tool choice function * vision agent to hanlde interaction types * pass hilo parameter down to planner * fix minor issues with interaction in planner * redisplay tool calls so outside world can see them * format fix * fix planner for interaction * fix vision agent for interactions * better search for function call * added box_threshold replace * add box threshold set to get_tool_for_task * update example code to handle hilo with threshold * remove merge message * lower default threshold * type ignore
- Loading branch information
1 parent
720a7f4
commit 39f893f
Showing
4 changed files
with
154 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
from vision_agent.tools.planner_tools import check_function_call, replace_box_threshold | ||
|
||
|
||
def test_check_function_call(): | ||
code = """ | ||
test_function('one', image1) | ||
""" | ||
assert check_function_call(code, "test_function") == True | ||
assert check_function_call(code, "test_function2") == False | ||
|
||
|
||
def test_check_function_call_try_catch(): | ||
code = """ | ||
try: | ||
test_function('one', image1) | ||
except Exception as e: | ||
pass | ||
""" | ||
assert check_function_call(code, "test_function") == True | ||
assert check_function_call(code, "test_function2") == False | ||
|
||
|
||
def test_replace_box_threshold(): | ||
code = """ | ||
test_function('one', image1, box_threshold=0.1) | ||
""" | ||
expected_code = """ | ||
test_function('one', image1, box_threshold=0.5) | ||
""" | ||
assert replace_box_threshold(code, ["test_function"], 0.5) == expected_code | ||
|
||
|
||
def test_replace_box_threshold_in_function(): | ||
code = """ | ||
def test_function_outer(): | ||
test_function('one', image1, box_threshold=0.1) | ||
""" | ||
expected_code = """ | ||
def test_function_outer(): | ||
test_function('one', image1, box_threshold=0.5) | ||
""" | ||
assert replace_box_threshold(code, ["test_function"], 0.5) == expected_code | ||
|
||
|
||
def test_replace_box_threshold_no_arg(): | ||
code = """ | ||
test_function('one', image1) | ||
""" | ||
expected_code = """ | ||
test_function('one', image1, box_threshold=0.5) | ||
""" | ||
assert replace_box_threshold(code, ["test_function"], 0.5) == expected_code | ||
|
||
|
||
def test_replace_box_threshold_no_func(): | ||
code = """ | ||
test_function2('one', image1) | ||
""" | ||
expected_code = """ | ||
test_function2('one', image1) | ||
""" | ||
assert replace_box_threshold(code, ["test_function"], 0.5) == expected_code | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters