Commit graph

4669 commits

Author SHA1 Message Date
Paul Gauthier
044ebfabe9 updated docs 2024-06-10 15:35:45 -07:00
Paul Gauthier
33bb362982 moved share/ to website/share/ 2024-06-10 15:34:46 -07:00
Paul Gauthier
5282e6fc4a Merge remote-tracking branch 'origin/main' 2024-06-10 15:34:29 -07:00
Paul Gauthier
ce46ea8d62 moved tests/ to aider/tests/ 2024-06-10 15:33:49 -07:00
Paul Gauthier
470b8d0251 Show model warnings in normal color, not red/error 2024-06-10 15:23:33 -07:00
paul-gauthier
d05f8e77b4
Merge pull request #661 from prmbiy/patch-1
Fixed typo in repomap.md - missing verb in 'More Info' section
2024-06-10 05:57:50 -07:00
prmbiy
896387c210
Update repomap.md - missing verb in 'More Info' section 2024-06-10 13:59:07 +05:30
paul-gauthier
7eb60bbc23
Update commands.md 2024-06-09 11:28:41 -07:00
paul-gauthier
1566ba84a0
Merge pull request #653 from develmusa/main 2024-06-09 06:00:26 -07:00
develmusa
098944a133 Update help text for specifying the API key to mention Anthropic instead of OpenAI. 2024-06-09 12:35:42 +02:00
Paul Gauthier
2e3a68ba6c copy 2024-06-08 21:26:31 -07:00
Paul Gauthier
cb79497edc copy 2024-06-08 21:04:53 -07:00
Paul Gauthier
cfec622707 Added codestral 2024-06-08 20:37:29 -07:00
Paul Gauthier
effc88a887 Added gemini-1.5-flash-latest data 2024-06-08 17:02:01 -07:00
Paul Gauthier
86ea47f791 added together_ai/qwen/Qwen2-72B-Instruct data 2024-06-08 16:43:28 -07:00
Paul Gauthier
02c7335aa7 copy 2024-06-08 15:50:29 -07:00
Paul Gauthier
1a97498ee9 copy 2024-06-08 14:37:35 -07:00
Paul Gauthier
48aa0a4f77 added install demo video 2024-06-08 14:33:57 -07:00
Paul Gauthier
88ea4198ea added descriptions 2024-06-08 13:57:16 -07:00
Paul Gauthier
36dab7d89f copy 2024-06-08 13:42:58 -07:00
Paul Gauthier
4cbeb59bec browser ver should stop after 3 reflections 2024-06-08 13:38:18 -07:00
Paul Gauthier
8d3a320ab3 log the announcements in the gui too 2024-06-08 13:31:40 -07:00
Paul Gauthier
d2b9eec3e0 fixed bad url; fixed max_reflection logic 2024-06-08 12:57:36 -07:00
Paul Gauthier
2d55d532be aider: Add test to ensure all URLs return a 200 status code.
# Aider chat conversation:

USER: write a test that makes sure all the urls are 200

ASSISTANT: Here is the test to ensure all the URLs return a 200 status code:

tests/test_urls.py
```python
<<<<<<< SEARCH
=======
import requests
from aider import urls

def test_urls():
    url_attributes = [attr for attr in dir(urls) if not callable(getattr(urls, attr)) and not attr.startswith("__")]
    for attr in url_attributes:
        url = getattr(urls, attr)
        response = requests.get(url)
        assert response.status_code == 200, f"URL {url} returned status code {response.status_code}"
>>>>>>> REPLACE
```
2024-06-08 12:55:13 -07:00
Paul Gauthier
1f1da4b1a2 refac all urls into urls.py 2024-06-08 12:53:54 -07:00
Paul Gauthier
09d3d02971 more conservative reflection if 2024-06-08 12:40:35 -07:00
Paul Gauthier
af21315d51 copy 2024-06-08 12:40:23 -07:00
Paul Gauthier
8f70c359a6 copy 2024-06-08 12:10:33 -07:00
Paul Gauthier
4a55258009 copy 2024-06-08 10:39:26 -07:00
Paul Gauthier
4017c47406 copy 2024-06-08 10:27:05 -07:00
Paul Gauthier
74e51d5c31 copy 2024-06-08 10:04:02 -07:00
Paul Gauthier
0882ae9982 copy 2024-06-08 10:00:16 -07:00
Daniel Vainsencher
e6e360a4ef Added support for logging LLM history to a specified file. 2024-06-07 10:40:32 -04:00
Daniel Vainsencher
8896909e19 aider: Capitalize the "ASSISTANT" role when logging to the LLM history file.
# Aider chat conversation:

USER: When logging to llm history file, capitalize the ASSISTANT role.

ASSISTANT: To capitalize the "ASSISTANT" role when logging to the LLM history file, we need to modify the `send_new_user_message` method in `aider/coders/base_coder.py`.

Here is the *SEARCH/REPLACE* block:

aider/coders/base_coder.py
```python
<<<<<<< SEARCH
        with open('.aider.llm.history', 'a') as log_file:
            log_file.write(f"LLM RESPONSE {timestamp}\n")
            log_file.write(format_content("assistant", content) + "\n")
=======
        with open('.aider.llm.history', 'a') as log_file:
            log_file.write(f"LLM RESPONSE {timestamp}\n")
            log_file.write(format_content("ASSISTANT", content) + "\n")
>>>>>>> REPLACE
```
2024-06-07 09:39:03 -04:00
Daniel Vainsencher
2bd5daf2ad aider: Add logging of conversation between coder and LLM in .aider.llm.history file using new formatting functions in send_new_user_message.
# Aider chat conversation:

USER: We want to add logging of the conversation between coder and the LLM into a new file called .aider.llm.history. The formatting should be done using the new format_messages and format_content. Modify only the `send_new_user_message` function in base_coder, formatting and logging `messages` as soon as it is defined, and logging `content` before `tool_output`. Precede them by a single line saying "TO LLM {timestamp}" and "LLM RESPONSE {timestamp}" where the timestamp is uses ISO date format and has second precision.

ASSISTANT: To implement the logging of the conversation between the coder and the LLM, we will:

1. Format and log `messages` as soon as it is defined in `send_new_user_message`.
2. Log `content` before `tool_output`.
3. Precede the logs with a timestamp in ISO date format with second precision.

Here are the *SEARCH/REPLACE* blocks:

aider/coders/base_coder.py
```python
<<<<<<< SEARCH
        messages = self.format_messages()
=======
        import datetime
        from aider.utils import format_messages, format_content

        messages = self.format_messages()

        timestamp = datetime.datetime.now().isoformat(timespec='seconds')
        with open('.aider.llm.history', 'a') as log_file:
            log_file.write(f"TO LLM {timestamp}\n")
            log_file.write(format_messages(messages) + "\n")
>>>>>>> REPLACE
```

aider/coders/base_coder.py
```python
<<<<<<< SEARCH
        self.io.tool_output()
=======
        self.io.tool_output()

        timestamp = datetime.datetime.now().isoformat(timespec='seconds')
        with open('.aider.llm.history', 'a') as log_file:
            log_file.write(f"LLM RESPONSE {timestamp}\n")
            log_file.write(format_content("assistant", content) + "\n")
>>>>>>> REPLACE
```
2024-06-07 09:39:03 -04:00
Daniel Vainsencher
abf8d5e60d aider: Refactored format_messages to use a new function format_content for line-by-line formatting.
# Aider chat conversation:

USER: Now refactor format_messages: extract a function that takes a role and content (where content is a string), and returns the line by line formatted string.

ASSISTANT: To refactor `format_messages`, we will:

1. Create a new function `format_content` that takes a role and content (where content is a string) and returns the line-by-line formatted string.
2. Update `format_messages` to use `format_content`.

Here are the *SEARCH/REPLACE* blocks:

aider/utils.py
```python
<<<<<<< SEARCH
def format_messages(messages, title=None):
=======
def format_content(role, content):
    formatted_lines = []
    for line in content.splitlines():
        formatted_lines.append(f"{role} {line}")
    return "\n".join(formatted_lines)

>>>>>>> REPLACE
```

aider/utils.py
```python
<<<<<<< SEARCH
        elif isinstance(content, str):  # Handle string content
            for line in content.splitlines():
                output.append(f"{role} {line}")
=======
        elif isinstance(content, str):  # Handle string content
            output.append(format_content(role, content))
>>>>>>> REPLACE
```

USER:
# Fix any errors below, if possible.

## Running: flake8 --select=E9,F821,F823,F831,F406,F407,F701,F702,F704,F706 --show-source --isolated aider/utils.py

aider/utils.py:94:8: F821 undefined name 'title'
    if title:
       ^
aider/utils.py:95:26: F821 undefined name 'title'
        output.append(f"{title.upper()} {'*' * 50}")
                         ^
aider/utils.py:97:16: F821 undefined name 'messages'
    for msg in messages:
               ^
aider/utils.py:115:24: F821 undefined name 'format_messages'
    formatted_output = format_messages(messages, title)
                       ^

## See relevant lines below marked with █.

aider/utils.py:
...⋮...
 87│def format_content(role, content):
 88│    formatted_lines = []
...⋮...
 91│    return "\n".join(formatted_lines)
 92│
 93│    output = []
 94█    if title:
 95█        output.append(f"{title.upper()} {'*' * 50}")
 96│
 97█    for msg in messages:
 98│        output.append("")
 99│        role = msg["role"].upper()
100│        content = msg.get("content")
...⋮...
112│
113│
114│def show_messages(messages, title=None, functions=None):
115█    formatted_output = format_messages(messages, title)
116│    print(formatted_output)
117│
118│    if functions:
...⋮...

ASSISTANT: To fix the errors, we need to ensure that the `format_messages` function is properly defined and that the misplaced code is correctly organized. Here are the corrected *SEARCH/REPLACE* blocks:

aider/utils.py
```python
<<<<<<< SEARCH
    return "\n".join(formatted_lines)

    output = []
    if title:
        output.append(f"{title.upper()} {'*' * 50}")

    for msg in messages:
        output.append("")
        role = msg["role"].upper()
        content = msg.get("content")
        if isinstance(content, list):  # Handle list content (e.g., image messages)
            for item in content:
                if isinstance(item, dict) and "image_url" in item:
                    output.append(f"{role} Image URL: {item['image_url']['url']}")
        elif isinstance(content, str):  # Handle string content
            output.append(format_content(role, content))
        content = msg.get("function_call")
        if content:
            output.append(f"{role} {content}")

    return "\n".join(output)
=======
    return "\n".join(formatted_lines)

def format_messages(messages, title=None):
    output = []
    if title:
        output.append(f"{title.upper()} {'*' * 50}")

    for msg in messages:
        output.append("")
        role = msg["role"].upper()
        content = msg.get("content")
        if isinstance(content, list):  # Handle list content (e.g., image messages)
            for item in content:
                if isinstance(item, dict) and "image_url" in item:
                    output.append(f"{role} Image URL: {item['image_url']['url']}")
        elif isinstance(content, str):  # Handle string content
            output.append(format_content(role, content))
        content = msg.get("function_call")
        if content:
            output.append(f"{role} {content}")

    return "\n".join(output)
>>>>>>> REPLACE
```
2024-06-07 09:39:03 -04:00
Daniel Vainsencher
a0b279f105 Refactored format_messages to use format_content for string content handling. 2024-06-07 09:39:03 -04:00
Daniel Vainsencher
69c27d6cd1 aider: Refactored show_messages to call format_messages for formatting title and messages.
# Aider chat conversation:

USER: Refactor show_messages in utils, so that the formatting of title and messages is done in a separate function which returns a string. show_messages should call it and print its output.

ASSISTANT: To refactor the `show_messages` function, we will:

1. Create a new function `format_messages` that formats the title and messages and returns a string.
2. Update `show_messages` to call `format_messages` and print its output.

Here are the *SEARCH/REPLACE* blocks:

aider/utils.py
```python
<<<<<<< SEARCH
def show_messages(messages, title=None, functions=None):
    if title:
        print(title.upper(), "*" * 50)

    for msg in messages:
        print()
        role = msg["role"].upper()
        content = msg.get("content")
        if isinstance(content, list):  # Handle list content (e.g., image messages)
            for item in content:
                if isinstance(item, dict) and "image_url" in item:
                    print(role, "Image URL:", item["image_url"]["url"])
        elif isinstance(content, str):  # Handle string content
            for line in content.splitlines():
                print(role, line)
        content = msg.get("function_call")
        if content:
            print(role, content)

    if functions:
        dump(functions)
=======
def format_messages(messages, title=None):
    output = []
    if title:
        output.append(f"{title.upper()} {'*' * 50}")

    for msg in messages:
        output.append("")
        role = msg["role"].upper()
        content = msg.get("content")
        if isinstance(content, list):  # Handle list content (e.g., image messages)
            for item in content:
                if isinstance(item, dict) and "image_url" in item:
                    output.append(f"{role} Image URL: {item['image_url']['url']}")
        elif isinstance(content, str):  # Handle string content
            for line in content.splitlines():
                output.append(f"{role} {line}")
        content = msg.get("function_call")
        if content:
            output.append(f"{role} {content}")

    return "\n".join(output)

def show_messages(messages, title=None, functions=None):
    formatted_output = format_messages(messages, title)
    print(formatted_output)

    if functions:
        dump(functions)
>>>>>>> REPLACE
```
2024-06-07 09:39:03 -04:00
Paul Gauthier
be0520f62f copy 2024-06-07 05:30:18 -07:00
Paul Gauthier
f2de9d26c7 added techfren video to tutorials 2024-06-07 05:27:32 -07:00
Paul Gauthier
2be24f207f copy 2024-06-06 16:44:00 -07:00
Paul Gauthier
329e16e59b copy 2024-06-06 16:42:24 -07:00
Paul Gauthier
519b95713b browser blog & doc need to be separate 2024-06-06 16:05:13 -07:00
Paul Gauthier
435e9a0d86 fixing broken links 2024-06-06 16:00:17 -07:00
Paul Gauthier
f760eacfd6 fixed link 2024-06-06 15:25:23 -07:00
Paul Gauthier
f97ed15dd3 fixed broken links 2024-06-06 15:14:41 -07:00
Paul Gauthier
fa3df117d9 copy 2024-06-06 14:52:31 -07:00
Paul Gauthier
30f4a905c1 renamed config/options and get_md_help() 2024-06-06 14:00:14 -07:00
Paul Gauthier
53deb04e75 use dashed-names not underscore_names in yaml 2024-06-06 13:46:32 -07:00
Paul Gauthier
65c9a7866a improved handling of defaults 2024-06-06 13:40:16 -07:00