Files
lancedb/docs/src/js/namespaces/embedding/classes/EmbeddingFunctionRegistry.md
Will Jones db125013fc docs: better formatting for Node API docs (#1892)
* Sets `"useCodeBlocks": true`
* Adds a post-processing script `nodejs/typedoc_post_process.js` that
puts the parameter description on the same line as the parameter name,
like it is in our Python docs. This makes the text hierarchy clearer in
those sections and also makes the sections shorter.
2024-12-09 17:04:09 -08:00

2.4 KiB

@lancedb/lancedbDocs


@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()

new EmbeddingFunctionRegistry(): EmbeddingFunctionRegistry

Returns

EmbeddingFunctionRegistry

Methods

functionToMetadata()

functionToMetadata(conf): Record<string, any>

Parameters

Returns

Record<string, any>


get()

get<T>(name): undefined | EmbeddingFunctionCreate<T>

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()

getTableMetadata(functions): Map<string, string>

Parameters

Returns

Map<string, string>


length()

length(): number

Get the number of registered functions

Returns

number


register()

register<T>(this, alias?): (ctor) => any

Register an embedding function

Type Parameters

T extends EmbeddingFunctionConstructor<EmbeddingFunction<any, FunctionOptions>> = EmbeddingFunctionConstructor<EmbeddingFunction<any, FunctionOptions>>

Parameters

Returns

Function

Parameters
  • ctor: T
Returns

any

Throws

Error if the function is already registered


reset()

reset(this): void

reset the registry to the initial state

Parameters

Returns

void