Unsupervised category assignment
Classify text into predefined categories when labeled examples are unavailable.
AI & ML · Const
Zero-shot classification with embeddings assigns new text to the most similar candidate class without labeled training data. Embed each class name or short description, compare it with the input embedding, and choose the highest-similarity class.
Zero-shot classification uses an embedding model without labeled training examples. Represent each candidate class by its name or a short description, embed the new text and every class representation, then compare similarities and select the class with the highest score.
client.embeddings.create(model="text-embedding-3-small", input=[...])from openai import OpenAI
client = OpenAI()
response = client.embeddings.create(
model="text-embedding-3-small",
input=["cat", "dog", "vehicle"]
)
# Compare each input embedding with embeddings for class descriptions,
# then choose the class with the highest similarity.This example obtains embeddings that can be compared with embeddings for candidate class descriptions; classification selects the most similar class.
Classify text into predefined categories when labeled examples are unavailable.
Match incoming text to candidate intents represented by short descriptions.
Select the closest semantic label from a fixed list of classes.
Vector embeddingsembeddings APItext-embedding-3-smallzero-shot classification