Add fallback for LLMs without system prompt support #10

Open
opened 2025-07-06 17:01:42 +00:00 by glenux · 0 comments
Owner

Currently, the commit message generation passes a system parameter to the LLM (model_obj.prompt(..., system=...)). Some older or certain newer models do not accept system prompts and raise exceptions.

This breaks our workflow for those providers.

Why

  • We want to broaden compatibility so that user-selected models which do not support system prompts can still generate commit messages.
  • Removing the system prompt entirely is not ideal, because many models rely on it to properly shape their responses.

Proposed Solution

  1. Detect if the selected LLM natively supports system prompts (e.g., check in the model_obj if the info is there).
  2. If unsupported, prepend the system instructions to the user prompt itself.
  3. Retain the existing code path for models that do support system prompts, preserving their behavior.
Currently, the commit message generation passes a `system` parameter to the LLM (`model_obj.prompt(..., system=...)`). Some older or certain newer models do not accept system prompts and raise exceptions. This breaks our workflow for those providers. ## Why * We want to broaden compatibility so that user-selected models which do not support system prompts can still generate commit messages. * Removing the system prompt entirely is not ideal, because many models rely on it to properly shape their responses. ## Proposed Solution 1. Detect if the selected LLM natively supports system prompts (e.g., check in the `model_obj` if the info is there). 2. If unsupported, prepend the system instructions to the user prompt itself. 3. Retain the existing code path for models that do support system prompts, preserving their behavior.
glenux added this to the Default project 2025-07-06 17:01:43 +00:00
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: glenux/llm-commit-gen#10
No description provided.