mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-07 13:15:00 +00:00
Set a tool_call_limit of 25
This commit is contained in:
parent
7eaa92b70f
commit
6a9b72e5b3
3 changed files with 29 additions and 32 deletions
|
@ -92,6 +92,8 @@ class Coder:
|
||||||
last_keyboard_interrupt = None
|
last_keyboard_interrupt = None
|
||||||
num_reflections = 0
|
num_reflections = 0
|
||||||
max_reflections = 3
|
max_reflections = 3
|
||||||
|
num_tool_calls = 0
|
||||||
|
max_tool_calls = 25
|
||||||
edit_format = None
|
edit_format = None
|
||||||
yield_stream = False
|
yield_stream = False
|
||||||
temperature = None
|
temperature = None
|
||||||
|
@ -1475,7 +1477,8 @@ class Coder:
|
||||||
|
|
||||||
tool_call_response = litellm.stream_chunk_builder(self.partial_response_tool_call)
|
tool_call_response = litellm.stream_chunk_builder(self.partial_response_tool_call)
|
||||||
|
|
||||||
if tool_call_response:
|
if tool_call_response and self.num_tool_calls < self.max_tool_calls:
|
||||||
|
self.num_tool_calls += 1
|
||||||
tool_responses = self.execute_tool_calls(tool_call_response)
|
tool_responses = self.execute_tool_calls(tool_call_response)
|
||||||
|
|
||||||
# Add the assistant message with tool calls
|
# Add the assistant message with tool calls
|
||||||
|
@ -1487,7 +1490,10 @@ class Coder:
|
||||||
self.cur_messages.append(tool_response)
|
self.cur_messages.append(tool_response)
|
||||||
|
|
||||||
return self.run(with_message="Continue", preproc=False)
|
return self.run(with_message="Continue", preproc=False)
|
||||||
|
elif self.num_tool_calls >= self.max_tool_calls:
|
||||||
|
self.io.tool_warning(f"Only {self.max_tool_calls} tool calls allowed, stopping.")
|
||||||
|
|
||||||
|
self.tool_call_limit = 0
|
||||||
try:
|
try:
|
||||||
if self.reply_completed():
|
if self.reply_completed():
|
||||||
return
|
return
|
||||||
|
|
|
@ -198,7 +198,6 @@ class GUI:
|
||||||
)
|
)
|
||||||
|
|
||||||
for fname in fnames:
|
for fname in fnames:
|
||||||
print(fname)
|
|
||||||
if fname not in self.coder.get_inchat_relative_files():
|
if fname not in self.coder.get_inchat_relative_files():
|
||||||
self.coder.add_rel_fname(fname)
|
self.coder.add_rel_fname(fname)
|
||||||
self.info(f"Added {fname} to the chat")
|
self.info(f"Added {fname} to the chat")
|
||||||
|
|
|
@ -16,36 +16,10 @@ for more information.
|
||||||
|
|
||||||
You have two ways of sharing your MCP server configuration with Aider.
|
You have two ways of sharing your MCP server configuration with Aider.
|
||||||
|
|
||||||
### 1. Using a JSON string
|
{: .note }
|
||||||
|
Today, Aider only supports connecting to MCP servers using the stdio transport
|
||||||
|
|
||||||
You can specify MCP servers directly on the command line using the `--mcp-servers` option with a JSON string:
|
### Config Files
|
||||||
|
|
||||||
```bash
|
|
||||||
aider --mcp-servers '{"mcpServers":{"git":{"command":"uvx","args":["mcp-server-git"]}}}'
|
|
||||||
```
|
|
||||||
|
|
||||||
### 2. Using a configuration file
|
|
||||||
|
|
||||||
Alternatively, you can store your MCP server configurations in a JSON file and reference it with the `--mcp-servers-file` option:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
aider --mcp-servers-file mcp.json
|
|
||||||
```
|
|
||||||
|
|
||||||
Example `mcp.json` file:
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"mcpServers": {
|
|
||||||
"git": {
|
|
||||||
"command": "uvx",
|
|
||||||
"args": ["mcp-server-git"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## YAML Configuration
|
|
||||||
|
|
||||||
You can also configure MCP servers in your `.aider.conf.yml` file:
|
You can also configure MCP servers in your `.aider.conf.yml` file:
|
||||||
|
|
||||||
|
@ -69,7 +43,25 @@ mcp-servers-file: /path/to/mcp.json
|
||||||
|
|
||||||
These options are configurable in any of Aider's config file formats.
|
These options are configurable in any of Aider's config file formats.
|
||||||
|
|
||||||
## Environment Variables
|
### Flags
|
||||||
|
|
||||||
|
You can specify MCP servers directly on the command line using the `--mcp-servers` option with a JSON string:
|
||||||
|
|
||||||
|
#### Using a JSON String
|
||||||
|
|
||||||
|
```bash
|
||||||
|
aider --mcp-servers '{"mcpServers":{"git":{"command":"uvx","args":["mcp-server-git"]}}}'
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Using a configuration file
|
||||||
|
|
||||||
|
Alternatively, you can store your MCP server configurations in a JSON file and reference it with the `--mcp-servers-file` option:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
aider --mcp-servers-file mcp.json
|
||||||
|
```
|
||||||
|
|
||||||
|
### Environment Variables
|
||||||
|
|
||||||
You can also configure MCP servers using environment variables in your `.env` file:
|
You can also configure MCP servers using environment variables in your `.env` file:
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue