Skip to main content
Together’s Embeddings API lets you turn some input text (the input) into an array of numbers (the embedding). The resulting embedding can be compared against other embeddings to determine how closely related the two input strings are. Embeddings from large datasets can be stored in vector databases for later retrieval or comparison. Common use cases for embeddings are search, classification, and recommendations. They’re also used for building Retrieval Augmented Generation (RAG) applications.

Generating a single embedding

Use client.embeddings.create to generate an embedding for some input text, passing in a model name and input string:
The response will be an object that contains the embedding under the data key, as well as some metadata:
JSON

Generating multiple embeddings

You can also pass an array of input strings to the input option:
The response.data key will contain an array of objects for each input string you provide:
JSON