REST API for Embed Text
REST API endpoints with verb as POST are as follows:
https://<hostname>:<port>/siebel/v1.0/service/SiebelOCIAIWebService/InvokeOCIAI
https://<hostname>:<port>/siebel/v1.0/service/SiebelOCIAIWebService/EmbedText
//Request payload with cohere.command-r-XXXX
{
"body": {
"Context": "GenAI:EmbedText",
"EmbedText_Param_1": "prompt:If the problem still persists, might need to debug the code. Please set Immediate Post to True for the field Interest in the event. If it did not resolve the issue,try to activate the Total field in the quote BC. This is the new SR in your queue." ,
"EmbedText_Param_2": "compartmentId:ocid1.tenancy.oc1..XXXXXXX"
}
}
//corresponding Response Payload
{
"Status": "Success",
"Output": "EmbedTextResult(super=BmcModel(__explicitlySet__=[embeddings, modelId, modelVersion, id])id=f16ba6a6-0368-47a4-9384-0089a83064f2, inputs=null, embeddings=[[1.3017578, 0.011962891, -0.39868164, -1.3125, 1.1777344, -1.2578125, -1.9111328, -1.7558594, 2.2617188, -1.8447266, 2.2578125, -0.76708984, -2.15625, -2.1992188, 1.6982422, 0.82177734, -1.0625, -0.32788086, 0.17468262, -0.2487793, 0.15112305, 0.59716797, 3.0429688, 0.11425781, -0.54589844, 1.3798828, 1.2939453, 0.7680664, -1.0263672, 0.9848633, 0.98046875, -0.36328125, -0.6352539, 0.33325195, -1.6826172, 0.03955078, -3.0664062, 0.24401855, -2.1816406, 2.6816406, -1.2578125, 0.77197266, -1.0341797, 0.088378906, -0.5395508,
. . .
25, 1.1748047, 0.53027344, 0.019500732, 0.79589844, 1.2939453, 1.6904297, -0.50146484, -0.1138916, -0.9296875, 1.2880859, -0.85302734, 0.69677734, -2.9550781, 1.9208984, 0.82666016]], modelId=cohere.embed-english-light-v2.0, modelVersion=2.0)",
"OPCRequestId": "21F32E8D687AAAAAAA/BE22BA603BB123C5E5BBBBBBB/FCCDA06F70EF3CCFCCCCCCCC"
}
Using the EmbedText Method
The EmbedText method on SiebelOCIAIWebService can be used to create vector embeddings for text.
An example request is shown here:
{
"body": {
"Prompt": "Customer is interested in renewal options and pricing flexibility.",
"CompartmentId": "<oci-compartment-ocid>"
}
}
The corresponding response is returned as
follows:
{
"Status": "Success",
"Operation": "EmbedText",
"Embeddings": "<embedding-result>"
}