This topic describes the API used to vectorize input content.
Prerequisites
An API key for identity authentication is obtained. When you call the API operations of OpenSearch LLM-Based Conversational Search Edition, you must be authenticated. For more information, see Manage API keys. LLM is short for large language model.
An endpoint is obtained. When you call the API operations of OpenSearch LLM-Based Conversational Search Edition, you must specify an endpoint. For more information, see Obtain endpoints.
Operation information
Request method | Request protocol | Request data format |
POST | HTTP | JSON |
Request URL
{host}/v3/openapi/apps/[app_group_identity]/actions/embedding{host}: the endpoint that is used to call the API operation. You can call the API operation over the Internet or a virtual private cloud (VPC). For more information about how to obtain an endpoint, see Obtain endpoints.{app_group_identity}: the name of the application that you want to access. You can log on to the OpenSearch LLM-Based Conversational Search Edition console and view the application name of the corresponding instance on the Instance Management page.
Request parameters
Header parameters
Parameter | Type | Required | Description | Example |
Content-Type | string | Yes | The data format of the request. Only the JSON format is supported. Set the value to application/json. | application/json |
Authorization | string | Yes | The API key used for request authentication. The value must start with Bearer. | Bearer OS-d1**2a |
Body parameters
Parameter | Type | Required | Default value | Description |
input | list<string> | Yes | The input content to be vectorized. | |
model | string | No | ops-text-embedding-001 | The vectorization model to be used. Valid values:
|
is_query | boolean | No | Specifies whether the input content is a query. Valid values: true: The input content is a query. false: The input content is a document. |
Sample request body
{
"input": ["Test content"],
"model":"ops-text-embedding-001",
"is_query" : true
}Response parameters
Parameter | Type | Description |
request_id | string | The request ID. |
status | string | Indicates whether the request was successful. Valid values: OK: The request was successful. FAIL: The request failed. |
latency | double | The time consumed to process the request. Unit: milliseconds. |
result.embeddings | list<string> | The vectors that are generated after the input content is vectorized. The vectors are returned in the same order as the elements in the input content. |
Sample response body
{
"request_id":"613cd5cd-6818-48ce-8719-f50670fee284",
"status":"OK",
"latency":10.05241,
"result":{
"embeddings":[
"0.003143,0.009750,0.075439,-0.025543,-0.019058,-0.074097,-0.023239,-0.008781,-0.051025,-0.016968,0.026215,0.001851,-0.007431,-0.072083,-0.018951,0.003891,0.041321,0.014435,-0.054230,-0.043610,-0.049042,0.017563,0.025436,0.014534,-0.007523,0.015640,-0.027618,0.021332,0.036011,0.029892,-0.012901,0.022873,0.010918,0.005352,0.007942,-0.030472,0.003809,0.018524,-0.052460,-0.014297,0.029175,0.041840,-0.019119,-0.039459,-0.030167,-0.006817,0.065613,-0.012672,-0.042206,-0.059326,0.044952,0.323730,0.014801,0.021378,0.005634,0.013069,-0.038910,0.015289,0.049469,0.031174,0.000719,-0.087280,0.035889,-0.032318,0.063782,-0.037323,0.044128,0.013458,0.079224,-0.000351,-0.015259,-0.046631,-0.079590,0.008720,0.064026,0.010513,0.007198,0.005306,0.008408,-0.001766,-0.029922,0.005795,-0.037048,-0.010826,-0.063049,-0.016068,-0.023544,-0.049927,0.019470,0.004879,-0.057526,-0.055878,-0.025986,-0.022537,-0.004524,0.039062,-0.009529,-0.028870,-0.015289,0.036835,-0.031708,0.003960,-0.036102,-0.016342,-0.019150,0.003521,-0.022766,0.043671,0.022781,-0.033020,0.026962,0.028824,0.016464,0.007084,-0.019653,-0.016983,-0.012955,-0.010330,0.048584,0.026215,-0.009804,-0.022415,0.004448,-0.060181,0.016495,-0.023926,0.042999,-0.006447,-0.045868,0.004917,0.043274,-0.044464,-0.047516,0.025314,-0.031128,0.024414,-0.024323,0.037994,-0.004902,-0.057281,0.069824,0.013847,-0.039001,-0.016388,-0.007023,0.025909,-0.041168,-0.001718,0.015656,0.007500,0.007843,0.014435,-0.013306,-0.011505,0.009766,0.003822,-0.039459,0.047882,-0.069580,0.057892,-0.003065,0.008179,0.003059,0.010468,0.031097,-0.040161,-0.025467,-0.035797,0.033478,-0.002125,-0.054962,-0.012810,0.003136,0.006054,-0.041138,0.005077,-0.011887,0.055237,-0.000896,-0.044067,-0.061340,-0.019104,0.054932,-0.047852,0.001907,-0.006935,-0.006416,0.017914,-0.020203,-0.019363,-0.046387,0.008080,-0.033691,0.042725,0.056335,0.027390,-0.004097,-0.060547,-0.033295,-0.007610,0.029099,0.029099,-0.048218,0.032867,-0.015503,0.000536,-0.014397,0.021271,0.003983,0.076111,-0.001538,-0.009132,-0.003376,0.034485,-0.021637,-0.006027,-0.051910,0.028320,-0.073181,-0.007423,0.040741,-0.053528,-0.023407,-0.000560,-0.033081,0.012825,-0.050049,0.001805,0.023865,-0.079285,-0.003090,-0.004478,-0.011986,-0.020630,-0.041443,0.014069,-0.017487,-0.001542,-0.046021,0.022339,0.027618,0.052979,-0.015884,-0.059784,0.020584,0.031616,-0.008324,-0.033295,-0.008148,0.007580,-0.016617,-0.064636,0.055481,-0.058136,-0.010185,0.007828,-0.057770,-0.038025,-0.013031,-0.009209,-0.058044,0.030304,0.039246,0.017563,-0.007416,-0.031586,0.019974,-0.042358,-0.058350,0.065063,-0.032196,0.058228,-0.027069,-0.021011,0.040710,0.013809,0.035004,0.046143,-0.027466,-0.030823,-0.021561,0.022675,0.022415,0.006783,-0.036041,0.025955,0.016037,0.021927,-0.015358,-0.015625,-0.018158,0.018707,-0.017349,0.027466,0.202515,-0.062927,0.043365,0.051270,0.043732,0.036255,0.006828,-0.000393,0.039764,0.010315,-0.051605,0.030502,0.071655,-0.013252,0.014633,-0.007828,-0.024094,0.006184,0.056946,0.009308,-0.056580,0.006413,-0.017365,-0.047852,0.009109,-0.033051,0.027664,-0.006336,0.029388,0.034698,-0.011467,-0.008682,0.035126,0.037598,-0.044006,-0.014557,0.024109,-0.001904,0.038544,0.014397,0.033661,0.039215,-0.010803,-0.008560,-0.015854,-0.006977,0.013031,0.025238,-0.016464,-0.040863,0.014626,-0.032990,0.045959,0.031433,0.012466,-0.003803,-0.078125,0.009148,-0.030396,-0.002428,-0.007168,0.040497,0.016708,0.010529,-0.030304,0.021774,-0.049042,0.019669,-0.003691,-0.001348,-0.019318,-0.031830,-0.026703,0.015114,0.026855,0.017029,0.028992,-0.019058,0.021576,-0.021622,0.044952,0.031616,-0.018143,-0.001287,0.026779,-0.036957,0.014999,-0.043335,-0.025955,-0.018890,-0.062256,0.024414,-0.021072,-0.044983,0.013603,-0.016739,0.000473,0.023758,0.005505,-0.020630,-0.044556,-0.020081,0.031555,0.004467,0.009529,0.043640,0.019730,-0.035400,0.007973,0.051239,0.051361,0.006710,-0.052612,-0.005020,0.029663,0.015961,-0.032410,-0.032318,-0.052856,-0.016800,-0.038727,0.050476,-0.016937,0.000709,0.045258,-0.045135,0.011917,-0.038513,0.081482,0.002676,0.029266,-0.015793,0.030151,-0.028015,0.011162,-0.026306,0.036224,0.031891,0.017395,-0.021301,0.061951,0.029663,0.008423,0.004654,-0.016235,-0.022858,-0.030579,-0.033997,-0.057129,-0.032715,-0.029068,0.026505,0.022675,-0.007694,0.015007,-0.033508,0.044281,0.000368,0.001965,-0.048492,-0.007416,-0.021118,0.000544,0.029037,0.007725,0.076477,-0.024521,-0.018524,0.010513,-0.010384,0.026810,-0.006538,0.000190,-0.035645,0.013771,0.052765,0.022339,0.017426,0.019150,-0.030151,0.018997,0.013580,0.025864,0.009964,-0.041901,-0.082458,-0.000340,0.011818,-0.000464,-0.017563,0.004177,0.066162,0.003910,0.012169,-0.020462,0.033020,-0.023331,0.093628,0.004139,-0.014160,-0.007866,-0.032166,0.040039,-0.010994,-0.030930,0.028671,0.046478,-0.040161,-0.039856,0.044861,0.038818,-0.018295,0.016556,-0.024124,-0.017120,0.029190,0.013306,0.020523,-0.001258,0.035400,-0.002609,0.019028,-0.039917,0.000811,-0.015038,0.011314,0.042999,0.008926,-0.025223,0.034332,0.013931,0.013283,0.015945,0.029617,-0.036438,0.072388,-0.037933,-0.014732,0.014496,0.019974,0.052368,-0.009964,-0.033844,-0.024414,0.034302,-0.060730,0.003887,0.044952,0.045715,-0.049957,0.042603,-0.013695,0.035034,-0.013252,0.000784,-0.054871,-0.032318,0.005516,0.006817,0.035126,0.065125,-0.026932,-0.098145,-0.041229,0.003736,0.006096,-0.013916,0.025833,-0.071472,-0.016235,0.032349,0.044525,0.015945,-0.000418,-0.030426,-0.032715,0.036255,0.010376,-0.027206,0.050476,-0.023911,0.001242,-0.016220,-0.058350,0.028091,0.025024,-0.037231,0.039703,-0.004238,-0.035400,-0.047424,-0.037140,-0.008827,-0.025284,-0.017075,0.042267,-0.052216,0.020935,-0.012901,-0.021637,-0.000046,0.017715,0.014236,-0.001062,-0.024246,0.070801,0.032135,0.036194,0.055939,-0.013733,0.009201,0.000577,0.027557,-0.029541,0.002941,-0.037842,-0.069885,0.022339,0.045563,-0.031525,-0.005444,0.032410,-0.037720,-0.012856,0.007118,0.006966,0.017502,-0.003576,-0.028961,-0.017319,0.004440,-0.040924,0.067993,0.007751,0.014145,-0.061249,0.001839,-0.051880,0.051086,0.035828,0.013985,0.056244,-0.012314,0.034180,-0.020935,0.009247,-0.002575,0.032074,-0.006577,-0.007324,0.025909,-0.020355,0.080017,0.034576,-0.039642,-0.016159,-0.044617,-0.015839,0.079407,0.000443,-0.009438,0.056580,0.076477,0.021408,-0.013695,0.019028,-0.029114,0.016251,0.056488,-0.065674,0.011337,-0.011871,0.001654,-0.042603,0.045258,0.066650,0.033936,0.040009,0.014259,-0.017136,-0.029526,0.028122,0.011246,0.022141,0.051971,-0.017456,-0.048340,0.029419,-0.003347,0.008392,0.033844,-0.018158,-0.016586,0.029022,0.006397,-0.017517,-0.000075,0.011215,-0.019974,0.003164,-0.050262,0.077454,-0.037781,0.008408,0.054138,-0.040039,0.012085,0.046509,-0.013916,-0.009834,0.023117,-0.022827,-0.071960,-0.051147,-0.008049,-0.011131,-0.020126,-0.067871,0.048370,0.030121,0.056335,0.003117,0.026962,0.083069,0.006729,0.001438,0.100708,-0.002239,-0.008461,-0.040405,-0.008949,0.053772,-0.019501,-0.005440,0.021072,0.002775,-0.051971,-0.010406,-0.049896,-0.045776,-0.017456,0.071838,0.006714,-0.024277,0.035217,0.022842,-0.017593,-0.034271,0.042877,-0.044830,-0.051910,-0.070618,0.009377,0.012207,0.038116,0.029175,-0.015976,-0.026062,-0.004234,-0.006565,-0.007973,-0.046539,0.031799,-0.042603,-0.021973,-0.007278,-0.015762,0.032440,0.024216,-0.061401,-0.036194,-0.021225,-0.026428,-0.017395"
]
}
}