Skip to main content

A CLI tool to generate commit messages using AI models

Project description

AI Message Generator for Git

PyPI version License: MIT Python 3.7+

A CLI tool that generates commit messages using AI models based on your git repository changes. It analyzes the staged changes in your git repository and uses AI models to generate meaningful and descriptive commit messages.

Features

  • 🤖 Supports multiple AI models:
    • DeepSeek Chat
    • OpenAI GPT-3.5 Turbo
    • OpenAI GPT-4
    • Anthropic Claude-2
    • Google PaLM 2
    • Alibaba Qwen
    • iFlytek Spark
    • Baichuan
    • Zhipu ChatGLM
    • Baidu ERNIE
    • Moonshot AI KIMI
    • Tencent Hunyuan
    • ByteDance Doubao
    • Third-party Hosted Models:
      • Llama 2 (by Replicate)
      • Mistral (by Together AI)
      • Mixtral (by Together AI)
      • CodeLlama (by Replicate)
  • 🔧 Supports custom models and API endpoints
  • 📝 Follows conventional commits format
  • 🔄 Handles dependency updates gracefully
  • 🎯 Customizable prompt templates
  • 🔑 Secure API key storage
  • 🌐 Smart API endpoint management
  • 📝 Clear and concise commit messages

Installation

pip install aimsg

Setup

Initialize the tool with your API key and preferred model:

aimsg init

This will guide you through:

  1. Selecting an AI model
  2. Entering your API key
  3. Configuring the API endpoint (if needed)

Each model has its default API endpoint:

OpenAI Models

  • OpenAI GPT Models: https://api.openai.com/v1

Anthropic Models

  • Claude Models: https://api.anthropic.com/v1

Google Models

  • PaLM & Gemini: https://generativelanguage.googleapis.com/v1

Chinese Models

  • DeepSeek: https://api.deepseek.com/v1
  • Aliyun Qwen: https://dashscope.aliyuncs.com/api/v1
  • iFlytek Spark: https://spark-api.xf-yun.com/v3.1
  • Zhipu GLM: https://open.bigmodel.cn/api/v1
  • Baidu ERNIE: https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop
  • Moonshot KIMI: https://api.moonshot.cn/v1
  • Tencent Hunyuan: https://hunyuan.cloud.tencent.com/hyllm/v1
  • ByteDance Doubao: https://api.doubao.com/v1

Third-party Hosted Models

  • Replicate: https://api.replicate.com/v1
  • Together AI: https://api.together.xyz/v1

You can customize these endpoints during initialization or by using environment variables.

Usage

  1. Stage your changes:
git add .
  1. Generate commit message:
# Using default model (GPT-3.5)
aimsg commit

# Using a specific model
aimsg commit --model gpt4
aimsg commit --model claude2
aimsg commit --model qwen-turbo

# Using custom API base URL
aimsg commit --api-base https://your-api-endpoint.com/v1

# List all available models
aimsg model list

Model Management

  1. List all available models:
aimsg model list
  1. Add a custom model:
aimsg model add my-model model-id https://api.example.com/v1
  1. Remove a custom model:
aimsg model remove my-model

Examples of Custom Model Configuration

  1. Self-hosted Llama 2:
aimsg model add my-llama llama-2-70b-chat http://localhost:8000/v1
aimsg init  # Then select my-llama from the list
  1. Alternative OpenAI endpoint:
aimsg model add azure-gpt gpt-35-turbo https://your-azure-endpoint.com/v1
aimsg init  # Then select azure-gpt from the list
  1. Other provider's model:
aimsg model add claude-3 claude-3 https://api.anthropic.com/v1
aimsg init  # Then select claude-3 from the list

Supported Models

Here are all the pre-configured models you can use:

OpenAI Models

  • gpt-3.5-turbo
  • gpt-3.5-turbo-16k
  • gpt-4
  • gpt-4-32k
  • gpt-4-1106-preview

Anthropic Models

  • claude-2
  • claude-instant-1

Google Models

  • palm-2
  • gemini-pro

Chinese Models

  • Aliyun
    • qwen-turbo
    • qwen-plus
  • iFlytek
    • spark-v3
    • spark-v2
  • Zhipu
    • chatglm-4
    • chatglm-turbo
  • Baidu
    • ernie-4.0
    • ernie-turbo
  • Moonshot
    • kimi-v1
  • Tencent
    • hunyuan
    • hunyuan-lite
  • ByteDance
    • doubao-v1
    • doubao-turbo

Open Source Models (Hosted)

  • DeepSeek
    • deepseek-chat
  • Replicate (提供托管服务)
    • meta-llama/llama-2-70b-chat
    • meta-llama/codellama-34b-instruct
  • Together AI (提供托管服务)
    • mistralai/mistral-7b-instruct
    • mistralai/mixtral-8x7b-instruct

Environment Variables

The following environment variables can be used to configure the tool:

  • AIMSG_API_KEY: Your API key for the AI service
  • AIMSG_API_BASE: Base URL for the API service (optional)

You can set these in your shell:

export AIMSG_API_KEY=your-api-key
export AIMSG_API_BASE=https://api.example.com/v1

Or use a .env file in your project:

AIMSG_API_KEY=your-api-key
AIMSG_API_BASE=https://api.example.com/v1

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aimsg-0.1.2.tar.gz (14.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aimsg-0.1.2-py3-none-any.whl (14.8 kB view details)

Uploaded Python 3

File details

Details for the file aimsg-0.1.2.tar.gz.

File metadata

  • Download URL: aimsg-0.1.2.tar.gz
  • Upload date:
  • Size: 14.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for aimsg-0.1.2.tar.gz
Algorithm Hash digest
SHA256 da4ae9ab643ca4274c8a3833968652c6c7f3e1cb4f4855baa6b40233a9ddfb33
MD5 a60a20f8bd45b59feab3ee6dbee90ab5
BLAKE2b-256 22de362c973d6a354e8a0f01bfa9cc7c1c278287aa07b84597eaf1dbd30d6a51

See more details on using hashes here.

File details

Details for the file aimsg-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: aimsg-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 14.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for aimsg-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 badae626dd4d9af907ba0a66b35629752cbc21498d0143c7ba250bbc0f63c4ae
MD5 d2bd5f1f1d04d83a1672a06f610afebe
BLAKE2b-256 b7f99362d373759df376b24af2309eaf038a300574b89acfeb58bb0e8bc7f7a8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page