Skip to main content
To turn your text inputs into vectors of numbers (embeddings), use the LlamaIndex integration with embedding models.

Prerequisites

  1. Create an API key for authentication.
  2. Save the API key to an environment variable:
  3. Install LlamaIndex packages:

Prepare a script

  1. Copy the following part of the script:
  2. Add one of the following methods, depending on your use case:

Examples

Asynchronous request

To get a vector asynchronously, run the script below:
The output is the following:

Request with a batch of texts

To send a batch of texts and receive a vector for every text in this batch, run the following script:
The output is the following: