paul-gauthier / aider

aider is AI pair programming in your terminal
https://aider.chat/
Apache License 2.0
19.41k stars 1.79k forks source link

Steps missing for dockerized aider with azure-openai : I ran aider as a docker and connect to my azure open ai, find the exceptions below. #1819

Closed brettleehari closed 2 hours ago

brettleehari commented 3 hours ago

Issue

While trying to pass the azureopenai as environment variable. I followed the below steps, as specific step required for azure-open-ai is not given. It exists for claude and open-ai. Both step-3 and step-4 failed.

  1. Get into a git repo
  2. pull the aider image from dockerhub
  3. I exported all the variable for azure_api required for aider then ran a command line as per the guide.
  4. docker run -it --user $(id -u):$(id -g) --volume $(pwd):/app paulgauthier/aider --AZURE_API_KEY $AZURE_API_KEY --AZURE_API_VERSION $AZURE_API_VERSION --AZURE_API_BASE $AZURE_API_BASE
  5. Tried to improvize : aun the container with environment variables : docker run -e AZURE_API_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -e AZURE_API_VERSION=2023-05-15 -e AZURE_API_BASE=https://ai-foundation-api.app/ai-foundation/chat-ai/gpt4 paulgauthier/aider

Step-4 : Response : Looks like we cannot provide arguments other than openai and claude. docker run -it --user $(id -u):$(id -g) --volume $(pwd):/app paulgauthier/aider --AZURE_API_KEY $AZURE_API_KEY --AZURE_API_VERSION $AZURE_API_VERSION --AZURE_API_BASE $AZURE_API_BASE usage: aider [-h] [--openai-api-key OPENAI_API_KEY] [--anthropic-api-key ANTHROPIC_API_KEY] [--model MODEL] [--opus] [--sonnet] [--4] [--4o] [--mini] [--4-turbo] [--35turbo] [--deepseek] [--list-models MODEL] [--openai-api-base OPENAI_API_BASE] [--openai-api-type OPENAI_API_TYPE] [--openai-api-version OPENAI_API_VERSION] [--openai-api-deployment-id OPENAI_API_DEPLOYMENT_ID] [--openai-organization-id OPENAI_ORGANIZATION_ID] [--model-settings-file MODEL_SETTINGS_FILE] [--model-metadata-file MODEL_METADATA_FILE] [--verify-ssl | --no-verify-ssl] [--edit-format EDIT_FORMAT] [--weak-model WEAK_MODEL] [--show-model-warnings | --no-show-model-warnings] [--map-tokens MAP_TOKENS] [--map-refresh {auto,always,files,manual}] [--cache-prompts | --no-cache-prompts] [--cache-keepalive-pings CACHE_KEEPALIVE_PINGS] [--map-multiplier-no-files MAP_MULTIPLIER_NO_FILES] [--max-chat-history-tokens MAX_CHAT_HISTORY_TOKENS] [--env-file ENV_FILE] [--input-history-file INPUT_HISTORY_FILE] [--chat-history-file CHAT_HISTORY_FILE] [--restore-chat-history | --no-restore-chat-history] [--llm-history-file LLM_HISTORY_FILE] [--dark-mode] [--light-mode] [--pretty | --no-pretty] [--stream | --no-stream] [--user-input-color USER_INPUT_COLOR] [--tool-output-color TOOL_OUTPUT_COLOR] [--tool-error-color TOOL_ERROR_COLOR] [--tool-warning-color TOOL_WARNING_COLOR] [--assistant-output-color ASSISTANT_OUTPUT_COLOR] [--code-theme CODE_THEME] [--show-diffs] [--git | --no-git] [--gitignore | --no-gitignore] [--aiderignore AIDERIGNORE] [--subtree-only] [--auto-commits | --no-auto-commits] [--dirty-commits | --no-dirty-commits] [--attribute-author | --no-attribute-author] [--attribute-committer | --no-attribute-committer] [--attribute-commit-message-author | --no-attribute-commit-message-author] [--attribute-commit-message-committer | --no-attribute-commit-message-committer] [--commit] [--commit-prompt PROMPT] [--dry-run | --no-dry-run] [--lint] [--lint-cmd LINT_CMD] [--auto-lint | --no-auto-lint] [--test-cmd TEST_CMD] [--auto-test | --no-auto-test] [--test] [--file FILE] [--read FILE] [--vim] [--voice-language VOICE_LANGUAGE] [--chat-language CHAT_LANGUAGE] [--version] [--just-check-update] [--check-update | --no-check-update] [--install-main-branch] [--upgrade] [--apply FILE] [--yes] [-v] [--show-repo-map] [--show-prompts] [--exit] [--message COMMAND] [--message-file MESSAGE_FILE] [--encoding ENCODING] [-c CONFIG_FILE] [--gui] [--suggest-shell-commands | --no-suggest-shell-commands] [FILE ...] aider: error: unrecognized arguments: --AZURE_API_KEY --AZURE_API_VERSION 2023-05-15 --AZURE_API_BASE https://ai-foundation-api.app/ai-foundation/chat-ai/gpt4

Step-5 error:

File "/venv/lib/python3.10/site-packages/aider/report.py", line 71, in report_github_issue confirmation = input(prompt).strip().lower() EOFError: EOF when reading a line

Original exception was: Traceback (most recent call last): File "/usr/local/lib/python3.10/asyncio/selector_events.py", line 256, in _add_reader key = self._selector.get_key(fd) File "/usr/local/lib/python3.10/selectors.py", line 193, in get_key raise KeyError("{!r} is not registered".format(fileobj)) from None KeyError: '0 is not registered'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/venv/lib/python3.10/site-packages/prompt_toolkit/input/vt100.py", line 165, in _attached_input loop.add_reader(fd, callback_wrapper) File "/usr/local/lib/python3.10/asyncio/selector_events.py", line 331, in add_reader self._add_reader(fd, callback, *args) File "/usr/local/lib/python3.10/asyncio/selector_events.py", line 258, in _add_reader self._selector.register(fd, selectors.EVENT_READ, File "/usr/local/lib/python3.10/selectors.py", line 360, in register self._selector.register(key.fd, poller_events) PermissionError: [Errno 1] Operation not permitted

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/venv/bin/aider", line 8, in sys.exit(main()) File "/venv/lib/python3.10/site-packages/aider/main.py", line 488, in main git_root = setup_git(git_root, io) File "/venv/lib/python3.10/site-packages/aider/main.py", line 78, in setup_git elif io.confirm_ask("No git repo found, create one to track aider's changes (recommended)?"): File "/venv/lib/python3.10/site-packages/aider/io.py", line 482, in confirm_ask res = self.prompt_session.prompt( File "/venv/lib/python3.10/site-packages/prompt_toolkit/shortcuts/prompt.py", line 1035, in prompt return self.app.run( File "/venv/lib/python3.10/site-packages/prompt_toolkit/application/application.py", line 1002, in run return asyncio.run(coro) File "/usr/local/lib/python3.10/asyncio/runners.py", line 44, in run return loop.run_until_complete(main) File "/usr/local/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete return future.result() File "/venv/lib/python3.10/site-packages/prompt_toolkit/application/application.py", line 886, in run_async return await _run_async(f) File "/venv/lib/python3.10/site-packages/prompt_toolkit/application/application.py", line 734, in _run_async with self.input.raw_mode(), self.input.attach( File "/usr/local/lib/python3.10/contextlib.py", line 135, in enter return next(self.gen) File "/venv/lib/python3.10/site-packages/prompt_toolkit/input/vt100.py", line 174, in _attached_input raise EOFError EOFError

Version and model info

Aider version: 0.57.1 Python version: 3.10.15 Platform: Linux-3.10.0-1160.102.1.el7.x86_64-x86_64-with-glibc2.36 Python implementation: CPython Virtual environment: Yes OS: Linux 3.10.0-1160.102.1.el7.x86_64 (64bit) Git version: git version 2.39.5

fry69 commented 2 hours ago

Thank you for filing this issue.

Please read the documentation carefully -> https://aider.chat/docs/llms/azure.html

API keys have to provided via environment variables, not via command line arguments.

Ask a LLM how to do that via Docker.