paul-gauthier / aider

aider is AI pair programming in your terminal
https://aider.chat/
Apache License 2.0
16.7k stars 1.57k forks source link

bug on rust debugging #830

Closed sprappcom closed 4 weeks ago

sprappcom commented 1 month ago

Issue

The LLM did not conform to the edit format.
https://aider.chat/docs/troubleshooting/edit-errors.html

# 1 SEARCH/REPLACE block failed to match!

## SearchReplaceNoExactMatch: This SEARCH block failed to exactly match lines in src/main.rs
<<<<<<< SEARCH
use rust_lru_cache::{Cache, Config, MemoryType, GB};
use rand::{Rng, thread_rng};
use std::time::{Instant, Duration};
use std::sync::{Arc, atomic::{AtomicUsize, Ordering}};
use std::threa
=======
use rust_lru_cache::{Cache, Config, MemoryType, GB};
use rand::{Rng, thread_rng};
use std::time::{Instant, Duration};
use std::sync::{Arc, atomic::{AtomicUsize, Ordering}};
use std::thread;
use log::info;
>>>>>>> REPLACE

Did you mean to match some of these actual lines from src/main.rs?

use rust_lru_cache::{Cache, Config, MemoryType, GB}; use rand::{Rng, thread_rng}; use std::time::{Instant, Duration}; use std::sync::{Arc, atomic::{AtomicUsize, Ordering}}; use std::thread;

const NUM_KEYS: usize = 1_000_000; const NUM_THREADS: usize = 8; const TEST_DURATION: Duration = Duration::from_secs(10);


The SEARCH section must exactly match an existing block of lines including all white space, comments, indentation, 
docstrings, etc

# The other 6 SEARCH/REPLACE blocks were applied successfully.
Don't re-send them.
Just reply with fixed versions of the block above that failed to match.

Version and model info

latest version as of today. ubuntu 24.04 sonnet 3.5

paul-gauthier commented 1 month ago

Thanks for trying aider and filing this issue. This doc may be helpful:

https://aider.chat/docs/troubleshooting/edit-errors.html

When reporting problems, it is very helpful if you can provide:

Including the “announcement” lines that aider prints at startup is an easy way to share some of this helpful info.

Aider v0.37.1-dev
Models: gpt-4o with diff edit format, weak model gpt-3.5-turbo
Git repo: .git with 243 files
Repo-map: using 1024 tokens
sprappcom commented 1 month ago
  1. latest aider version as of today
  2. claude sonnet 3.5 api / openai (both show same results sometimes)
  3. none
  4. programming in rustlang. (it's great when the above error is not present.)
olafgeibig commented 1 month ago

Same problem. For me this looks like an incomplete LLM response which wouldn't be aider's fault.

Aider v0.45.1
Model: anthropic.claude-3-5-sonnet-20240620-v1:0 with diff edit format
Git repo: .git with 83 files
Repo-map: using 1024 tokens

Output:

crews/tooltest/tooltest/main.py
```python
<<<<<<< SEARCH
def main():
    print("Hello, world!")
=======
from crewai import Agent, Task, Crew
from langchain.llms import OpenAI

def create_simple_agent():
    return Agent(
        role='Simple Agent',
        goal='Perform simple tasks and respond to queries',
        backstory='I am a helpful AI assistant created to assist with various tasks.',
        verbose=True,
        llm=OpenAI(temperature=0.7)
    )

def main():
    simple_agent = create_simple_agent()
    task = Task(
        description="Say hello to the world",
        agent=simple_agent
    )
    crew = Crew(
        agents=[simple_agent],
        tasks

^^^ Incomplete SEARCH/REPLACE block.
paul-gauthier commented 1 month ago

This doc may be helpful:

https://aider.chat/docs/troubleshooting/edit-errors.html

paul-gauthier commented 4 weeks ago

I'm going to close this issue for now, but feel free to add a comment here and I will re-open or file a new issue any time.