Now, OpenAI API have text and code embeddings


OpenAI has introduced embeddings, a new endpoint in the OpenAI API, to assist in semantic search, clustering, topic modeling, and classification.

OpenAI’s embeddings outperform top models in three standard benchmarks, including a 20% relative improvement in code search. Embeddings are really useful for working with natural language and code.


Sign up for your weekly dose of what's up in emerging technology.

The embeddings that are numerically similar are also semantically similar. For example, the embedding vector of “canine companions say” will be more similar to the embedding vector of “woof” than “meow.” The new endpoint by OpenAI uses neural network models to map text and code to a vector representation—“embedding” them in a high-dimensional space. Each dimension captures some aspect of the input.

The company has released three families of embedding models for different functionalities including text similarity, text search, and code search. The models take either text or code as input and return an embedding vector.

Text similarity models

The text similarity models provide embeddings that capture the semantic similarity of pieces of text. These models are useful for many tasks including clustering, data visualization, and classification.

Text search models

The text search models provide embeddings that allow large-scale search tasks, such as finding a relevant document among a collection of documents given a text query. The model first embeds for the documents and produces query separately, and then cosine similarity is used to compare the similarity between the query and each document. Such embedding-based search generalize better than word overlap techniques used in the classical keyword search, as it captures the semantic meaning of the text and is also less sensitive to exact phrases or words.

Code search models

Code search models provide code and text embeddings for code search tasks. Given a collection of code blocks, the task is to find the relevant code block for a natural language query. 

Find the embeddings documentation here.

More Great AIM Stories

Meeta Ramnani
Meeta’s interest lies in finding out real practical applications of technology. At AIM, she writes stories that question the new inventions and the need to develop them. She believes that technology has and will continue to change the world very fast and that it is no more ‘cool’ to be ‘old-school’. If people don’t update themselves with the technology, they will surely be left behind.

Our Upcoming Events

Conference, in-person (Bangalore)
MachineCon 2022
24th Jun

Conference, Virtual
Deep Learning DevCon 2022
30th Jul

Conference, in-person (Bangalore)
Cypher 2022
21-23rd Sep

3 Ways to Join our Community

Discord Server

Stay Connected with a larger ecosystem of data science and ML Professionals

Telegram Channel

Discover special offers, top stories, upcoming events, and more.

Subscribe to our newsletter

Get the latest updates from AIM
Amit Raja Naik
Oh boy, is JP Morgan wrong?

The global brokerage firm has downgraded Tata Consultancy Services, HCL Technology, Wipro, and L&T Technology to ‘underweight’ from ‘neutral’ and slashed its target price by 15-21 per cent.