aider/examples
Paul Gauthier 57fff7f360 copy
2023-05-14 07:12:01 -07:00
..
2048-game.md copy 2023-05-14 07:12:01 -07:00
complex-change.md copy 2023-05-13 12:54:52 -07:00
css-exercises.md copy 2023-05-13 12:50:05 -07:00
hello-world-flask.md copy 2023-05-13 13:03:16 -07:00
pong.md copy 2023-05-13 15:27:03 -07:00
README.md copy 2023-05-14 07:12:01 -07:00
semantic-search-replace.md copy 2023-05-13 12:52:29 -07:00
update-docs.md copy 2023-05-13 12:54:20 -07:00

Example chats using aider to code with GPT-4

Below are some example chat transcripts that show how you can chat with the aider command line tool to generate and edit code with GPT-4.

There are a few things worth taking note of:

  • aider will note when source files are added to the chat session. Once added, these files are available for review and editing by GPT-4. Files can be added from the command line, or in-chat with the /add command. Sometimes GPT-4 requests to see specific files, and aider adds them after the user approves.
  • Code edits that GPT-4 suggests are automatically applied to the source files by aider.
  • After applying the edits, aider will commit them to git with a senisble commit message.

Example chat transcripts

There are a varity of example coding chat sessions included, accomplishing both greenfield generation of new code as well as simple and more complex edits to larger codebases:

  • Hello World Flask App: This example demonstrates how to create a simple Flask app with various endpoints, such as adding two numbers and calculating the Fibonacci sequence.

  • 2048 Game Modification: This example demonstrates how to explore and modify an open-source javascript 2048 game codebase, including adding randomness to the scoring system.

  • Pong Game with Pygame: This example demonstrates how to create a simple Pong game using the Pygame library, with customizations for paddle size and color, and ball speed adjustments.

  • Complex Multi-file Change with Debugging: This example demonstrates a complex code change involving multiple source files and debugging with the help of aider.

  • Semantic Search & Replace: This example showcases aider performing semantic search and replace operations in code, dealing with various formatting and semantic differences in the function calls that it updates.

  • CSS Exercise: Animation Dropdown Menu: This example demonstrates how to complete a CSS exercise involving adding animation to a dropdown menu, creating a bounce illusion when the dropdown expands close to its final end state.

  • Automatically Update Docs: This example demonstrates how to use aider to automatically update documentation based on the latest version of the main() function in the code.

Transcript formatting

Output from the aider tool is shown in a blockquote like this.

> The user's chat messages are bold and shown on a prompt line like this. They contain they user's change requests, clarifications, etc.

Responses from GPT-4 are in a plain font like this, and often include colorized "edit blocks" that specify edits to the code. Here's a sample edit block that switches from printing a blank line to printing "hello world" in the file hello.py:

hello.py
<<<<<<< ORIGINAL
print()
=======
print("Hello world!")
>>>>>>> UPDATED