View source: R/textEmbedding.R
textEmbedding | R Documentation |
This function calls the OpenAI Embeddings API to get the multidimensional vector via text embedding of the input text. This function uses the 'text-embedding-ada-002' model.
textEmbedding(text, api_key = Sys.getenv("OPENAI_API_KEY"))
text |
A string. The input text to get the embedding for. This should be a character string. |
api_key |
A string. The API key for the OpenAI API. Defaults to the value of the environment variable "OPENAI_API_KEY". |
A vector representing the text embeddings.
Satoshi Kume
## Not run:
Sys.setenv(OPENAI_API_KEY = "Your API key")
textEmbedding("Hello, world!")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.