Skip to content

armgit / camel

Public Imported from GitHub
0

🐫 CAMEL: The first and the best multi-agent framework. Finding the Scaling Law of Agents. https://www.camel-ai.org

1.2 KB
Raw Blame
<a id="camel.terminators.token_limit_terminator"></a>

<a id="camel.terminators.token_limit_terminator.TokenLimitTerminator"></a>

## TokenLimitTerminator

```python
class TokenLimitTerminator(BaseTerminator):
```

Terminate agent if number of tokens reached to token limit threshold.

**Parameters:**

- **token_limit** (int): Token limit threshold.

<a id="camel.terminators.token_limit_terminator.TokenLimitTerminator.__init__"></a>

### __init__

```python
def __init__(self, token_limit: int):
```

<a id="camel.terminators.token_limit_terminator.TokenLimitTerminator._validate"></a>

### _validate

```python
def _validate(self):
```

<a id="camel.terminators.token_limit_terminator.TokenLimitTerminator.is_terminated"></a>

### is_terminated

```python
def is_terminated(self, num_tokens: int):
```

Whether terminate the agent by checking number of
used tokens reached to token limit.

**Parameters:**

- **num_tokens** (int): Number of tokens.

**Returns:**

  tuple: A tuple containing whether the agent should be
terminated and a string of termination reason.

<a id="camel.terminators.token_limit_terminator.TokenLimitTerminator.reset"></a>

### reset

```python
def reset(self):
```

Reset the terminator.