Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test New LLMs (Llama2, CodeLlama, etc.) on Aider? #1

Open
wants to merge 395 commits into
base: main
Choose a base branch
from

Conversation

krrishdholakia
Copy link

Hi @nickotto,

Notice you forked Aider. if you're trying to test other LLMs (codellama, wizardcoder, etc.) with it, I just wrote a 1-click proxy to translate openai calls to huggingface, anthropic, togetherai, etc. api calls.

code

$ pip install litellm

$ litellm --model huggingface/bigcode/starcoder

#INFO:     Uvicorn running on http://0.0.0.0:8000

$ aider --openai-api-base http://0.0.0.0:8000

I'd love to know if this solves a problem for you

paul-gauthier and others added 30 commits July 26, 2023 17:35
…d to account for the prices in `Model` being per 1k tokens.

# Aider chat conversation:

USER: the prices in `Model` are per 1k tokens

ASSISTANT: I see, the prices in the `Model` class are per 1k tokens. Therefore, we need to adjust the calculation of the cost in the `cmd_tokens` method in the `Commands` class in the `aider/commands.py` file.

We will divide the `completion_price` by 1000 before multiplying it with the token count to get the cost.

Here are the changes:

<source>python
aider/commands.py
<<<<<<< ORIGINAL
        total = 0
        total_cost = 0.0
        for tk, msg, tip in res:
            total += tk
            cost = tk * self.coder.main_model.completion_price
            total_cost += cost
            msg = msg.ljust(col_width)
            self.io.tool_output(f"{fmt(tk)} {msg} {tip} (cost: ${cost:.2f})")

        self.io.tool_output("=" * width)
        self.io.tool_output(f"{fmt(total)} tokens total (cost: ${total_cost:.2f})")
=======
        total = 0
        total_cost = 0.0
        for tk, msg, tip in res:
            total += tk
            cost = tk * (self.coder.main_model.completion_price / 1000)
            total_cost += cost
            msg = msg.ljust(col_width)
            self.io.tool_output(f"{fmt(tk)} {msg} {tip} (cost: ${cost:.2f})")

        self.io.tool_output("=" * width)
        self.io.tool_output(f"{fmt(total)} tokens total (cost: ${total_cost:.2f})")
>>>>>>> UPDATED
</source>
Automatically summarize earlier parts of the chat history
JV and others added 30 commits August 23, 2023 14:39
…is` instead of `==` in `aider/history.py`, `aider/models/__init__.py`, and `aider/models/openrouter.py`.

# Aider chat conversation:

USER: I ran this command:

 pre-commit run --all-files

And got this output:

isort....................................................................Passed
black....................................................................Passed
flake8...................................................................Failed
- hook id: flake8
- exit code: 1

aider/history.py:4:1: F401 'tiktoken' imported but unused
import tiktoken
^
aider/models/__init__.py:2:1: F401 '.openai.OpenAIModel' imported but unused
from .openai import OpenAIModel
^
aider/models/__init__.py:3:1: F401 '.openrouter.OpenRouterModel' imported but unused
from .openrouter import OpenRouterModel
^
aider/models/openrouter.py:26:33: E711 comparison to None should be 'if cond is None:'
        if cached_model_details == None:
                                ^

ASSISTANT: It seems like there are some unused imports and a comparison to None that is not following the Pythonic way. To fix these issues, we need to modify the following files:

1. `aider/history.py`
2. `aider/models/__init__.py`
3. `aider/models/openrouter.py`

Please add these files to the chat so I can propose the necessary changes.

USER: I added these *read-write* files: aider/history.py, aider/models/openrouter.py, aider/models/__init__.py

ASSISTANT: Great! Now, let's make the necessary changes to these files.

First, in `aider/history.py`, we need to remove the unused import `tiktoken`.

```python
aider/history.py
<<<<<<< HEAD
import tiktoken
=======
>>>>>>> updated
```

Next, in `aider/models/__init__.py`, we need to remove the unused imports `OpenAIModel` and `OpenRouterModel`.

```python
aider/models/__init__.py
<<<<<<< HEAD
from .openai import OpenAIModel
from .openrouter import OpenRouterModel
=======
>>>>>>> updated
```

Finally, in `aider/models/openrouter.py`, we need to change the comparison to None to use `is` instead of `==`.

```python
aider/models/openrouter.py
<<<<<<< HEAD
        if cached_model_details == None:
=======
        if cached_model_details is None:
>>>>>>> updated
```

These changes should resolve the issues reported by the `flake8` linter.
…usage

only show token costs if usage exists
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants