Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Cohere Chat blueprint with RAG #1991

Merged
merged 4 commits into from
Feb 13, 2024

Conversation

tianjing-li
Copy link
Contributor

Description

[Describe what this change achieves]

  • Adds a new Cohere Chat connector blueprint

Issues Resolved

[List any issues this PR will resolve]
N/A

Check List

No new functionality, just new docs

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@tianjing-li tianjing-li temporarily deployed to ml-commons-cicd-env February 2, 2024 15:22 — with GitHub Actions Inactive
@tianjing-li tianjing-li temporarily deployed to ml-commons-cicd-env February 2, 2024 15:22 — with GitHub Actions Inactive
@tianjing-li tianjing-li temporarily deployed to ml-commons-cicd-env February 2, 2024 15:22 — with GitHub Actions Inactive
@tianjing-li tianjing-li changed the title Add Chat blueprint with RAG Add Cohere Chat blueprint with RAG Feb 2, 2024
@tianjing-li tianjing-li temporarily deployed to ml-commons-cicd-env February 2, 2024 15:22 — with GitHub Actions Inactive
@tianjing-li tianjing-li temporarily deployed to ml-commons-cicd-env February 2, 2024 15:22 — with GitHub Actions Inactive
@tianjing-li tianjing-li temporarily deployed to ml-commons-cicd-env February 2, 2024 15:22 — with GitHub Actions Inactive
@tianjing-li tianjing-li temporarily deployed to ml-commons-cicd-env February 2, 2024 15:23 — with GitHub Actions Inactive
@tianjing-li tianjing-li temporarily deployed to ml-commons-cicd-env February 2, 2024 15:23 — with GitHub Actions Inactive
@tianjing-li tianjing-li temporarily deployed to ml-commons-cicd-env February 2, 2024 15:23 — with GitHub Actions Inactive
@tianjing-li tianjing-li temporarily deployed to ml-commons-cicd-env February 2, 2024 15:23 — with GitHub Actions Inactive
@tianjing-li tianjing-li temporarily deployed to ml-commons-cicd-env February 2, 2024 15:23 — with GitHub Actions Inactive
@tianjing-li tianjing-li temporarily deployed to ml-commons-cicd-env February 2, 2024 15:23 — with GitHub Actions Inactive
Copy link

codecov bot commented Feb 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (521b880) 82.94% compared to head (d9a8b3f) 82.92%.
Report is 41 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #1991      +/-   ##
============================================
- Coverage     82.94%   82.92%   -0.02%     
+ Complexity     5414     5412       -2     
============================================
  Files           521      521              
  Lines         21713    21713              
  Branches       2215     2215              
============================================
- Hits          18009    18005       -4     
- Misses         2808     2811       +3     
- Partials        896      897       +1     
Flag Coverage Δ
ml-commons 82.92% <ø> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@tianjing-li tianjing-li temporarily deployed to ml-commons-cicd-env February 2, 2024 15:50 — with GitHub Actions Inactive
@tianjing-li tianjing-li temporarily deployed to ml-commons-cicd-env February 2, 2024 15:50 — with GitHub Actions Inactive
@tianjing-li tianjing-li temporarily deployed to ml-commons-cicd-env February 2, 2024 15:50 — with GitHub Actions Inactive
@tianjing-li
Copy link
Contributor Author

@ylwu-amzn also updated this new doc with some of the suggestions from the Embed one. Take a look when you get a chance, many thanks.


This blueprint will show you how to connect a Cohere chat model to your Opensearch cluster. You will require a Cohere API key to create a connector.

It is suggested to use the default `command` model for using Chat. Cohere's Chat endpoint also features Retrievel Augmented Generation (or RAG) parameters, by adding `connectors` or `documents` in your request body, in addition to allowing you to pass a `conversation_id` to provide context to Cohere's model.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

by adding connectors or documents in your request body

I think you mean Cohere connectors here, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes correct, Cohere connectors - there should be text earlier linking docs and explaining the difference, but I can clarify that here as well

POST /_plugins/_ml/models/<MODEL_ID_HERE>/_predict
{
"parameters": {
"message": "What is the weather like in London?",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure the example in this doc can work

Suggested change
"message": "What is the weather like in London?",
"message": "What is the weather like in London?"

"Authorization": "Bearer ${credential.cohere_key}",
"Request-Source": "unspecified:opensearch"
},
"request_body": "{ \"message\": ${parameters.message}, \"model\": \"${parameters.model}\" }"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"request_body": "{ \"message\": ${parameters.message}, \"model\": \"${parameters.model}\" }"
"request_body": "{ \"message\": \"${parameters.message}\", \"model\": \"${parameters.model}\" }"

@ylwu-amzn
Copy link
Collaborator

@tianjing-li You can refer to this tutorial for how to use Cohere command model in RAG pipeline #2075

@jngz-es jngz-es merged commit 38566f5 into opensearch-project:main Feb 13, 2024
10 of 14 checks passed
@tianjing-li
Copy link
Contributor Author

@ylwu-amzn thank you!

opensearch-trigger-bot bot pushed a commit that referenced this pull request Feb 29, 2024
* Add Chat blueprint with RAG

* Remove content-type

* Updates

* Update docs

(cherry picked from commit 38566f5)
dhrubo-os pushed a commit that referenced this pull request Feb 29, 2024
* Add Chat blueprint with RAG

* Remove content-type

* Updates

* Update docs

(cherry picked from commit 38566f5)

Co-authored-by: Tianjing Li <[email protected]>
austintlee pushed a commit to austintlee/ml-commons that referenced this pull request Mar 19, 2024
* Add Chat blueprint with RAG

* Remove content-type

* Updates

* Update docs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants