Camel.benchmarks.nexus
NexusSample
Nexus benchmark dataset sample.
NexusBenchmark
Nexus Function Calling Benchmark adapted from NexusRaven V2 Function Calling Benchmark
<https://huggingface.co/collections/Nexusflow/nexusraven-v2-function-calling-benchmark-657a597fb84dbe7a09ebfc3e>
.
Parameters:
- data_dir (str): The directory to save the data.
- save_to (str): The file to save the results.
- processes (int, optional): The number of processes to use. (default: :obj:
1
)
init
Initialize the Nexus Function Calling benchmark.
Parameters:
- data_dir (str): The directory to save the data.
- save_to (str): The file to save the results.
- processes (int, optional): The number of processes to use for parallel processing. (default: :obj:
1
)
download
Download the Nexus Functional Calling Benchmark dataset.
load
Load the Nexus Benchmark dataset.
Parameters:
- dataset_name (str): Name of the specific dataset to be loaded.
- force_download (bool): Whether to force download the data.
train
Get the training set.
run
Run the benchmark.
Parameters:
- agent (ChatAgent): The agent to run the benchmark. task (Literal[“NVDLibrary”, “VirusTotal”, “OTX”, “PlacesAPI”, “ClimateAPI”, “VirusTotal-ParallelCalls”, “VirusTotal-NestedCalls”, “NVDLibrary-NestedCalls”]): The task to run the benchmark.
- randomize (bool, optional): Whether to randomize the data. (default: :obj:
False
) - subset (Optional[int], optional): The subset of data to run. (default: :obj:
None
)
Returns:
Dict[str, Any]: The results of the benchmark.
construct_tool_descriptions
Construct tool descriptions from function definitions and descriptions.
construct_prompt
Construct prompt from tools and input.
parse_function_call
Parse a function call string to extract the function name, positional arguments, and keyword arguments, including nested function calls.
Parameters:
- call (str): A string in the format
func(arg1, arg2, kwarg=value)
.
Returns:
tuple: (function_name (str), positional_args (list), keyword_args (dict)) or (None, None, None).
compare_function_calls
Compare the function name and arguments of agent_call and ground_truth_call.
Parameters:
- agent_call (str): Function call by agent.
- ground_truth_call (str): Ground truth function call.
Returns:
True
if the function names and arguments match.False
otherwise.