Skip to content

aider with ollama fails when generating a commit message #624

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

Closed
yrobla opened this issue Jan 16, 2025 · 0 comments · Fixed by #640
Closed

aider with ollama fails when generating a commit message #624

yrobla opened this issue Jan 16, 2025 · 0 comments · Fixed by #640
Assignees

Comments

@yrobla
Copy link
Contributor

yrobla commented Jan 16, 2025

Describe the issue

When a commit message is proposed for an specific file edit, we get error:
litellm.APIConnectionError: Ollama_chatException - Extra data: line 2 column 1 (char 437)

I debugged the issue and it was narrowed at the step when aider generates a commit message, using LLM, and sends a request like:

in send completion
{'model': 'ollama_chat/qwen2.5-coder:7b', 'messages': [{'role': 'system', 'content': 'You are an expert software engineer that generates concise, one-line Git commit messages based on the provided diffs.\nReview the provided context and diffs which are about to be committed to a git repo.\nReview the diffs carefully.\nGenerate a one-line commit message for those changes.\nThe commit message should be structured as follows: : \nUse these for : fix, feat, build, chore, ci, docs, style, refactor, perf, test\n\nEnsure the commit message:\n- Starts with the appropriate prefix.\n- Is in the imperative mood (e.g., "Add feature" not "Added feature" or "Adding feature").\n- Does not exceed 72 characters.\n\nReply only with the one-line commit message, without any additional text, explanations, or line breaks.\n'}, {'role': 'user', 'content': '# Diffs:\ndiff --git a/app.py b/app.py\nindex abc9ebf..230525e 100644\n--- a/app.py\n+++ b/app.py\n@@ -4,11 +4,3 @@ def hello():\n Returns a greeting message. Checks for the presence of a GitHub token\n and returns a specific message if the token is found.\n """\n- GITHUB_TOKEN="xxxx"\n- AWS_ACCESS_KEY_ID="xxx"\n- AWS_SECRET_ACCESS_KEY="xxx"\n- GITHUB_TOKEN="xxx"\n- if GITHUB_TOKEN:\n- return "Hello from Python 3.8 inside an EC2 instance running on Fargate, with a Github Token like this one in the code base!!"\n- else:\n- return "Hello, Mars! We have no token here"'}], 'stream': False}

Litellm fails directly, seems we are sending some malformed json.

Steps to Reproduce

Have this file:

@app.route('/')
def hello():
"""
Returns a greeting message. Checks for the presence of a GitHub token
and returns a specific message if the token is found.
"""
GITHUB_TOKEN="xxx"
AWS_ACCESS_KEY_ID="xx"
AWS_SECRET_ACCESS_KEY="xx/K7MDENG/bPxRfiCYEXAMPLEKEY"
GITHUB_TOKEN="xx"
if GITHUB_TOKEN:
return "Hello from Python 3.8 inside an EC2 instance running on Fargate, with a Github Token like this one in the code base!!"
else:
return "Hello, Mars! We have no token here"

Execute: aider app.py --model "ollama_chat/qwen2.5-coder:7b" --message "explain this app line by line"

and wait until the commit generation step

Operating System

MacOS (Arm)

IDE and Version

aider

Extension and Version

latest

Provider

Ollama

Model

qwen

Logs

No response

Additional Context

No response

@yrobla yrobla added the bug label Jan 16, 2025
@yrobla yrobla self-assigned this Jan 16, 2025
yrobla added a commit that referenced this issue Jan 17, 2025
Aider is sending a mix of requests that need stream or sync processing
and we were hardcoding stream to True. Instead, pick if from the request
and also fix the formatting of the json response

Closes: #624
yrobla added a commit that referenced this issue Jan 17, 2025
Aider is sending a mix of requests that need stream or sync processing
and we were hardcoding stream to True. Instead, pick if from the request
and also fix the formatting of the json response

Closes: #624
yrobla added a commit that referenced this issue Jan 17, 2025
Aider is sending a mix of requests that need stream or sync processing
and we were hardcoding stream to True. Instead, pick if from the request
and also fix the formatting of the json response

Closes: #624
yrobla added a commit that referenced this issue Jan 17, 2025
Aider is sending a mix of requests that need stream or sync processing
and we were hardcoding stream to True. Instead, pick if from the request
and also fix the formatting of the json response

Closes: #624
yrobla added a commit that referenced this issue Jan 17, 2025
Aider is sending a mix of requests that need stream or sync processing
and we were hardcoding stream to True. Instead, pick if from the request
and also fix the formatting of the json response

Closes: #624
@yrobla yrobla closed this as completed in b7fc192 Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant