`factory_allowed_llms`
Customize which LLMs are available.
📄 Arguments
Section titled “📄 Arguments”| Name | Type | Description |
|---|---|---|
allowed |
List[LLMSettings] |
List of LLMSettings classes, contains the allowed language models. |
cat |
Cat | Cheshire Cat instance, allows you to use the framework components. |
↩️ Return
Section titled “↩️ Return”Type: List[LLMSettings]
The list of the LLMs that the cat is allowed to use.
✍ Example
Section titled “✍ Example”from cat.factory.llm import LLMSettingsfrom langchain_mistralai.chat_models import ChatMistralAI
# Define your custome LLM based on the cat's "LLMSettings"class MistralAIConfig(LLMSettings): """The configuration for the MistralAI plugin.""" mistral_api_key: Optional[SecretStr] model: str = "mistral-small" max_tokens: Optional[int] = 4096 top_p: float = 1
_pyclass: Type = ChatMistralAI
model_config = ConfigDict( json_schema_extra={ "humanReadableName": "MistralAI", "description": "Configuration for MistralAI", "link": "https://www.together.ai", } )
# Add it to the allowed list.@hookdef factory_allowed_llms(allowed, cat) -> List: allowed.append(MistralAIConfig) return allowed