Elffuss BraidHub

kikocis/lancedb public

main · 3.0 KiBRenderedRawPermalink
1[vectordb](../README.md) / [Exports](../modules.md) / EmbeddingFunction
2
3# Interface: EmbeddingFunction\<T\>
4
5An embedding function that automatically creates vector representation for a given column.
6
7## Type parameters
8
9| Name |
10| :------ |
11| `T` |
12
13## Implemented by
14
15- [`OpenAIEmbeddingFunction`](../classes/OpenAIEmbeddingFunction.md)
16
17## Table of contents
18
19### Properties
20
21- [destColumn](EmbeddingFunction.md#destcolumn)
22- [embed](EmbeddingFunction.md#embed)
23- [embeddingDataType](EmbeddingFunction.md#embeddingdatatype)
24- [embeddingDimension](EmbeddingFunction.md#embeddingdimension)
25- [excludeSource](EmbeddingFunction.md#excludesource)
26- [sourceColumn](EmbeddingFunction.md#sourcecolumn)
27
28## Properties
29
30### destColumn
31
32• `Optional` **destColumn**: `string`
33
34The name of the column that will contain the embedding
35
36By default this is "vector"
37
38#### Defined in
39
40[embedding/embedding_function.ts:49](https://github.com/lancedb/lancedb/blob/92179835/node/src/embedding/embedding_function.ts#L49)
41
42___
43
44### embed
45
46• **embed**: (`data`: `T`[]) => `Promise`\<`number`[][]\>
47
48#### Type declaration
49
50▸ (`data`): `Promise`\<`number`[][]\>
51
52Creates a vector representation for the given values.
53
54##### Parameters
55
56| Name | Type |
57| :------ | :------ |
58| `data` | `T`[] |
59
60##### Returns
61
62`Promise`\<`number`[][]\>
63
64#### Defined in
65
66[embedding/embedding_function.ts:62](https://github.com/lancedb/lancedb/blob/92179835/node/src/embedding/embedding_function.ts#L62)
67
68___
69
70### embeddingDataType
71
72• `Optional` **embeddingDataType**: `Float`\<`Floats`\>
73
74The data type of the embedding
75
76The embedding function should return `number`. This will be converted into
77an Arrow float array. By default this will be Float32 but this property can
78be used to control the conversion.
79
80#### Defined in
81
82[embedding/embedding_function.ts:33](https://github.com/lancedb/lancedb/blob/92179835/node/src/embedding/embedding_function.ts#L33)
83
84___
85
86### embeddingDimension
87
88• `Optional` **embeddingDimension**: `number`
89
90The dimension of the embedding
91
92This is optional, normally this can be determined by looking at the results of
93`embed`. If this is not specified, and there is an attempt to apply the embedding
94to an empty table, then that process will fail.
95
96#### Defined in
97
98[embedding/embedding_function.ts:42](https://github.com/lancedb/lancedb/blob/92179835/node/src/embedding/embedding_function.ts#L42)
99
100___
101
102### excludeSource
103
104• `Optional` **excludeSource**: `boolean`
105
106Should the source column be excluded from the resulting table
107
108By default the source column is included. Set this to true and
109only the embedding will be stored.
110
111#### Defined in
112
113[embedding/embedding_function.ts:57](https://github.com/lancedb/lancedb/blob/92179835/node/src/embedding/embedding_function.ts#L57)
114
115___
116
117### sourceColumn
118
119• **sourceColumn**: `string`
120
121The name of the column that will be used as input for the Embedding Function.
122
123#### Defined in
124
125[embedding/embedding_function.ts:24](https://github.com/lancedb/lancedb/blob/92179835/node/src/embedding/embedding_function.ts#L24)