bedrock-wrapper 2.4.4 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,37 @@
1
1
  # Changelog
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
+ ## [2.5.0] - 2025-08-12 (Converse API)
5
+ ### Added
6
+ - Support for Converse API (streaming and non-streaming)
7
+
8
+ ### Technical Details
9
+ - **Model Configuration**: All models use standard messages API format
10
+ - **API Compatibility**: Supports OpenAI-style requests
11
+ - **Response Processing**: Automatic reasoning tag handling based on model variant
12
+ - **Streaming Fallback**: Automatic detection and fallback to non-streaming for unsupported models
13
+ - **Testing Coverage**: Full integration with existing test suites and interactive example
14
+
15
+ ## [2.4.5] - 2025-08-06 (GPT-OSS Models)
16
+ ### Added
17
+ - Support for OpenAI GPT-OSS models on AWS Bedrock
18
+ - GPT-OSS-120B (120B parameter open weight model)
19
+ - GPT-OSS-20B (20B parameter open weight model)
20
+ - GPT-OSS-120B-Thinking (with reasoning tag preservation)
21
+ - GPT-OSS-20B-Thinking (with reasoning tag preservation)
22
+ - `<reasoning>` tag processing for GPT-OSS thinking variants
23
+ - Regular GPT-OSS models automatically strip `<reasoning>` tags
24
+ - Thinking variants preserve `<reasoning>` tags (similar to Claude's `<think>` tags)
25
+ - Non-streaming support for GPT-OSS models (streaming not supported by AWS Bedrock)
26
+ - OpenAI-compatible API format with `max_completion_tokens` parameter
27
+
28
+ ### Technical Details
29
+ - **Model Configuration**: All GPT-OSS models use standard messages API format
30
+ - **API Compatibility**: Supports OpenAI-style requests with Apache 2.0 licensed models
31
+ - **Response Processing**: Automatic reasoning tag handling based on model variant
32
+ - **Streaming Fallback**: Automatic detection and fallback to non-streaming for unsupported models
33
+ - **Testing Coverage**: Full integration with existing test suites and interactive example
34
+
4
35
  ## [2.4.4] - 2025-08-05 (Claude 4.1 Opus)
5
36
  ### Added
6
37
  - Support for Claude 4.1 Opus models
package/README.md CHANGED
@@ -48,7 +48,7 @@ Bedrock Wrapper is an npm package that simplifies the integration of existing Op
48
48
  };
49
49
  ```
50
50
 
51
- the `messages` variable should be in openai's role/content format
51
+ the `messages` variable should be in openai's role/content format (not all models support system prompts)
52
52
  ```javascript
53
53
  messages = [
54
54
  {
@@ -98,6 +98,24 @@ Bedrock Wrapper is an npm package that simplifies the integration of existing Op
98
98
  console.log(`\n\completeResponse:\n${completeResponse}\n`); // ⇠ do stuff with the complete response
99
99
  }
100
100
 
101
+ 5. **NEW: Using the Converse API (optional)**
102
+
103
+ You can now optionally use AWS Bedrock's Converse API instead of the Invoke API by passing `useConverseAPI: true` in the options parameter:
104
+ ```javascript
105
+ // Use the Converse API for unified request/response format across all models
106
+ for await (const chunk of bedrockWrapper(awsCreds, openaiChatCompletionsCreateObject, { useConverseAPI: true })) {
107
+ completeResponse += chunk;
108
+ process.stdout.write(chunk);
109
+ }
110
+ ```
111
+
112
+ The Converse API provides:
113
+ - **Consistent API**: Single request/response format across all models
114
+ - **Simplified conversation management**: Better handling of multi-turn conversations
115
+ - **System prompts**: Cleaner separation of system instructions
116
+ - **Tool use support**: Native support for function calling (where supported)
117
+ - **Unified multimodal**: Consistent handling of text and image inputs
118
+
101
119
  ---
102
120
 
103
121
  ### Supported Models
@@ -119,6 +137,10 @@ Bedrock Wrapper is an npm package that simplifies the integration of existing Op
119
137
  | Nova-Pro | us.amazon.nova-pro-v1:0 | ✅ |
120
138
  | Nova-Lite | us.amazon.nova-lite-v1:0 | ✅ |
121
139
  | Nova-Micro | us.amazon.nova-micro-v1:0 | ❌ |
140
+ | GPT-OSS-120B | openai.gpt-oss-120b-1:0 | ❌ |
141
+ | GPT-OSS-120B-Thinking | openai.gpt-oss-120b-1:0 | ❌ |
142
+ | GPT-OSS-20B | openai.gpt-oss-20b-1:0 | ❌ |
143
+ | GPT-OSS-20B-Thinking | openai.gpt-oss-20b-1:0 | ❌ |
122
144
  | Llama-3-3-70b | us.meta.llama3-3-70b-instruct-v1:0 | ❌ |
123
145
  | Llama-3-2-1b | us.meta.llama3-2-1b-instruct-v1:0 | ❌ |
124
146
  | Llama-3-2-3b | us.meta.llama3-2-3b-instruct-v1:0 | ❌ |
@@ -146,7 +168,7 @@ Please modify the `bedrock_models.js` file and submit a PR 🏆 or create an Iss
146
168
 
147
169
  ### Image Support
148
170
 
149
- For models with image support (Claude 4 series, Claude 3.7 Sonnet, Claude 3.5 Sonnet, Claude 3 Haiku, Nova Pro, and Nova Lite), you can include images in your messages using the following format:
171
+ For models with image support (Claude 4 series, Claude 3.7 Sonnet, Claude 3.5 Sonnet, Claude 3 Haiku, Nova Pro, and Nova Lite), you can include images in your messages using the following format (not all models support system prompts):
150
172
 
151
173
  ```javascript
152
174
  messages = [
@@ -210,6 +232,7 @@ const openaiChatCompletionsCreateObject = {
210
232
  **Model Support:**
211
233
  - ✅ **Claude models**: Fully supported (up to 8,191 sequences)
212
234
  - ✅ **Nova models**: Fully supported (up to 4 sequences)
235
+ - ✅ **GPT-OSS models**: Fully supported
213
236
  - ✅ **Mistral models**: Fully supported (up to 10 sequences)
214
237
  - ❌ **Llama models**: Not supported (AWS Bedrock limitation)
215
238
 
@@ -234,6 +257,44 @@ const result = await bedrockWrapper(awsCreds, {
234
257
 
235
258
  ---
236
259
 
260
+ ### 🧪 Testing
261
+
262
+ The package includes comprehensive test suites to verify functionality:
263
+
264
+ ```bash
265
+ # Test all models with the Both APIs (Comparison)
266
+ npm run test
267
+
268
+ # Test all models with the Invoke API
269
+ npm run test:invoke
270
+
271
+ # Test all models with the Converse API
272
+ npm run test:converse
273
+
274
+ # Test vision/multimodal capabilities with Both APIs (Comparison)
275
+ npm run test-vision
276
+
277
+ # Test vision/multimodal capabilities with Invoke API
278
+ npm run test-vision:invoke
279
+
280
+ # Test vision/multimodal capabilities with Converse API
281
+ npm run test-vision:converse
282
+
283
+ # Test stop sequences functionality with Both APIs (Comparison)
284
+ npm run test-stop
285
+
286
+ # Test stop sequences functionality with Invoke API
287
+ npm run test-stop:invoke
288
+
289
+ # Test stop sequences functionality with Converse API
290
+ npm run test-stop:converse
291
+
292
+ # Interactive testing
293
+ npm run interactive
294
+ ```
295
+
296
+ ---
297
+
237
298
  ### 📢 P.S.
238
299
 
239
300
  In case you missed it at the beginning of this doc, for an even easier setup, use the 🔀 [Bedrock Proxy Endpoint](https://github.com/jparkerweb/bedrock-proxy-endpoint) project to spin up your own custom OpenAI server endpoint (using the standard `baseUrl`, and `apiKey` params).
package/bedrock-models.js CHANGED
@@ -678,6 +678,84 @@ export const bedrock_models = [
678
678
  "inferenceConfig": {}
679
679
  }
680
680
  },
681
+ {
682
+ // ====================
683
+ // == GPT-OSS-120B ==
684
+ // ====================
685
+ "modelName": "GPT-OSS-120B",
686
+ "modelId": "openai.gpt-oss-120b-1:0",
687
+ // "modelId": "us.openai.gpt-oss-120b-1:0",
688
+ "vision": false,
689
+ "messages_api": true,
690
+ "system_as_separate_field": false,
691
+ "display_role_names": true,
692
+ "max_tokens_param_name": "max_completion_tokens",
693
+ "max_supported_response_tokens": 5000,
694
+ "stop_sequences_param_name": "stop_sequences",
695
+ "response_chunk_element": "choices[0].delta.content",
696
+ "response_nonchunk_element": "choices[0].message.content",
697
+ "streaming_supported": false,
698
+ "special_request_schema": {}
699
+ },
700
+ {
701
+ // ===================
702
+ // == GPT-OSS-20B ==
703
+ // ===================
704
+ "modelName": "GPT-OSS-20B",
705
+ "modelId": "openai.gpt-oss-20b-1:0",
706
+ // "modelId": "us.openai.gpt-oss-20b-1:0",
707
+ "vision": false,
708
+ "messages_api": true,
709
+ "system_as_separate_field": false,
710
+ "display_role_names": true,
711
+ "max_tokens_param_name": "max_completion_tokens",
712
+ "max_supported_response_tokens": 5000,
713
+ "stop_sequences_param_name": "stop_sequences",
714
+ "response_chunk_element": "choices[0].delta.content",
715
+ "response_nonchunk_element": "choices[0].message.content",
716
+ "streaming_supported": false,
717
+ "special_request_schema": {}
718
+ },
719
+ {
720
+ // ==============================
721
+ // == GPT-OSS-120B-Thinking ==
722
+ // ==============================
723
+ "modelName": "GPT-OSS-120B-Thinking",
724
+ "modelId": "openai.gpt-oss-120b-1:0",
725
+ // "modelId": "us.openai.gpt-oss-120b-1:0",
726
+ "vision": false,
727
+ "messages_api": true,
728
+ "system_as_separate_field": false,
729
+ "display_role_names": true,
730
+ "max_tokens_param_name": "max_completion_tokens",
731
+ "max_supported_response_tokens": 5000,
732
+ "stop_sequences_param_name": "stop_sequences",
733
+ "response_chunk_element": "choices[0].delta.content",
734
+ "response_nonchunk_element": "choices[0].message.content",
735
+ "streaming_supported": false,
736
+ "preserve_reasoning": true,
737
+ "special_request_schema": {}
738
+ },
739
+ {
740
+ // =============================
741
+ // == GPT-OSS-20B-Thinking ==
742
+ // =============================
743
+ "modelName": "GPT-OSS-20B-Thinking",
744
+ "modelId": "openai.gpt-oss-20b-1:0",
745
+ // "modelId": "us.openai.gpt-oss-20b-1:0",
746
+ "vision": false,
747
+ "messages_api": true,
748
+ "system_as_separate_field": false,
749
+ "display_role_names": true,
750
+ "max_tokens_param_name": "max_completion_tokens",
751
+ "max_supported_response_tokens": 5000,
752
+ "stop_sequences_param_name": "stop_sequences",
753
+ "response_chunk_element": "choices[0].delta.content",
754
+ "response_nonchunk_element": "choices[0].message.content",
755
+ "streaming_supported": false,
756
+ "preserve_reasoning": true,
757
+ "special_request_schema": {}
758
+ },
681
759
  {
682
760
  // ================
683
761
  // == Mistral-7b ==