-
Notifications
You must be signed in to change notification settings - Fork 1
Replace model system with specific GPT-4.1 family variants #58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace model system with specific GPT-4.1 family variants #58
Conversation
… handling Co-authored-by: oleander <220827+oleander@users.noreply.github.com>
git ai config set model <MODEL> to take any model, not just predefined ones. Make sure to test for non-existing models; git ai config set model does-not-exist && git commit --no-edit -a. It should yield a proper error message when OpenAI's AP...
oleander
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot Failing CI.
…-4.1-nano, and GPT-4.5 variants Co-authored-by: oleander <220827+oleander@users.noreply.github.com>
Fixed the CI failures by updating the model system as requested in the review. The issue was related to the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR replaces the existing model system with four specific GPT-4.1 family variants while maintaining strict validation and proper error handling. The change removes the old GPT-4, GPT-4o, and GPT-4o-mini models and introduces GPT-4.1, GPT-4.1-mini, GPT-4.1-nano, and GPT-4.5 as the only supported models.
Key Changes:
- Replaced all existing model variants with 4 new GPT-4.1 family models
- Updated model enum to use new naming conventions and restored Copy semantics
- Changed string conversion from
&strreferences to ownedStringvalues
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/model.rs | Core model system replacement with new GPT-4.1 variants and updated string conversion logic |
| tests/model_token_test.rs | Updated all test cases to use new GPT41 model variant |
| tests/llm_input_generation_test.rs | Updated all test cases to use new model variants (GPT41Mini, GPT45, GPT41Nano) |
| src/commit.rs | Updated test cases to use GPT41Mini instead of GPT4oMini |
| src/openai.rs | Updated fallback generation to use GPT41Mini instead of GPT4oMini |
- Implement AsRef<str> for Model to avoid unnecessary String allocations - Update count_tokens() and context_size() to use as_ref() directly - Change From<&Model> for String to use as_ref().to_string() - Update Display impl and as_str() method to return &str instead of String - Eliminates multiple unnecessary heap allocations per call Resolves review comments about inefficient string conversions.
|
✅ Resolved review comments Fixed the inefficient string allocations by implementing
This eliminates multiple unnecessary String allocations per call while maintaining backward compatibility. All tests pass and clippy shows no warnings. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.
Previously,
git ai config set model <MODEL>only accepted 4 predefined model names (gpt-4, gpt-4o, gpt-4o-mini, gpt-4.1) due to strict enum validation. Any other model name would either fail or silently fall back to the default model.This change replaces the existing model system with a new set of specific GPT-4.1 family model variants while maintaining proper error handling:
Key Changes
Updated Model System: Replaced all existing models with 4 specific GPT-4.1 family variants:
gpt-4.1) - Default model for general usegpt-4.1-mini) - Optimized for faster processinggpt-4.1-nano) - Ultra-fast processing variantgpt-4.5) - Advanced model for complex tasksStrict Validation: Only the 4 specified model names are accepted. Invalid models return proper parsing errors and fall back to the default model when used.
Restored Copy Semantics: Model enum is now
Copyagain, eliminating unnecessary cloning and improving performance throughout the codebase.Preserved API Integration: Model strings are passed directly to OpenAI's API for validation, ensuring proper error messages when invalid models are used with real API calls.
Behavior Changes
Before:
After:
The system maintains its robust fallback chain (OpenAI API → Local generation → Single-step) so operations never fail catastrophically. When the OpenAI API is reachable and returns an error for an invalid model, that error is properly logged before falling back to local generation.
Testing
Updated all existing tests to use the new model variants. All tests pass with the new model system, ensuring no regressions in functionality while providing the specific model variants requested.
Establishes a clean, maintainable model system with the exact GPT-4.1 family variants needed for the application.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.