-
-
Notifications
You must be signed in to change notification settings - Fork 6
OpenAI.Embedding
Andrew Lambert edited this page Jul 14, 2024
·
5 revisions
OpenAI.Embedding
Protected Class Embedding
Inherits OpenAI.Response
This class represents an API embedding response. Refer to the OpenAI documentation on the /v1/embeddings
endpoint for further details.
An embedding is basically a list of numbers generated from a text that can be compared to other lists generated from other texts to determine how similar they are. Once generated you can save/reload an embedding for future comparisons.
This example creates two embeddings and then calculates the distance between them:
OpenAI.APIKey = "YOUR API KEY"
Dim embed1 As OpenAI.Embedding = OpenAI.Embedding.Create("Hello, my name is Alice.", "text-embedding-ada-002")
Dim embed2 As OpenAI.Embedding = OpenAI.Embedding.Create("Hello, my name is Bob.", "text-embedding-ada-002")
Dim distance As Double = embed1.DistanceFrom(embed2) ' 0.9008139275638367 (very similar)
- DistanceFrom
- GetResult
- GetResultAttribute
- HasResultAttribute
- Operator_Convert
- Operator_Subscript
- ToString
Wiki home | Project page | Bugs | Become a sponsor
Text and code examples are Copyright ©2023-24 Andrew Lambert, offered under the CC BY-SA 3.0 License.