Elffuss BraidHub

kikocis/lancedb public

main · 2.3 KiBRenderedRawPermalink
1[vectordb](../README.md) / [Exports](../modules.md) / OpenAIEmbeddingFunction
2
3# Class: OpenAIEmbeddingFunction
4
5An embedding function that automatically creates vector representation for a given column.
6
7## Implements
8
9- [`EmbeddingFunction`](../interfaces/EmbeddingFunction.md)\<`string`\>
10
11## Table of contents
12
13### Constructors
14
15- [constructor](OpenAIEmbeddingFunction.md#constructor)
16
17### Properties
18
19- [\_modelName](OpenAIEmbeddingFunction.md#_modelname)
20- [\_openai](OpenAIEmbeddingFunction.md#_openai)
21- [sourceColumn](OpenAIEmbeddingFunction.md#sourcecolumn)
22
23### Methods
24
25- [embed](OpenAIEmbeddingFunction.md#embed)
26
27## Constructors
28
29### constructor
30
31• **new OpenAIEmbeddingFunction**(`sourceColumn`, `openAIKey`, `modelName?`)
32
33#### Parameters
34
35| Name | Type | Default value |
36| :------ | :------ | :------ |
37| `sourceColumn` | `string` | `undefined` |
38| `openAIKey` | `string` | `undefined` |
39| `modelName` | `string` | `'text-embedding-ada-002'` |
40
41#### Defined in
42
43[embedding/openai.ts:22](https://github.com/lancedb/lancedb/blob/92179835/node/src/embedding/openai.ts#L22)
44
45## Properties
46
47### \_modelName
48
49• `Private` `Readonly` **\_modelName**: `string`
50
51#### Defined in
52
53[embedding/openai.ts:20](https://github.com/lancedb/lancedb/blob/92179835/node/src/embedding/openai.ts#L20)
54
55___
56
57### \_openai
58
59• `Private` `Readonly` **\_openai**: `OpenAI`
60
61#### Defined in
62
63[embedding/openai.ts:19](https://github.com/lancedb/lancedb/blob/92179835/node/src/embedding/openai.ts#L19)
64
65___
66
67### sourceColumn
68
69• **sourceColumn**: `string`
70
71The name of the column that will be used as input for the Embedding Function.
72
73#### Implementation of
74
75[EmbeddingFunction](../interfaces/EmbeddingFunction.md).[sourceColumn](../interfaces/EmbeddingFunction.md#sourcecolumn)
76
77#### Defined in
78
79[embedding/openai.ts:56](https://github.com/lancedb/lancedb/blob/92179835/node/src/embedding/openai.ts#L56)
80
81## Methods
82
83### embed
84
85▸ **embed**(`data`): `Promise`\<`number`[][]\>
86
87Creates a vector representation for the given values.
88
89#### Parameters
90
91| Name | Type |
92| :------ | :------ |
93| `data` | `string`[] |
94
95#### Returns
96
97`Promise`\<`number`[][]\>
98
99#### Implementation of
100
101[EmbeddingFunction](../interfaces/EmbeddingFunction.md).[embed](../interfaces/EmbeddingFunction.md#embed)
102
103#### Defined in
104
105[embedding/openai.ts:43](https://github.com/lancedb/lancedb/blob/92179835/node/src/embedding/openai.ts#L43)