forked from Aider-AI/aider
-
Notifications
You must be signed in to change notification settings - Fork 0
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
krrishdholakia
wants to merge
395
commits into
nickotto:main
Choose a base branch
from
krrishdholakia:patch-2
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…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
Openrouter compatibility
…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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
I'd love to know if this solves a problem for you