> ## Documentation Index
> Fetch the complete documentation index at: https://docs.camel-ai.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Camel.benchmarks.nexus

<a id="camel.benchmarks.nexus" />

<a id="camel.benchmarks.nexus.NexusSample" />

## NexusSample

```python theme={"system"}
class NexusSample:
```

Nexus benchmark dataset sample.

<a id="camel.benchmarks.nexus.NexusBenchmark" />

## NexusBenchmark

```python theme={"system"}
class NexusBenchmark(BaseBenchmark):
```

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`)

<a id="camel.benchmarks.nexus.NexusBenchmark.__init__" />

### **init**

```python theme={"system"}
def __init__(
    self,
    data_dir: str,
    save_to: str,
    processes: int = 1
):
```

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`)

<a id="camel.benchmarks.nexus.NexusBenchmark.download" />

### download

```python theme={"system"}
def download(self):
```

Download the Nexus Functional Calling Benchmark dataset.

<a id="camel.benchmarks.nexus.NexusBenchmark.load" />

### load

```python theme={"system"}
def load(self, dataset_name: str, force_download: bool = False):
```

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.

<a id="camel.benchmarks.nexus.NexusBenchmark.train" />

### train

```python theme={"system"}
def train(self):
```

Get the training set.

<a id="camel.benchmarks.nexus.NexusBenchmark.run" />

### run

```python theme={"system"}
def run(
    self,
    agent: ChatAgent,
    task: Literal['NVDLibrary', 'VirusTotal', 'OTX', 'PlacesAPI', 'ClimateAPI', 'VirusTotal-ParallelCalls', 'VirusTotal-NestedCalls', 'NVDLibrary-NestedCalls'],
    randomize: bool = False,
    subset: Optional[int] = None
):
```

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.

<a id="camel.benchmarks.nexus.construct_tool_descriptions" />

## construct\_tool\_descriptions

```python theme={"system"}
def construct_tool_descriptions(dataset_name: str):
```

Construct tool descriptions from function definitions and
descriptions.

<a id="camel.benchmarks.nexus.construct_prompt" />

## construct\_prompt

```python theme={"system"}
def construct_prompt(input: str, tools: str):
```

Construct prompt from tools and input.

<a id="camel.benchmarks.nexus.parse_function_call" />

## parse\_function\_call

```python theme={"system"}
def parse_function_call(call: str):
```

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).

<a id="camel.benchmarks.nexus.compare_function_calls" />

## compare\_function\_calls

```python theme={"system"}
def compare_function_calls(agent_call: str, ground_truth_call: str):
```

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.
