### Setup Get Requirements Source: https://github.com/aider-ai/aider/blob/main/tests/fixtures/chat-history.md A utility function to retrieve project requirements, optionally with a suffix. ```python def get_requirements(suffix=""): ``` -------------------------------- ### Base Dockerfile Setup Source: https://github.com/aider-ai/aider/blob/main/tests/fixtures/chat-history-search-replace-gold.txt Sets up the base Docker image using Python 3.10 slim. Installs essential build tools, Git, and portaudio, then creates a virtual environment and configures the PATH. ```Dockerfile FROM python:3.10-slim AS base RUN apt-get update && \ apt-get install --no-install-recommends -y build-essential git libportaudio2 && \ rm -rf /var/lib/apt/lists/* WORKDIR /app RUN python -m venv /venv ENV PATH="/venv/bin:$PATH" ``` ```Dockerfile FROM python:3.10-slim AS base RUN apt-get update && \ apt-get install --no-install-recommends -y build-essential git libportaudio2 && \ rm -rf /var/lib/apt/lists/* WORKDIR /app RUN python -m venv /venv ENV PATH="/venv/bin:$PATH" ENV AIDER_DOCKER_IMAGE=true ``` -------------------------------- ### Install and Run Aider Source: https://github.com/aider-ai/aider/blob/main/aider/website/index.html Install Aider using pip and then run it from your project directory. Examples show how to configure different LLM models like DeepSeek, Claude 3.7 Sonnet, and o3-mini. ```bash python -m pip install aider-install ``` ```bash aider-install ``` ```bash cd /to/your/project ``` ```bash aider --model deepseek --api-key deepseek= ``` ```bash aider --model sonnet --api-key anthropic= ``` ```bash aider --model o3-mini --api-key openai= ``` -------------------------------- ### Handy Setup Commands for MacOS/Linux Source: https://github.com/aider-ai/aider/blob/main/CONTRIBUTING.md A consolidated command for setting up the development environment on MacOS or Linux systems, including virtual environment creation, activation, and dependency installation. ```bash python3 -m venv ../aider_venv \ && source ../aider_venv/bin/activate \ && pip3 install -e . \ && pip3 install -r requirements.txt \ && pip3 install -r requirements/requirements-dev.txt ``` -------------------------------- ### Aider Session Initialization Example Source: https://github.com/aider-ai/aider/blob/main/tests/fixtures/chat-history.md This output shows the initial messages when an Aider session starts, including version, model, and repository information. It's useful for verifying Aider's configuration. ```bash > /Users/gauthier/Projects/aider/.venv/bin/aider --model gpt-4o-mini > Aider v0.49.0 > Model: gpt-4o-mini with whole edit format > Git repo: .git with 304 files > Repo-map: disabled > Use /help for help, run "aider --help" to see cmd line args ``` -------------------------------- ### Pandas Installation Instructions (File Content) Source: https://github.com/aider-ai/aider/blob/main/tests/fixtures/chat-history.md This content can be saved to a file to provide pandas installation instructions. It includes commands for both initial installation and upgrading. ```text To install the Pandas library, you can use pip, which is the package installer for Python. Here’s how you can do it: 1. Open your command line interface (CLI). 2. Run the following command: pip install pandas If you want to ensure that you have the latest version, you can use: pip install --upgrade pandas ``` -------------------------------- ### Run Installation Command Source: https://github.com/aider-ai/aider/blob/main/tests/fixtures/chat-history.md Executes a given command for installation. ```python def run_install(cmd): ⋮... ``` -------------------------------- ### Aider Command Line Usage Source: https://github.com/aider-ai/aider/blob/main/tests/fixtures/chat-history.md Example of how to start Aider with a specific model and the command to run for help. ```bash /Users/gauthier/Projects/aider/.venv/bin/aider --model gpt-4o-mini ``` ```bash /help how are you ``` -------------------------------- ### Aider Command Line Example Source: https://github.com/aider-ai/aider/blob/main/tests/fixtures/chat-history.md Example of launching Aider from the command line with specific model and repository information. ```text > /Users/gauthier/Projects/aider/.venv/bin/aider --model gpt-4o-mini > Aider v0.48.2-dev > Model: gpt-4o-mini with whole edit format > Git repo: .git with 303 files > Repo-map: disabled > Use /help for help, run "aider --help" to see cmd line args ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/aider-ai/aider/blob/main/CONTRIBUTING.md Install the project's main dependencies from the `requirements.txt` file. ```bash pip install -r requirements.txt ``` -------------------------------- ### Add Installation Section to Markdown Source: https://github.com/aider-ai/aider/blob/main/aider/website/docs/usage/not-code.md Add an installation section to a README.md file with options for Homebrew and PyPI. ```markdown + ## Installation + ``` + # Homebrew + brew install cool-app-10k + + # PyPI + pipx install cool-app-10k + ``` ``` -------------------------------- ### Aider Command Line Example Source: https://github.com/aider-ai/aider/blob/main/tests/fixtures/chat-history.md Example of launching Aider from the command line, including the model used and git repository information. ```bash /Users/gauthier/Projects/aider/.venv/bin/aider --model gpt-4o-mini Aider v0.48.0 Model: gpt-4o-mini with whole edit format Git repo: .git with 300 files Repo-map: disabled Use /help for help, run "aider --help" to see cmd line args ``` -------------------------------- ### Start Aider with OpenAI Models Source: https://github.com/aider-ai/aider/blob/main/aider/website/docs/llms/openai.md Launch Aider and specify the desired OpenAI model using the --model flag. Examples include o3-mini, o1-mini, and gpt-4o. ```bash # Change directory into your codebase cd /to/your/project # o3-mini aider --model o3-mini # o1-mini aider --model o1-mini # GPT-4o aider --model gpt-4o # List models available from OpenAI aider --list-models openai/ ``` -------------------------------- ### Aider Startup Announcement Example Source: https://github.com/aider-ai/aider/blob/main/tests/fixtures/chat-history.md This is an example of the announcement lines aider prints at startup, which are helpful for reporting problems. ```text Aider v0.37.1-dev Models: gpt-4o with diff edit format, weak model gpt-3.5-turbo Git repo: .git with 258 files Repo-map: using 1024 tokens ``` -------------------------------- ### Test Main Setup Method Source: https://github.com/aider-ai/aider/blob/main/tests/fixtures/chat-history.md The setUp method for the TestMain class, which copies the original environment variables before each test. ```python def setUp(self): self.original_env = os.environ.copy() ``` -------------------------------- ### Aider Ask Command Example Source: https://github.com/aider-ai/aider/blob/main/tests/fixtures/chat-history.md Example of using the `/ask` command to inquire about the repository, with Aider providing a descriptive answer. ```markdown /ask What is this repo? This is the source code to the popular django package. ``` -------------------------------- ### Example of using /code command Source: https://github.com/aider-ai/aider/blob/main/tests/fixtures/chat-history.md This example demonstrates how to use the `/code` command to request a specific code change, such as adding a factorial function. ```markdown #### /code Add a function to calculate the factorial of a number Certainly! I'll add a function to calculate the factorial of a number. Here's the change: ```python def factorial(n): if n == 0 or n == 1: return 1 else: return n * factorial(n - 1) ``` ``` -------------------------------- ### Install Pre-commit Hooks Source: https://github.com/aider-ai/aider/blob/main/CONTRIBUTING.md Install pre-commit hooks to automatically format code and run linters before each commit. This is optional but recommended. ```bash pre-commit install ``` -------------------------------- ### Install and Run Aider CLI Source: https://github.com/aider-ai/aider/blob/main/README.md Install Aider using pip and run it from the command line. Remember to change directory into your project before running Aider. ```bash python -m pip install aider-install ``` ```bash aider-install ``` ```bash cd /to/your/project ``` ```bash # DeepSeek ``` ```bash aider --model deepseek --api-key deepseek= ``` ```bash # Claude 3.7 Sonnet ``` ```bash aider --model sonnet --api-key anthropic= ``` ```bash # o3-mini ``` ```bash aider --model o3-mini --api-key openai= ``` -------------------------------- ### Aider Configuration File Example Source: https://github.com/aider-ai/aider/blob/main/tests/fixtures/chat-history.md Configuration settings for Aider can be managed in a YAML file. This example shows the `lint-cmd` and `cache-prompts` settings. ```yaml lint-cmd: /Users/gauthier/Projects/aider/tmp.lint.sh cache-prompts: true ``` -------------------------------- ### Setup for Aider Benchmarking Source: https://github.com/aider-ai/aider/blob/main/benchmark/README.md Clone the Aider repository, set up the benchmark exercises directory, and build the Docker container. These steps are required once before running benchmarks. ```bash # Clone the aider repo git clone https://github.com/Aider-AI/aider.git # Create the scratch dir to hold benchmarking results inside the main aider dir: cd aider mkdir tmp.benchmarks # Clone the repo with the exercises git clone https://github.com/Aider-AI/polyglot-benchmark tmp.benchmarks/polyglot-benchmark # Build the docker container ./benchmark/docker_build.sh ``` -------------------------------- ### Get All Tags Since Source: https://github.com/aider-ai/aider/blob/main/tests/fixtures/chat-history.md Retrieves all Git tags created since a specified starting tag. ```python def get_all_tags_since(start_tag): ``` -------------------------------- ### Test Main Setup Method Source: https://github.com/aider-ai/aider/blob/main/tests/fixtures/chat-history.md Sets up the testing environment for the main command tests, including environment variables and temporary directories. ```python def setUp(self): self.original_env = os.environ.copy() os.environ["OPENAI_API_KEY"] = "deadbeef" self.original_cwd = os.getcwd() self.tempdir_obj = IgnorantTemporaryDirectory() self.tempdir = self.tempdir_obj.name ``` -------------------------------- ### TestMain Setup Method Source: https://github.com/aider-ai/aider/blob/main/tests/fixtures/chat-history.md Sets up the testing environment for TestMain, including copying environment variables, setting a temporary directory, and creating dummy files. ```python class TestMain(TestCase): def setUp(self): self.original_env = os.environ.copy() os.environ["OPENAI_API_KEY"] = "deadbeef" self.original_cwd = os.getcwd() self.tempdir_obj = IgnorantTemporaryDirectory() self.tempdir = self.tempdir_obj.name ``` ```python def create_env_file(self, file_name, content): ``` -------------------------------- ### Version Control Get All Tags Since Source: https://github.com/aider-ai/aider/blob/main/tests/fixtures/chat-history.md Retrieves all Git tags that have been created since a specified start tag. ```python def get_all_tags_since(start_tag): ``` -------------------------------- ### Example Pip Install Conflict Message Source: https://github.com/aider-ai/aider/blob/main/aider/website/docs/troubleshooting/imports.md This message indicates a version conflict between Aider's requirements and your current environment. It suggests that a package required by Aider has a specific version constraint that is not met by the version you currently have installed. ```text aider-chat 0.23.0 requires somepackage==X.Y.Z, but you have somepackage U.W.V which is incompatible. ``` -------------------------------- ### Example with Tagged Multi-line Message Source: https://github.com/aider-ai/aider/blob/main/aider/website/_includes/multi-line.md Use a tag to start and end a multi-line message, which is useful when your message content includes closing braces. ```markdown {python def hello(): print("Hello}") # Note: contains a brace python} ``` -------------------------------- ### Get User Language using Babel library Source: https://github.com/aider-ai/aider/blob/main/tests/fixtures/chat-history.md Leverages the `babel` library for more robust locale and language detection. Requires installing the `babel` dependency. ```python from babel import Locale def get_user_language(): return Locale.parse(locale.getdefaultlocale()[0]).language ``` -------------------------------- ### Complete Example: Responsive Chart Implementation Source: https://github.com/aider-ai/aider/blob/main/tests/fixtures/chat-history.md This comprehensive example integrates HTML structure, CSS for small screens, Chart.js configuration, and a resize listener for a fully responsive chart. ```html
``` -------------------------------- ### Aider Session Exit Example Source: https://github.com/aider-ai/aider/blob/main/tests/fixtures/chat-history.md This output indicates the start of an Aider chat session, including the command used and version information. It's helpful for tracking session history. ```bash > /Users/gauthier/Projects/aider/.venv/bin/aider --model gpt-4o-mini > Aider v0.48.2-dev > Model: gpt-4o-mini with whole edit format > Git repo: .git with 303 files > Repo-map: disabled > Use /help for help, run "aider --help" to see cmd line args ``` -------------------------------- ### Initial Instruction for GPT Source: https://github.com/aider-ai/aider/blob/main/aider/website/_posts/2023-07-02-benchmarks.md This is the initial instruction sent to GPT to start an exercise. It guides GPT to use provided instructions, implement stubs, and only use standard Python libraries. ```text Use the above instructions to modify the supplied files: Keep and implement the existing function or class stubs, they will be called from unit tests. Only use standard python libraries, don't suggest installing any packages. ``` -------------------------------- ### Initial Plotting Setup in benchmark/over_time.py Source: https://github.com/aider-ai/aider/blob/main/tests/fixtures/chat-history.md Sets up the initial plotting environment by loading data from a YAML file and initializing lists for dates, pass rates, and models. ```python def plot_over_time(yaml_file): with open(yaml_file, "r") as file: data = yaml.safe_load(file) dates = [] pass_rates = [] models = [] ``` -------------------------------- ### Aider Initialization and Commit Example Source: https://github.com/aider-ai/aider/blob/main/tests/fixtures/chat-history.md Illustrates the initialization of an Aider chat session with specific configurations and a commit command. ```bash /Users/gauthier/Projects/aider/.venv/bin/aider --lint --commit Aider v0.51.2-dev Main model: claude-3-5-sonnet-20240620 with diff edit format, prompt cache, infinite output Weak model: claude-3-haiku-20240307 Git repo: .git with 308 files Repo-map: using 1024 tokens, files refresh Commit b2488af fix: Handle path-specific edits in base_coder.py test: Update test_main.py to check for explicit approval of shell commands ``` -------------------------------- ### Get Author Line Counts for File Source: https://github.com/aider-ai/aider/blob/main/tests/fixtures/chat-history.md Calculates the number of lines authored by each person in a given file. Handles cases where the file might not exist at the start tag but exists at the end tag or HEAD. ```python def get_counts_for_file(repo, tag, file_path): try: # Get blame for the file at the given tag blame_output = repo.git.blame(f'{tag}', '--', file_path) # Parse blame output to extract author information authors = {} for line in blame_output.splitlines(): parts = line.split(' ', 2) if len(parts) == 3: hash_val, author_info, _ = parts # Extract author name from author_info (e.g., 'John Doe ') author_name = author_info.split('<')[0].strip() authors[hash_val] = author_name # Get the content of the file at the given tag text = repo.git.show(f'{tag}:{file_path}') if text is None: # File doesn't exist at the tag, try HEAD text = repo.git.show(f'HEAD:{file_path}') if text is None: return None text = text.splitlines() line_counts = defaultdict(int) for line in text: if line.startswith("^ "): continue hsh = line[:hash_len] author = authors.get(hsh, "Unknown") line_counts[author] += 1 return dict(line_counts) except subprocess.CalledProcessError: # File doesn't exist at all return None ``` -------------------------------- ### Get Line Counts Per Author for a File (Python) Source: https://github.com/aider-ai/aider/blob/main/tests/fixtures/chat-history-search-replace-gold.txt Calculates the number of lines authored by each person in a given file between two Git tags. Handles cases where the file might not exist at the start tag. ```python def get_counts_for_file(start_tag, end_tag, authors, fname): try: if end_tag: text = run(["git", "blame", f"{start_tag}..{end_tag}", "--", fname]) else: text = run(["git", "blame", f"{start_tag}..HEAD", "--", fname]) if not text: return None text = text.splitlines() line_counts = defaultdict(int) for line in text: if line.startswith("^"): continue hsh = line[:hash_len] author = authors.get(hsh, "Unknown") line_counts[author] += 1 return dict(line_counts) except subprocess.CalledProcessError: # File might not exist at start_tag or end_tag return None ``` ```python def get_counts_for_file(start_tag, end_tag, authors, fname): try: if end_tag: text = run(["git", "blame", f"{start_tag}..{end_tag}", "--", fname]) else: text = run(["git", "blame", f"{start_tag}..HEAD", "--", fname]) if not text: return None text = text.splitlines() line_counts = defaultdict(int) for line in text: if line.startswith("^"): continue hsh = line[:hash_len] author = authors.get(hsh, "Unknown") line_counts[author] += 1 return dict(line_counts) except subprocess.CalledProcessError: # File might not exist at start_tag or end_tag, or might have been renamed # Try to get the blame for the entire file at the end_tag (or HEAD) try: if end_tag: text = run(["git", "blame", end_tag, "--", fname]) else: text = run(["git", "blame", "HEAD", "--", fname]) if not text: return None text = text.splitlines() line_counts = defaultdict(int) for line in text: if line.startswith("^"): continue hsh = line[:hash_len] author = authors.get(hsh, "Unknown") line_counts[author] += 1 return dict(line_counts) except subprocess.CalledProcessError: # File doesn't exist at all return None ``` -------------------------------- ### Asynchronous IO and Coder for Web Integration Source: https://github.com/aider-ai/aider/blob/main/tests/fixtures/chat-history.md This example demonstrates an asynchronous IO class and a Coder class designed for web UI or API integration. It uses asyncio queues for managing user input and responses, and includes a basic FastAPI setup with websockets for real-time communication. ```python import asyncio from enum import Enum class State(Enum): IDLE = 0 WAITING_FOR_INPUT = 1 PROCESSING = 2 class WebIO: def __init__(self): self.state = State.IDLE self.pending_questions = asyncio.Queue() self.answers = asyncio.Queue() async def ask_user(self, question): await self.pending_questions.put(question) self.state = State.WAITING_FOR_INPUT return await self.answers.get() async def user_response(self, answer): await self.answers.put(answer) self.state = State.PROCESSING class AsyncCoder: def __init__(self, io): self.io = io async def run(self): while True: if self.io.state == State.IDLE: # Process next task await self.process_next_task() elif self.io.state == State.WAITING_FOR_INPUT: # Wait for user input await asyncio.sleep(0.1) elif self.io.state == State.PROCESSING: # Continue processing await self.continue_processing() async def process_next_task(self): # Your processing logic here question = "Do you want to proceed?" answer = await self.io.ask_user(question) # Handle the answer async def continue_processing(self): # Continue processing logic here pass # For web framework integration (e.g., FastAPI) from fastapi import FastAPI, WebSocket app = FastAPI() io = WebIO() coder = AsyncCoder(io) @app.websocket("/ws") async def websocket_endpoint(websocket: WebSocket): await websocket.accept() asyncio.create_task(coder.run()) while True: if not io.pending_questions.empty(): question = await io.pending_questions.get() await websocket.send_text(question) data = await websocket.receive_text() await io.user_response(data) ``` -------------------------------- ### Install and Launch Aider in Browser Mode Source: https://github.com/aider-ai/aider/blob/main/aider/website/_posts/2024-05-02-browser.md Install Aider using pip and set your OpenAI API key. Then, launch Aider with the --browser flag to use the experimental browser UI. ```bash python -m pip install -U aider-chat export OPENAI_API_KEY= # Mac/Linux setx OPENAI_API_KEY # Windows, restart shell after setx aider --browser ``` -------------------------------- ### Ask/Code Workflow Example Source: https://github.com/aider-ai/aider/blob/main/aider/website/docs/usage/modes.md Demonstrates a recommended workflow using '/ask' for discussion and planning, followed by '/code' for file edits. The example shows iterative refinement of a print statement in a Python file. ```python hello.py >>>>>>> SEARCH ======= def main(): print("I think, therefore I print.") <<<<<<< REPLACE ``` ```python hello.py >>>>>>> SEARCH print("I think, therefore I print.") ======= print("I THINK, THEREFORE I PRINT!") <<<<<<< REPLACE ``` -------------------------------- ### Install Aider CLI using aider-install package Source: https://github.com/aider-ai/aider/blob/main/aider/website/_posts/2025-01-15-uv.md For users with Python 3.8+ installed, this method installs the `aider-install` package, which then uses uv to install the Aider CLI and manage its environment. ```bash pip install aider-install aider-install ``` -------------------------------- ### Check Pip Install Extra Source: https://github.com/aider-ai/aider/blob/main/tests/fixtures/chat-history.md Checks if an extra module is installed via pip and prompts for installation if not. ```python def check_pip_install_extra(io, module, prompt, pip_install_cmd): ⋮... ``` -------------------------------- ### Aider Quick Start with Copilot Source: https://github.com/aider-ai/aider/blob/main/aider/website/docs/llms/github.md Navigate to your project directory and run Aider, specifying a Copilot model like `openai/gpt-4o` to begin interacting with Copilot through Aider. ```bash # change into your project cd /to/your/project # talk to Copilot aider --model openai/gpt-4o ``` -------------------------------- ### Install Pandas Package Source: https://github.com/aider-ai/aider/blob/main/tests/fixtures/chat-history-search-replace-gold.txt Use this shell command to install the pandas library. This is a basic installation command. ```shell pip install pandas ``` -------------------------------- ### Install Aider Source: https://github.com/aider-ai/aider/blob/main/aider/website/_includes/get-started.md Install aider using the provided include file. Ensure you have Python 3.8-3.13 installed. ```bash {% include install.md %} ``` -------------------------------- ### Aider Help Command Example Source: https://github.com/aider-ai/aider/blob/main/tests/fixtures/chat-history.md Demonstrates using the `/help` command in Aider to ask questions about its usage, configuration, or troubleshooting. ```bash /help how are you ``` -------------------------------- ### Playwright Installation Source: https://github.com/aider-ai/aider/blob/main/tests/fixtures/chat-history.md Installs Playwright dependencies. ```python │def install_playwright(io): ⋮... ``` -------------------------------- ### Aider's install script snippet for installing aider as a tool Source: https://github.com/aider-ai/aider/blob/main/aider/website/_posts/2025-01-15-uv.md This snippet from Aider's install script demonstrates how uv is used to install the `aider-chat` tool, specifying Python 3.12 and using the --force option. ```bash ensure "${_install_dir}/uv" tool install --force --python python3.12 aider-chat@latest ``` -------------------------------- ### Start Ollama Server and Aider Source: https://github.com/aider-ai/aider/blob/main/aider/website/docs/llms/ollama.md Instructions for pulling an Ollama model, starting the Ollama server with an increased context window, and then running Aider against the local model. ```bash # Pull the model ollama pull ``` ```bash # Start your ollama server, increasing the context window to 8k tokens OLLAMA_CONTEXT_LENGTH=8192 ollama serve ``` ```bash # In another terminal window, change directory into your codebase cd /to/your/project ``` ```bash aider --model ollama_chat/ ``` -------------------------------- ### Install Aider CLI with uv tool install Source: https://github.com/aider-ai/aider/blob/main/aider/website/_posts/2025-01-15-uv.md This command, executed by `aider-install`, uses uv to globally install the `aider-chat` tool, ensuring it runs with Python 3.12. The --force flag is used to overwrite existing installations. ```bash uv tool install --force --python python3.12 aider-chat ``` -------------------------------- ### Create Flask App with /hello Endpoint Source: https://github.com/aider-ai/aider/blob/main/aider/website/examples/hello-world-flask.md This snippet initializes a Flask application and defines a '/hello' endpoint that returns 'Hello, World!'. Ensure Flask is installed (`pip install flask`) before running. ```python from flask import Flask app = Flask(__name__) @app.route('/hello') def hello(): return "Hello, World!" if __name__ == '__main__': app.run() ``` -------------------------------- ### Verify Pandas Installation Source: https://github.com/aider-ai/aider/blob/main/tests/fixtures/chat-history.md After installation, run this Python code to confirm pandas is installed and to check its version. This requires an active Python interpreter. ```python import pandas as pd print(pd.__version__) ``` -------------------------------- ### Install Aider with pip Source: https://github.com/aider-ai/aider/blob/main/aider/website/docs/install.md Install aider using pip. It is recommended to use a virtual environment when installing with pip to manage dependencies effectively. ```bash python -m pip install -U --upgrade-strategy only-if-needed aider-chat ``` -------------------------------- ### Install Aider with pipx Source: https://github.com/aider-ai/aider/blob/main/aider/website/docs/install.md Install aider using the pipx package manager. This command also installs pipx if it's not already present. ```bash python -m pip install pipx # If you need to install pipx ``` ```bash pipx install aider-chat ``` -------------------------------- ### Initialize Repository Mapping and Tag Ranking Source: https://github.com/aider-ai/aider/blob/main/tests/fixtures/chat-history-search-replace-gold.txt Sets up data structures for defines, references, and definitions, and initializes personalization for graph analysis. Handles large repositories with a progress bar. ```python def get_ranked_tags( self, chat_fnames, other_fnames, mentioned_fnames, mentioned_idents, progress=None, ): import networkx as nx defines = defaultdict(set) references = defaultdict(list) definitions = defaultdict(set) personalization = dict() fnames = set(chat_fnames).union(set(other_fnames)) chat_rel_fnames = set() fnames = sorted(fnames) # Default personalization for unspecified files is 1/num_nodes # https://networkx.org/documentation/stable/_modules/networkx/algorithms/link_analysis/pagerank_alg.html#pagerank personalize = 100 / len(fnames) if len(fnames) - len(self.TAGS_CACHE) > 100: self.io.tool_output( "Initial repo scan can be slow in larger repos, but only happens once." ) fnames = tqdm(fnames, desc="Scanning repo") showing_bar = True else: showing_bar = False for fname in fnames: if progress and not showing_bar: progress() self.process_file( fname, chat_fnames, mentioned_fnames, personalize, defines, references, definitions, personalization, chat_rel_fnames, ) if not references: references = dict((k, list(v)) for k, v in defines.items()) idents = set(defines.keys()).intersection(set(references.keys())) G = nx.MultiDiGraph() ``` ```python def get_ranked_tags( self, chat_fnames, other_fnames, mentioned_fnames, mentioned_idents, progress=None, ): import networkx as nx from collections import Counter import math defines = defaultdict(set) references = defaultdict(list) definitions = defaultdict(set) personalization = dict() fnames = set(chat_fnames).union(set(other_fnames)) chat_rel_fnames = set() fnames = sorted(fnames) # Default personalization for unspecified files is 1/num_nodes # https://networkx.org/documentation/stable/_modules/networkx/algorithms/link_analysis/pagerank_alg.html#pagerank personalize = 100 / len(fnames) if len(fnames) - len(self.TAGS_CACHE) > 100: self.io.tool_output( "Initial repo scan can be slow in larger repos, but only happens once." ) fnames = tqdm(fnames, desc="Scanning repo") showing_bar = True else: showing_bar = False for fname in fnames: if progress and not showing_bar: progress() self.process_file( fname, chat_fnames, mentioned_fnames, personalize, defines, references, definitions, personalization, chat_rel_fnames, ) if not references: references = dict((k, list(v)) for k, v in defines.items()) ``` -------------------------------- ### Configure o3-mini Model Settings Source: https://github.com/aider-ai/aider/blob/main/aider/website/docs/config/reasoning.md Example configuration for the 'o3-mini' model, demonstrating how to set `use_temperature` to `false` which is often required for reasoning models. ```yaml - name: o3-mini edit_format: diff weak_model_name: gpt-4o-mini use_repo_map: true use_temperature: false # <--- editor_model_name: gpt-4o editor_edit_format: editor-diff accepts_settings: ["reasoning_effort"] ``` -------------------------------- ### Install Aider with PowerShell (Windows) Source: https://github.com/aider-ai/aider/blob/main/aider/website/docs/install.md Execute the aider installation script on Windows using PowerShell. This command bypasses execution policy restrictions for the installation. ```powershell powershell -ExecutionPolicy ByPass -c "irm https://aider.chat/install.ps1 | iex" ``` -------------------------------- ### Install Aider in Docker Image Source: https://github.com/aider-ai/aider/blob/main/tests/fixtures/chat-history-search-replace-gold.txt Installs Aider and its dependencies, including PyTorch CPU version, into the Docker image. Cleans up the source code directory after installation. ```Dockerfile COPY . /tmp/aider RUN /venv/bin/python -m pip install --upgrade --no-cache-dir pip \ && /venv/bin/python -m pip install --no-cache-dir /tmp/aider[help,browser,playwright] \ --extra-index-url https://download.pytorch.org/whl/cpu \ && rm -rf /tmp/aider ``` ```Dockerfile COPY . /tmp/aider RUN /venv/bin/python -m pip install --upgrade --no-cache-dir pip \ && /venv/bin/python -m pip install --no-cache-dir /tmp/aider \ --extra-index-url https://download.pytorch.org/whl/cpu \ && rm -rf /tmp/aider ``` ```Dockerfile COPY . /tmp/aider RUN /venv/bin/python -m pip install --upgrade --no-cache-dir pip \ && /venv/bin/python -m pip install --no-cache-dir /tmp/aider \ --extra-index-url https://download.pytorch.org/whl/cpu \ && rm -rf /tmp/aider ``` ```Dockerfile COPY . /tmp/aider RUN /venv/bin/python -m pip install --upgrade --no-cache-dir pip \ && /venv/bin/python -m pip install --no-cache-dir /tmp/aider \ --extra-index-url https://download.pytorch.org/whl/cpu \ && rm -rf /tmp/aider ``` -------------------------------- ### Install Aider and Configure Models Source: https://github.com/aider-ai/aider/blob/main/aider/website/_posts/2024-07-25-new-models.md Install the aider package and set environment variables for API keys. Then, use the aider command with the --model flag to specify the desired LLM. ```bash python -m pip install -U aider-chat ``` ```bash cd /to/your/git/repo ``` ```bash export DEEPSEEK_API_KEY=your-key-goes-here aider --model deepseek/deepseek-coder ``` ```bash export MISTRAL_API_KEY=your-key-goes-here aider --model mistral/mistral-large-2407 ``` ```bash export OPENROUTER_API_KEY=your-key-goes-here aider --model openrouter/meta-llama/llama-3.1-405b-instruct ``` ```bash aider --model openrouter/meta-llama/llama-3.1-70b-instruct ``` ```bash aider --model openrouter/meta-llama/llama-3.1-8b-instruct ``` -------------------------------- ### Start Aider with LM Studio Model Source: https://github.com/aider-ai/aider/blob/main/aider/website/docs/llms/lm-studio.md After configuring the environment variables, use this command to start Aider and specify the LM Studio model you want to use. ```bash # Change directory into your codebase cd /to/your/project aider --model lm_studio/ ``` -------------------------------- ### Install Playwright Source: https://github.com/aider-ai/aider/blob/main/tests/fixtures/chat-history.md Installs Playwright, a tool for web browser automation. ```python def install_playwright(io): ⋮... ``` -------------------------------- ### Aider Help Command Example Source: https://github.com/aider-ai/aider/blob/main/tests/fixtures/chat-history.md Demonstrates how to use the `/help` command within Aider to ask questions about its usage, settings, or troubleshooting. ```text # Question: how are you # Relevant docs: ```