Embeddings
POST
/embeddingsOpenAI Guide
OpenAI API Reference
OpenAI's text embeddings are used to measure the relevance between text strings. Embeddings are typically used for:
- Search (where results are ranked based on relevance to the query string)
- Clustering (where text strings are grouped by similarity)
- Recommendations (suggesting items related to relevant text strings)
- Anomaly Detection(identifying outliers that are different or less relevant)
- Diversity Measurement (analyzing the distribution of similarities)
- Classification (categorizing text strings by the most similar label)
An embedding is a list of floating-point numbers (a vector). The distance between two vectors measures their relevance. A small distance indicates high relevance, while a large distance indicates low relevance.
Price List:https://302.ai/pricing_api/
请求参数
API Key from 302.AI backend
ID of the model to be used. You can use the List models API to view all available models, or refer to our model overview to understand their descriptions.
Enter text to get the embedding, which can be encoded as a string or an array of tokens. To get embeddings for multiple inputs in a single request, pass an array of strings or tokens. Each input must not exceed 8192 tokens.
{
"model": "text-embedding-ada-002",
"input": "The food was delicious and the waiter..."
}
示例代码
Responses
{
"object": "list",
"data": [
{
"object": "embedding",
"embedding": [
0.0023064255,
-0.009327292,
.... (1536 floats total for ada-002)
-0.0028842222
],
"index": 0
}
],
"model": "text-embedding-ada-002",
"usage": {
"prompt_tokens": 8,
"total_tokens": 8
}
}