Coder Social home page Coder Social logo

Comments (9)

paul-gauthier avatar paul-gauthier commented on August 15, 2024 1

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.

paul-gauthier avatar paul-gauthier commented on August 15, 2024 1

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.

mikeplavsky avatar mikeplavsky commented on August 15, 2024 1

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.

paul-gauthier avatar paul-gauthier commented on August 15, 2024 1

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.

mikeplavsky avatar mikeplavsky commented on August 15, 2024

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.

paul-gauthier avatar paul-gauthier commented on August 15, 2024

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.

mikeplavsky avatar mikeplavsky commented on August 15, 2024

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.

mikeplavsky avatar mikeplavsky commented on August 15, 2024

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.

mikeplavsky avatar mikeplavsky commented on August 15, 2024

Fixed

from aider.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.