Commit Graph

8 Commits

Author SHA1 Message Date
Cline
ca41c54cb5 test(bedrock): add comprehensive test coverage for Bedrock integration
- Add tests for AWS Bedrock handler (stream handling, config, errors)
- Add tests for message format conversion (text, images, tools)
- Add tests for stream event parsing and transformation
- Add tests for cross-region inference and prompt cache
- Add tests for metadata and message lifecycle events
2024-12-11 22:48:49 +02:00
Cline
51a57d5bbf fix(bedrock): improve stream handling and type safety
- Fix TypeScript error in ConverseStreamCommand payload
- Add proper JSON parsing for test stream events
- Improve error handling with proper Error objects
- Add test-specific model info with required fields
- Fix cross-region inference and prompt cache config
2024-12-11 22:47:59 +02:00
Cline
140318cecd feat(api): unify Bedrock provider using Runtime API
Problem:
The current Bedrock implementation uses the Bedrock SDK, which requires separate handling for different model types and doesn't provide a unified streaming interface.

Solution:
Integrate the Bedrock Runtime API to provide a single, unified interface for all Bedrock models (Claude and Nova) using the ConverseStream API. This eliminates the need for separate handlers while maintaining all existing functionality.

Key Changes:
- Refactored AwsBedrockHandler to use @aws-sdk/client-bedrock-runtime
- Enhanced bedrock-converse-format.ts to handle all content types and properly transform between Anthropic and Bedrock formats
- Maintained cross-region inference support with proper region prefixing
- Added support for prompt caching configuration
- Improved AWS credentials handling to better support default providers
- Added proper error handling and token tracking for all response types

Dependencies:
- Added @aws-sdk/client-bedrock-runtime for unified API access
- Removed @anthropic-ai/bedrock-sdk dependency

Testing:
- Verified message format conversion for all content types
- Tested cross-region inference functionality
- Validated streaming responses for both Claude and Nova models

This change simplifies the codebase by providing a single, consistent interface for all Bedrock models while maintaining full compatibility with existing features.
2024-12-11 22:47:56 +02:00
Mark Percival
93e70c62f1 Chore: Prettier for consistant formatting (#794)
* Chore: Pretier for consistant formatting

- TODO: This PR needs to be updated by Saoud after he runs `npm install` & `npm format:fix` and commits the results of the prettier changes.

* Revert prettier config

* Run npm install

* Fix prettier config and ignore package lock

* Run format

---------

Co-authored-by: Saoud Rizwan <7799382+saoudrizwan@users.noreply.github.com>
2024-11-21 13:13:54 -08:00
Saoud Rizwan
8f4a65bc79 Fixes 2024-10-09 01:49:59 -04:00
Saoud Rizwan
06ccaf6f67 Implement streaming for all providers 2024-10-09 01:49:55 -04:00
Saoud Rizwan
7271152f62 Add ApiStream generator to interface with providers 2024-10-09 01:49:55 -04:00
Saoud Rizwan
a009c84597 Refactor API 2024-09-24 10:43:31 -04:00