@lancedb/lancedb β’ Docs
@lancedb/lancedb / embedding / EmbeddingFunctionRegistry
Class: EmbeddingFunctionRegistry
This is a singleton class used to register embedding functions and fetch them by name. It also handles serializing and deserializing. You can implement your own embedding function by subclassing EmbeddingFunction or TextEmbeddingFunction and registering it with the registry
Constructors
new EmbeddingFunctionRegistry()
Returns
Methods
functionToMetadata()
Parameters
- conf:
EmbeddingFunctionConfig
Returns
Record
<string
, any
>
get()
Fetch an embedding function by name
Type Parameters
β’ T extends EmbeddingFunction
<unknown
, FunctionOptions
>
Parameters
- name:
string
The name of the function
Returns
undefined
| EmbeddingFunctionCreate
<T
>
getTableMetadata()
Parameters
- functions:
EmbeddingFunctionConfig
[]
Returns
Map
<string
, string
>
length()
Get the number of registered functions
Returns
number
register()
Register an embedding function
Type Parameters
β’ T extends EmbeddingFunctionConstructor
<EmbeddingFunction
<any
, FunctionOptions
>> = EmbeddingFunctionConstructor
<EmbeddingFunction
<any
, FunctionOptions
>>
Parameters
-
alias?:
string
Returns
Function
Parameters
- ctor:
T
Returns
any
Throws
Error if the function is already registered
reset()
reset the registry to the initial state
Parameters
Returns
void