From a1afd255163ab5157e70553ba1cbebf5def3a658 Mon Sep 17 00:00:00 2001 From: Yaliang Wu Date: Wed, 28 Feb 2024 17:24:52 -0800 Subject: [PATCH 1/4] fix cohere chat blueprint Signed-off-by: Yaliang Wu --- .../cohere_connector_chat_blueprint.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/remote_inference_blueprints/cohere_connector_chat_blueprint.md b/docs/remote_inference_blueprints/cohere_connector_chat_blueprint.md index 287b2bcf9f..d44d3d0b5a 100644 --- a/docs/remote_inference_blueprints/cohere_connector_chat_blueprint.md +++ b/docs/remote_inference_blueprints/cohere_connector_chat_blueprint.md @@ -56,7 +56,7 @@ POST /_plugins/_ml/connectors/_create "Authorization": "Bearer ${credential.cohere_key}", "Request-Source": "unspecified:opensearch" }, - "request_body": "{ \"message\": ${parameters.message}, \"model\": \"${parameters.model}\" }" + "request_body": "{ \"message\": \"${parameters.message}\", \"model\": \"${parameters.model}\" }" } ] } From 05bf8c815a361e096725e91aa631cf9e19ff3481 Mon Sep 17 00:00:00 2001 From: Yaliang Wu Date: Wed, 28 Feb 2024 17:27:01 -0800 Subject: [PATCH 2/4] remove empty line Signed-off-by: Yaliang Wu --- .../cohere_connector_chat_blueprint.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/remote_inference_blueprints/cohere_connector_chat_blueprint.md b/docs/remote_inference_blueprints/cohere_connector_chat_blueprint.md index d44d3d0b5a..92eee78780 100644 --- a/docs/remote_inference_blueprints/cohere_connector_chat_blueprint.md +++ b/docs/remote_inference_blueprints/cohere_connector_chat_blueprint.md @@ -12,7 +12,6 @@ See [Cohere's /chat API docs](https://docs.cohere.com/reference/chat) for more d ```json POST /_plugins/_ml/model_groups/_register - { "name": "cohere_model_group", "description": "Your Cohere model group" @@ -70,7 +69,6 @@ You will now register the model you created using the `model_group_id` and `conn ```json POST /_plugins/_ml/models/_register - { "name": "Cohere Chat Model", "function_name": "remote", From f3ce30baa71fd1eb631f0bc433fb2de1fe084c93 Mon Sep 17 00:00:00 2001 From: Yaliang Wu Date: Wed, 28 Feb 2024 17:37:17 -0800 Subject: [PATCH 3/4] remove extra comma Signed-off-by: Yaliang Wu --- .../cohere_connector_chat_blueprint.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/remote_inference_blueprints/cohere_connector_chat_blueprint.md b/docs/remote_inference_blueprints/cohere_connector_chat_blueprint.md index 92eee78780..dca5d7c93a 100644 --- a/docs/remote_inference_blueprints/cohere_connector_chat_blueprint.md +++ b/docs/remote_inference_blueprints/cohere_connector_chat_blueprint.md @@ -124,7 +124,7 @@ Note: `conversation_id` here is the string value for "1", but you can use any st POST /_plugins/_ml/models//_predict { "parameters": { - "message": "What is the weather like in London?", + "message": "What is the weather like in London?" } } ``` From a7558cd05ea55f05636c269abac3041c4c881823 Mon Sep 17 00:00:00 2001 From: Yaliang Wu Date: Thu, 29 Feb 2024 10:55:49 -0800 Subject: [PATCH 4/4] update response Signed-off-by: Yaliang Wu --- .../cohere_connector_chat_blueprint.md | 58 ++++++++++++------- 1 file changed, 37 insertions(+), 21 deletions(-) diff --git a/docs/remote_inference_blueprints/cohere_connector_chat_blueprint.md b/docs/remote_inference_blueprints/cohere_connector_chat_blueprint.md index dca5d7c93a..dd32e48bf4 100644 --- a/docs/remote_inference_blueprints/cohere_connector_chat_blueprint.md +++ b/docs/remote_inference_blueprints/cohere_connector_chat_blueprint.md @@ -137,31 +137,47 @@ It should return a response similar to this: { "output": [ { - "response_id": "f92fdef6-e43c-465f-a2b8-45772b9ef39d", - "text": "The weather on Thursday, February 1, 2018, in London will be an overcast high of 13°C and a low of 10°C. Unfortunately, I cannot give you a detailed weather forecast for the next ten days in London, as it varies considerably across different sources. Would you like to know more about the weather on any particular day within the next ten?", - "generation_id": "76e5c68c-a3ca-40a0-91a9-20315f52b4c4", + "name": "response", + "dataAsMap": { + "response_id": "b0f6eaf6-3f63-418b-9178-a5db8431e55e", + "text": """Here is the current weather and forecast for London, UK: + + **Current Weather:** + + - Temperature: 26.0°C (79°F) + - Conditions: Cloudy with occasional sunny spells + - Humidity: 62% + - Wind: 3 mph (5 km/h) (NW) + - Visibility: 10 km (6 miles) + + **Forecast for the next few days:** + + The weather in London will continue to be moderately warm for the next few days with temperatures reaching 27°C (81°F) on Saturday. The coming days will be mostly cloudy with occasional sunny spells and chances of light rain throughout the weekend. + + Make sure to carry an umbrella if you are going outside, and consider using sunscreen as and when required. + + If you would like a more detailed or specific weather forecast for London, let me know, and I'll be happy to provide it!""", + "generation_id": "89c59a14-f099-4100-95b0-7d0d68104f4b", + "finish_reason": "COMPLETE", "token_count": { - "prompt_tokens": 1523, - "response_tokens": 74, - "total_tokens": 1597, - "billed_tokens": 81 + "prompt_tokens": 70, + "response_tokens": 189, + "total_tokens": 259, + "billed_tokens": 248 }, "meta": { - ... - }, - - "documents": [ - ... - ], - "search_results": [ - ... - ], - "tool_inputs": null, - "search_queries": [ - ... - ] + "api_version": { + "version": "1" + }, + "billed_units": { + "input_tokens": 59, + "output_tokens": 189 + } + } + } } - ] + ], + "status_code": 200 } ] }