barrel_embed_provider behaviour (barrel_embed v2.3.0)
View SourceEmbedding provider behaviour definition
Implement this behaviour to add new embedding providers.
Example Implementation
-module(my_custom_embedder).
-behaviour(barrel_embed_provider).
-export([embed/2, embed_batch/2, dimension/1, name/0]).
embed(Text, Config) ->
%% Your embedding logic here
{ok, Vector}.
embed_batch(Texts, Config) ->
{ok, [embed(T, Config) || T <- Texts]}.
dimension(_Config) -> 768.
name() -> my_custom.
Summary
Functions
Call embed on a provider module. Wraps the call with error handling.
Call embed_batch on a provider module. Wraps the call with error handling.
Check if a provider is available. Returns true if the provider doesn't implement available/1.
Callbacks
Functions
Call embed on a provider module. Wraps the call with error handling.
Call embed_batch on a provider module. Wraps the call with error handling.
Check if a provider is available. Returns true if the provider doesn't implement available/1.