Skip to content

Commit

Permalink
fix cohere chat blueprint (#2167)
Browse files Browse the repository at this point in the history
* fix cohere chat blueprint

Signed-off-by: Yaliang Wu <[email protected]>

* remove empty line

Signed-off-by: Yaliang Wu <[email protected]>

* remove extra comma

Signed-off-by: Yaliang Wu <[email protected]>

* update response

Signed-off-by: Yaliang Wu <[email protected]>

---------

Signed-off-by: Yaliang Wu <[email protected]>
(cherry picked from commit a0358e2)
  • Loading branch information
ylwu-amzn authored and github-actions[bot] committed Mar 1, 2024
1 parent d6c67b4 commit 3f76571
Showing 1 changed file with 39 additions and 25 deletions.
64 changes: 39 additions & 25 deletions docs/remote_inference_blueprints/cohere_connector_chat_blueprint.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -56,7 +55,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}\" }"
}
]
}
Expand All @@ -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",
Expand Down Expand Up @@ -126,7 +124,7 @@ Note: `conversation_id` here is the string value for "1", but you can use any st
POST /_plugins/_ml/models/<MODEL_ID_HERE>/_predict
{
"parameters": {
"message": "What is the weather like in London?",
"message": "What is the weather like in London?"
}
}
```
Expand All @@ -139,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
}
]
}
Expand Down

0 comments on commit 3f76571

Please sign in to comment.