Model Configuration¶
Model Detection¶
By default, Vulcan will detect, configure, and use supported1 LangChain model implementations found within the Python environment. Model implementations can be installed along with vulcan-core as an "extra" package.
For example, to use OpenAI as a model provider, specify the openai extra when installing Vulcan:
Multiple Model Providers
Vulcan does not guarantee the order of model detection when multiple providers are present within the Python environment. If you wish to use multiple providers, be sure to configure an explicit default as documented in Scoped Model Configuration.
Specifying Your Own Model¶
As an alternative to auto-detection of the supported models Vulcan "extra" packages, you may install and configure your own model provider so long as it extends LangChain's BaseChatModel class. Both "extra" and user-provided models may be specifically configured as follows:
Rule-Specific Model Configuration¶
Vulcan can be configured at a variety of levels to use custom-configured models. The most granular approach is to specify the model individually for each rule.
| Python | |
|---|---|
- You may specify your own model parameters such as temperature and max tokens when creating the model instance.
- Note the additional
modelargument which accepts any instance of LangChainBaseChatModel.
Scoped Model Configuration¶
Specifying the model for each rule can be tedious. To reduce duplication, use the Python functools.partial function to create a customized condition function with the model pre-configured. This allows you to specify the model once and reuse it across multiple rules.
| Python | |
|---|---|
- Replaces the
conditionfunction with your pre-configured version of the function. - Any rules using your partial function will automatically receive your customized model configuration.
Advanced Use-Cases¶
Vulcan allows complex multi-model use-cases that maximize performance while reducing the operating cost of your application. For example, you may wish to use an affordable off-the-shelf model for trivial queries, while leveraging a fine-tuned on-prem model for proprietary knowledge. By combining the above configuration methods, you can easily create a multi-model solution to fit your needs.
Bringing it all Together¶
A complete example demonstrating the discussed features:
- This rule will use
gpt-4oinstead of the configured default. - Uses the configured default model
gpt-4o-miniassigned in the partial function.
| Text Output | |
|---|---|
-
For the latest list of supported models, refer to the Vulcan PyPI page under the "Extras" section. ↩