How provider resolution works
mainLangExtract uses a router system to match model_id requests to specific providers.
Resolution Methods
- Auto-detection: If a
model_idis provided that matches a registered pattern (e.g.,mymodel-3bmatchingr'^mymodel'), the router automatically selects that provider. - Explicit Selection: Users can force a specific provider using its class name via
lx.factory.ModelConfig:
Partial matches on the class name (e.g.,config = lx.factory.ModelConfig(provider="MyProviderLanguageModel")provider="myprovider") are also supported. - Default Provider: If a provider is instantiated without a
model_id, it uses the provider's internal default.
Pattern Priority
All registered patterns have an equal priority of 0 by default. You can increase priority using the priority argument in @router.register to ensure specific patterns are matched before more general ones.