Create a Cohere inference endpoint
Added in 8.13.0
Create an inference endpoint to perform an inference task with the cohere
service.
Path parameters
-
task_type
string Required The type of the inference task that the model will perform.
Values are
completion
,rerank
, ortext_embedding
. -
cohere_inference_id
string Required The unique identifier of the inference endpoint.
Body
-
chunking_settings
object -
service
string Required Value is
cohere
. -
service_settings
object Required -
task_settings
object
PUT
/_inference/{task_type}/{cohere_inference_id}
curl \
--request PUT 'http://api.example.com/_inference/{task_type}/{cohere_inference_id}' \
--header "Authorization: $API_KEY" \
--header "Content-Type: application/json" \
--data '"{\n \"service\": \"cohere\",\n \"service_settings\": {\n \"api_key\": \"Cohere-Api-key\",\n \"model_id\": \"embed-english-light-v3.0\",\n \"embedding_type\": \"byte\"\n }\n}"'
Request examples
A text embedding task
Run `PUT _inference/text_embedding/cohere-embeddings` to create an inference endpoint that performs a text embedding task.
{
"service": "cohere",
"service_settings": {
"api_key": "Cohere-Api-key",
"model_id": "embed-english-light-v3.0",
"embedding_type": "byte"
}
}
Run `PUT _inference/rerank/cohere-rerank` to create an inference endpoint that performs a rerank task.
{
"service": "cohere",
"service_settings": {
"api_key": "Cohere-API-key",
"model_id": "rerank-english-v3.0"
},
"task_settings": {
"top_n": 10,
"return_documents": true
}
}