Develop a command-line interface (CLI) application (in Python) that uses an LLM to generate suggestions for commit messages given a path to a git repository.
I've provided boilerplate code for the assignment that you can use to get started. It implements the following:
- Determining if a path is a git repository
- Loading diffs into an appropriate data structure
- Parsing command line arguments
You can clone the following repository to get started: commit-gpt.
We're implementing a tool that suggests commit messages for a git repository. As with any feature, we need to consider how it will be used. This will lead us to a design that we'll then implement.
When making use of LLMs (as APIs) we need to consider how the user will interact with the tool.
We must assume that:
- The network is unreliable
- The LLM may return incorrect results
- The user may input an invalid git repository
Scope out and design the tool with these considerations in mind:
- Plan the user interaction flow
- Positive path
- validate repo -> collect diffs -> call LLM -> display suggestion
- Negative paths
- invalid path / not a git repo -> user-friendly error
- no changes detected -> message
- LLM/network error -> retries with exponential backoff -> user-friendly error
- API rate limit -> user-friendly error
- Positive path
- Determine input and output formats
- Consider error handling and edge cases
- What do diffs look like?
A part of the tool has been implemented for you. Your task is to implement the following:
- Integrate API calls to the LLM
- Handle responses and display output to the user
- Add rate limiting to comply with API policies
- Implement retry mechanisms with exponential backoff
- Provide fallback options in case of API failure
- Verify functionality with various inputs
- Ensure robustness and handle exceptions gracefully
- Evaluate the quality of the LLM's response
- Consider the user experience and usability
- Does it do a good job of writing commit messages?