Add suuport for AWS Bedrock Cohere embedding
Description
I missed 2 changed files in last PR, change 2 files, and added 2 files. Added support below 2 Cohere embedings.
- cohere.embed-english-v3
- cohere.embed-multilingual-v3
Fixes # (issue)
Type of Change
Please delete options that are not relevant.
- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] This change requires a documentation update, included: Dify Document
- [ ] Improvement, including but not limited to code refactoring, performance optimization, and UI/UX improvement
- [ ] Dependency upgrade
How Has This Been Tested?
Tested in my docer ENV Dify 0.6.2.
- [ ] TODO
Suggested Checklist:
- [x] I have performed a self-review of my own code
- [x] I have commented my code, particularly in hard-to-understand areas
- [x] My changes generate no new warnings
- [x] I ran
dev/reformat(backend) andcd web && npx lint-staged(frontend) to appease the lint gods - [ ]
optionalI have made corresponding changes to the documentation - [ ]
optionalI have added tests that prove my fix is effective or that my feature works - [ ]
optionalNew and existing unit tests pass locally with my changes
Please fix the lint error. :)
Please fix the lint error. :)
I have fixed the import order.
Please fix the lint error. :)
Hi, the Bedrock Cohere name is a little different from Cohere name. I have tested it before , everything works fine.
Please fix the lint error. :)
We cannot do the change like that, I tested it with name like xxxv3.0 today, it will reprot below error.
Arguments: (InvokeError(),) [2024-04-15 07:46:11,295: ERROR/MainProcess] consume document failed Traceback (most recent call last): File "/app/api/core/model_runtime/model_providers/bedrock/text_embedding/text_embedding.py", line 226, in _invoke_bedrock_embedding response = bedrock_runtime.invoke_model( File "/usr/local/lib/python3.10/site-packages/botocore/client.py", line 535, in _api_call return self._make_api_call(operation_name, kwargs) File "/usr/local/lib/python3.10/site-packages/botocore/client.py", line 983, in _make_api_call raise error_class(parsed_response, operation_name) botocore.errorfactory.ResourceNotFoundException: An error occurred (ResourceNotFoundException) when calling the InvokeModel operation: Could not resolve the foundation model from the provided model identifier.
@guchenhe, @crazywoola PLS review it.