| 1 | [vectordb](../README.md) / [Exports](../modules.md) / EmbeddingFunction |
| 2 | |
| 3 | # Interface: EmbeddingFunction\<T\> |
| 4 | |
| 5 | An 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 | |
| 34 | The name of the column that will contain the embedding |
| 35 | |
| 36 | By 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 | |
| 52 | Creates 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 | |
| 74 | The data type of the embedding |
| 75 | |
| 76 | The embedding function should return `number`. This will be converted into |
| 77 | an Arrow float array. By default this will be Float32 but this property can |
| 78 | be 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 | |
| 90 | The dimension of the embedding |
| 91 | |
| 92 | This 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 |
| 94 | to 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 | |
| 106 | Should the source column be excluded from the resulting table |
| 107 | |
| 108 | By default the source column is included. Set this to true and |
| 109 | only 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 | |
| 121 | The 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) |