Skip to content

Commit f9d29fb

Browse files
committed
Updating readme.
1 parent 3fd64f2 commit f9d29fb

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

README.md

+18
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,24 @@ ans =
235235

236236
You can extract the arguments and write the data to a table, for example.
237237

238+
### Obtaining embeddings
239+
240+
You can extract embeddings from your text with OpenAI using the function `extractOpenAIEmbeddings` as follows:
241+
```matlab
242+
exampleText = "Here is an example!";
243+
emb = extractOpenAIEmbeddings(exampleText);
244+
```
245+
246+
The resulting embedding is a vector that captures the semantics of your text and can be used on tasks such as retrieval augmented generation and clustering.
247+
248+
```
249+
>> size(emb)
250+
251+
ans =
252+
253+
1 1536
254+
```
255+
238256
## Examples
239257
To learn how to use this in your workflows, see [Examples](/examples/).
240258

extractOpenAIEmbeddings.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
response = llms.internal.sendRequest(parameters,key, END_POINT, nvp.TimeOut);
3636

37-
if isfield(response, "data")
37+
if isfield(response.Body.Data, "data")
3838
emb = [response.Body.Data.data.embedding];
3939
emb = emb';
4040
else

0 commit comments

Comments
 (0)