You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* fix: resolve AWS client SigV4 signing, forced SageMaker dep, and missing embed params
- Fix SigV4 host header mismatch: update copied headers dict with correct
host after URL rewrite, so AWSRequest signs with the Bedrock/SageMaker
host instead of stale api.cohere.com
- Add mode parameter to cohere_aws.Client to conditionally initialize
boto3 clients (bedrock-runtime/bedrock vs sagemaker-runtime/sagemaker),
avoiding forced SageMaker dependency for Bedrock users
- Add output_dimension and embedding_types params to embed() for Embed v4
Closes#721
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* test: add integration tests for AWS client fixes
Add skipped integration tests (gated by TEST_AWS) covering:
- BedrockClientV2 embed with SigV4 signing (validates host header fix)
- cohere_aws.Client in Bedrock mode (validates mode param fix)
- embed() with output_dimension and embedding_types (validates v4 params)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: guard SageMaker-only methods in Bedrock mode
Address review feedback: In Bedrock mode, `self._sess` was never set,
so SageMaker-only methods would throw confusing AttributeErrors. Now:
- Initialize `_sess=None` and `_endpoint_name=None` in Bedrock mode
- Add `_require_sagemaker()` guard to connect_to_endpoint,
create_endpoint, export_finetune, summarize, and delete_endpoint
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: add type annotation for TestCohereAwsBedrockClient.client
Fixes mypy attr-defined error in CI.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* test: add mocked unit tests for AWS client fixes
These run in CI without AWS credentials, covering:
- SigV4 signing uses correct host header after URL rewrite
- Mode-conditional boto3 client initialization (sagemaker vs bedrock)
- Default mode is SAGEMAKER for backwards compat
- embed() accepts, passes, and strips output_dimension/embedding_types
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: handle embedding_types dict response in AWS client embed methods
When embedding_types is specified, the Cohere API returns embeddings as
a dict (e.g. {"float": [[...]], "int8": [[...]]}) instead of a flat list.
Both _bedrock_embed and _sagemaker_embed now detect the dict format and
return it directly instead of wrapping it in Embeddings, which would
silently produce wrong results for len() and iteration.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Update sdk version
* fix: correct assertions for dict response in embed integration tests
When embedding_types is passed, _bedrock_embed returns a raw dict
instead of an Embeddings object. Update test assertions to check for
dict type and key presence instead of accessing .embeddings attribute.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: jsklan <jsklan.development@gmail.com>
0 commit comments