`factory_allowed_embedders`
Customize which embedders are available.
📄 Arguments
Section titled “📄 Arguments”| Name | Type | Description |
|---|---|---|
allowed |
List[EmbedderSettings] |
List of EmbedderSettings classes, contains the allowed embedders. |
cat |
Cat | Cheshire Cat instance, allows you to use the framework components. |
↩️ Return
Section titled “↩️ Return”Type: List[EmbedderSettings]
The list of embedders that the cat is allowed to use.
✍ Example
Section titled “✍ Example”from cat.factory.embedder import EmbedderSettingsfrom langchain.embeddings import JinaEmbeddings
# Define your custome embedder based on the cat's "EmbedderSettings"class JinaEmbedderConfig(EmbedderSettings): jina_api_key: str model_name: str='jina-embeddings-v2-base-en' _pyclass: Type = JinaEmbeddings
model_config = ConfigDict( json_schema_extra = { "humanReadableName": "Jina embedder", "description": "Jina embedder", "link": "https://jina.ai/embeddings/", } )
# Add it to the allowed list.@hookdef factory_allowed_embedders(allowed, cat) -> List: allowed.append(JinaEmbedderConfig) return allowed