Skip to main content
Chonkie allows you to use your own embeddings handler by creating a child class of the BaseEmbeddings class, and implementing the necessary methods. It’s quite simple!

Example

First, we create a child class of the BaseEmbeddings class, and implement the necessary methods.
At this point, we have a custom embeddings handler, we can use it like this:
But let’s say we want to use this together with the AutoEmbeddings class, for the sake of convenience. We can do this by registering it with the EmbeddingsRegistry.
Now we can use our custom embeddings handler with the AutoEmbeddings class.
Finally, we can use our custom embeddings handler in the same way we would use any other embeddings handler.