Skip to content
This repository was archived by the owner on Jan 23, 2026. It is now read-only.

Latest commit

 

History

History
71 lines (46 loc) · 2.29 KB

File metadata and controls

71 lines (46 loc) · 2.29 KB

Assignment: Build a CLI Tool that Uses an LLM

Overview

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

Getting Started

You can clone the following repository to get started: commit-gpt.

Instructions

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.

1. Design the Application

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
  • Determine input and output formats
  • Consider error handling and edge cases
  • What do diffs look like?

2. Implement the CLI Tool

A part of the tool has been implemented for you. Your task is to implement the following:

Core Features

  • Integrate API calls to the LLM
  • Handle responses and display output to the user

Reliability Features

  • Add rate limiting to comply with API policies
  • Implement retry mechanisms with exponential backoff
  • Provide fallback options in case of API failure

3. Testing & Evaluation

Test Your Application

  • 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

Key Questions

  • Does it do a good job of writing commit messages?