Comments (9)
Ah ok, thanks for working through this with me. We need to tell aider to use Azure for the "weak model" too:
Can you try this? Again, with no .aider.conf.yml
. We're just adding: --weak-model azure/<your_deployment_name>
export AZURE_API_KEY=your-key-goes-here
export AZURE_API_VERSION=2023-05-15
export AZURE_API_BASE=https://example-endpoint.openai.azure.com
aider --model azure/<your_deployment_name> --weak-model azure/<your_deployment_name>
from aider.
Ok, thanks. I think I fixed the issue. Thanks again for all the help working through this and debugging it.
The change is available in the main branch. You can get it by installing the latest version from github:
python -m pip install --upgrade git+https://github.com/paul-gauthier/aider.git
If you have a chance to try it, let me know if it works better for you.
from aider.
Thank you a lot. Now it works:
mike@MIKEP01-MAC aider % aider --model azure/gpt-4-turbo --weak-model azure/gpt-4-turbo
Aider v0.29.2-dev
Models: azure/gpt-4-turbo with udiff edit format, weak model azure/gpt-4-turbo
Git repo: .git with 155 files
Repo-map: using 1024 tokens
Use /help to see in-chat commands, run with --help to see cmd line args
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
> Please don't change any code, I am reading.
Understood, I'll wait for your instructions when you're ready.
from aider.
Great! With this new version, you shouldn't need to manually specify --weak-model
. Aider will automatically use the main model as the weak model for azure if none is specified. You can of course specify a different weak model if you'd like.
from aider.
If I follow this example: https://docs.litellm.ai/docs/providers/azure#completion---using-env-variables with the same environment variables I get the answer from Azure OpenAI:
from litellm import completion
completion(model='azure/gpt-4-turbo', messages = [{ "content": "Hello, how are you?","role": "user"}])
ModelResponse(id='chatcmpl-9GeLLl8DLUFM36nGHm8MnH2eJmQxE', choices=[Choices(finish_reason='stop', index=0, message=Message(content="Hello! I'm just a computer program, so I don't have feelings, but I'm here and ready to assist you with any questions or tasks you have. How can I help you today?", role='assistant'))], created=1713755355, model='gpt-4', object='chat.completion', system_fingerprint='fp_2f57f81c11', usage=Usage(completion_tokens=40, prompt_tokens=13, total_tokens=53))
from aider.
Thanks for trying aider and filing this issue. Sorry you're having trouble connecting to Azure. It's possible that something in the latest version isn't working quite right.
Can you try removing your .aider.conf.yml
file and running aider like this:
export AZURE_API_KEY=your-key-goes-here
export AZURE_API_VERSION=2023-05-15
export AZURE_API_BASE=https://example-endpoint.openai.azure.com
aider --model azure/<your_deployment_name>
If that works I can make some changes to aider to make this simpler/easier.
from aider.
Without .aider.config.yml
and with
env | grep AZURE
AZURE_API_BASE=****
AZURE_API_VERSION=2024-02-15-preview
AZURE_API_KEY=****
aider --model azure/gpt-4-turbo
Aider v0.29.1
To use model gpt-3.5-turbo, please set these environment variables:- OPENAI_API_KEY
added this export OPENAI_API_KEY=$AZURE_API_KEY
and it does not work either:
litellm.exceptions.AuthenticationError: OpenAIException - Error code: 401 - {'error': {'message': 'Incorrect API key provided: ******************** You can find your API key at https://platform.openai.com/account/api-keys.', 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_api_key'}}
If I unset OPENAI_API_KEY
and use this aider --model azure/gpt-4-turbo --weak-model azure/gpt-4-turbo
it also crashes:
openai.openaiError: The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable
from aider.
aider --model azure/gpt-4-turbo --weak-model azure/gpt-4-turbo
also crashes:
openai.openaiError: The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable
And if export OPENAI_API_KEY=$AZURE_API_KEY
it crashes with:
litellm.exceptions.AuthenticationError: OpenAIException - Error code: 401 - {'error': {'message': 'Incorrect API key provided: ********************. You can find your API key at https://platform.openai.com/account/api-keys.', 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_api_key'}}
from aider.
Fixed
from aider.
Related Issues (20)
- Suggestion: Multi Agent (Supervisor/Reviewer agent) HOT 2
- Sublime Text (or rather Sublime Merge Support)
- Issue using Azure OpenAI models HOT 4
- Request: add `__main__.py` file so that aider can be run like `python3 -m aider` (for those without configured paths) HOT 5
- Feature Request: allow prompt to be passed in to launch of aider (arg on cli) HOT 1
- Support cursor shape configuration for VI mode from prompt-toolkit
- Analysis of a source file without changing it? HOT 6
- Feature: provide arguments when configuring test-cmd HOT 4
- Feature: configure the amount of retries and allow continueing retrying HOT 1
- Feature; Option to remember the last /add files HOT 3
- Improve the guidance in the `aider -h` for using an Azure API key with Aider HOT 3
- Autocomplete is sometimes slow on moderately sized (300 files) git repos HOT 1
- A comment adder HOT 4
- Bug in `whole` edit format (files created in directory that starts with ###) HOT 4
- Feature: explicit no-retries policy HOT 5
- how can i view the context map? HOT 1
- Add enum options for `OPENAI_API_TYPE` in `aider -h` HOT 1
- Ollama with codestral freeze HOT 2
- OpenRouter models are not recognised HOT 1
- Aider not issuing a diff HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aider.