From a72b20491daf9d5885ccf68c112a92d8d6efd958 Mon Sep 17 00:00:00 2001 From: Dhrubo Saha Date: Thu, 17 Aug 2023 13:11:00 -0700 Subject: [PATCH] updating cohere blueprint doc (#1213) * updating cohere blueprint doc Signed-off-by: Dhrubo Saha * fixing the blueprint Signed-off-by: Dhrubo Saha --------- Signed-off-by: Dhrubo Saha --- .../cohere_connector_embedding_blueprint.md | 8 +- .../cohere_connector_rerank_blueprint.md | 103 ------------------ 2 files changed, 6 insertions(+), 105 deletions(-) delete mode 100644 docs/remote_inference_blueprints/cohere_connector_rerank_blueprint.md diff --git a/docs/remote_inference_blueprints/cohere_connector_embedding_blueprint.md b/docs/remote_inference_blueprints/cohere_connector_embedding_blueprint.md index db217404e4..901b257eb5 100644 --- a/docs/remote_inference_blueprints/cohere_connector_embedding_blueprint.md +++ b/docs/remote_inference_blueprints/cohere_connector_embedding_blueprint.md @@ -12,6 +12,10 @@ POST /_plugins/_ml/connectors/_create "credential": { "cohere_key": "" }, + "parameters": { + "model": "embed-english-v2.0", + "truncate": "END" + }, "actions": [ { "action_type": "predict", @@ -20,7 +24,7 @@ POST /_plugins/_ml/connectors/_create "headers": { "Authorization": "Bearer ${credential.cohere_key}" }, - "request_body": "{ \"texts\": ${parameters.prompt}, \"truncate\": \"END\" }" + "request_body": "{ \"texts\": ${parameters.texts}, \"truncate\": \"${parameters.truncate}\", \"model\": \"${parameters.model}\" }" } ] } @@ -39,7 +43,7 @@ POST /_plugins/_ml/connectors/_create POST /_plugins/_ml/models//_predict { "parameters": { - "prompt": ["Say this is a test"] + "texts": ["Say this is a test"] } } ``` diff --git a/docs/remote_inference_blueprints/cohere_connector_rerank_blueprint.md b/docs/remote_inference_blueprints/cohere_connector_rerank_blueprint.md deleted file mode 100644 index ffd8a5feb8..0000000000 --- a/docs/remote_inference_blueprints/cohere_connector_rerank_blueprint.md +++ /dev/null @@ -1,103 +0,0 @@ -### Cohere connector blueprint example for rerank: - -#### this blueprint is created from Cohere doc: https://docs.cohere.com/reference/rerank-1 - -```json -POST /_plugins/_ml/connectors/_create -{ - "name": "", - "description": "", - "version": "", - "protocol": "http", - "parameters": { - "endpoint": "api.cohere.ai", - "model": "rerank-english-v2.0", - "top_n": 3, - "return_documents": true - }, - "credential": { - "api_key": "" - }, - "actions": [ - { - "action_type": "predict", - "method": "POST", - "url": "https://${parameters.endpoint}/v1/rerank", - "headers": { - "Authorization": "Bearer ${credential.api_key}" - }, - "request_body": "{ \"model\": \"${parameters.model}\", \"query\" : \"${parameters.query}\", \"documents\" : ${parameters.documents}, \"top_n\" : ${parameters.top_n}, \"return_documents\" : ${parameters.return_documents} }" - } - ] -} -``` -#### Sample response -```json -{ - "connector_id": "XU5UiokBpXT9icfOM0vt" -} -``` - - -### Corresponding Predict request example: - -```json -POST /_plugins/_ml/models//_predict -{ - "parameters": { - "query": "What is the capital of the United States?", - "documents": [ - "Carson City is the capital city of the American state of Nevada.", - "The Commonwealth of the Northern Mariana Islands is a group of islands in the Pacific Ocean. Its capital is Saipan.", - "Washington, D.C. (also known as simply Washington or D.C., and officially as the District of Columbia) is the capital of the United States. It is a federal district.", - "Capital punishment (the death penalty) has existed in the United States since beforethe United States was a country. As of 2017, capital punishment is legal in 30 of the 50 states." - ] - } -} -``` - -#### Sample response -```json -{ - "inference_results": [ - { - "output": [ - { - "name": "response", - "dataAsMap": { - "id": "c536e12e-c7fe-414c-9a00-d1c5c6757b34", - "results": [ - { - "document": { - "text": "Washington, D.C. (also known as simply Washington or D.C., and officially as the District of Columbia) is the capital of the United States. It is a federal district." - }, - "index": 2, - "relevance_score": 0.98005307 - }, - { - "document": { - "text": "Capital punishment (the death penalty) has existed in the United States since beforethe United States was a country. As of 2017, capital punishment is legal in 30 of the 50 states." - }, - "index": 3, - "relevance_score": 0.27904198 - }, - { - "document": { - "text": "Carson City is the capital city of the American state of Nevada." - }, - "index": 0, - "relevance_score": 0.10194652 - } - ], - "meta": { - "api_version": { - "version": "1" - } - } - } - } - ] - } - ] -} -```