-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat: implement hybrid ProviderId system to support custom providers #1847
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
base: main
Are you sure you want to change the base?
feat: implement hybrid ProviderId system to support custom providers #1847
Conversation
|
🎨 Code Formatting Update Applied code formatting fixes to ensure compliance with rustfmt standards:
Co-Authored-By: ForgeCode [email protected] |
|
@dariuszkowalski-com #1875 can this solve the problem? |
1fdfd07 to
3dbaafd
Compare
- Replace static ProviderId enum with flexible hybrid system supporting both built-in and custom providers - Add BuiltInProviderId enum for type-safe built-in provider identification - Add Custom(String) variant for runtime-defined custom providers - Implement comprehensive helper methods for provider identification and creation - Add custom Serialize/Deserialize implementations for backward compatibility - Update all ProviderId usage across codebase to use helper methods - Fix move/borrow checker errors by adding proper .clone() calls - Add comprehensive test coverage for new ProviderId functionality - Resolve issue antinomyhq#1816: custom providers now visible and selectable in UI This change enables users to define custom providers in provider.json configuration and have them appear in provider selection menu as fully functional options. Co-Authored-By: ForgeCode <[email protected]>
3dbaafd to
54cf67e
Compare
No, it do not resolve issue. Here how forge see the problem: Analysis of Custom Provider Issue #1816 and Proposed SolutionsProblem (#1816)The issue is that custom providers are non-functional despite proper implementation of the loading mechanism. The root cause is a static Branch
|
|
the issue you mentioned Deserialization still validates only built-in providers (crates/forge_domain/src/provider.rs:145-148) is solved in current implementation, take a pull and try |
I have tried and i can not add my custom provider to forge I have got this [
{
"id": "vllm_local",
"api_key_vars": "VLLM_LOCAL_API_KEY",
"url_param_vars": ["VLLM_LOCAL_URL"],
"response_type": "OpenAI",
"url": "{{VLLM_LOCAL_URL}}/v1/chat/completions",
"models": "{{VLLM_LOCAL_URL}}/v1/models",
"auth_methods": ["api_key"]
}
]It works with my implementation BTW. I have added also different way of showing urls. |
- Replace problematic 'result.is_err() || true' assertion with proper error handling - Test now verifies authentication fails with appropriate error (not verifier-related) - Maintains original test intent while satisfying clippy requirements Co-Authored-By: ForgeCode <[email protected]>
|
Ok, now It works. Some issues:
this is resolved in my PR
This is not obvious for users
Forge 1.3.0 show error: In that situation, only recreate a configuration helped. |
Pull Request: Fix custom providers functionality (#1816)
Summary
Resolves the fundamental issue where custom providers defined in configuration files were not appearing in the CLI provider selection menu, making them completely unusable despite being properly configured.
Problem Analysis
The root cause was architectural - the
ProviderIdenum was static and compile-time only, with hardcoded variants likeOpenAI,Anthropic, etc. Runtime-defined providers (custom providers) had no representation in this system, causing them to be filtered out during provider enumeration.Solution Design
Implemented a hybrid ProviderId system that supports both built-in and custom providers:
Implementation Details
Core Architecture Changes
crates/forge_domain/src/provider.rs):BuiltInProviderId+Custom(String)is_openai(),is_anthropic(), etc.) for type-safe checkingUI/UX Improvements
crates/forge_main/src/model.rs):Documentation & Templates
.forge/directory):provider-template.json- Detailed template with 4 provider typesprovider-example-vllm.json- Ready-to-use VLLM configurationprovider-example-ollama.json- Ollama setup with hardcoded modelsREADME.md- Complete setup guide and troubleshootingKey Decisions & Rationale
Why Hybrid System vs Dynamic Only?
Why Custom Serialize/Deserialize?
"vllm_local"vs{"Custom": "vllm_local"})Why Helper Methods Instead of Pattern Matching?
Testing
Impact
.gitignoreandCUSTOM_PROVIDERS_PLAN.mdas requested)Verification
/providerselection menuReady for code review. Please test with custom provider configuration to verify the fix resolves issue #1816.
Co-Authored-By: ForgeCode [email protected]