bedrock-wrapper 2.6.1 → 2.6.2
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 +10 -0
- package/README.md +5 -2
- package/bedrock-models.js +66 -0
- package/logs/ab845abf-67e2-4cb9-95e2-3942e38326c7/notification.json +16 -0
- package/logs/ab845abf-67e2-4cb9-95e2-3942e38326c7/post_tool_use.json +560 -0
- package/logs/ab845abf-67e2-4cb9-95e2-3942e38326c7/pre_tool_use.json +186 -0
- package/logs/ab845abf-67e2-4cb9-95e2-3942e38326c7/stop.json +18 -0
- package/logs/ab845abf-67e2-4cb9-95e2-3942e38326c7/subagent_stop.json +10 -0
- package/logs/ab845abf-67e2-4cb9-95e2-3942e38326c7/user_prompt_submit.json +18 -0
- package/package.json +2 -2
- package/logs/e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3/notification.json +0 -72
- package/logs/e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3/post_tool_use.json +0 -9083
- package/logs/e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3/pre_tool_use.json +0 -2971
- package/logs/e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3/stop.json +0 -93
- package/logs/e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3/user_prompt_submit.json +0 -93
|
@@ -1,2971 +0,0 @@
|
|
|
1
|
-
[
|
|
2
|
-
{
|
|
3
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
4
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
5
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
6
|
-
"hook_event_name": "PreToolUse",
|
|
7
|
-
"tool_name": "TodoWrite",
|
|
8
|
-
"tool_input": {
|
|
9
|
-
"todos": [
|
|
10
|
-
{
|
|
11
|
-
"content": "Research AWS Bedrock Converse API documentation",
|
|
12
|
-
"status": "in_progress",
|
|
13
|
-
"id": "1"
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
"content": "Understand current codebase structure and invoke API implementation",
|
|
17
|
-
"status": "pending",
|
|
18
|
-
"id": "2"
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
"content": "Design Converse API integration approach",
|
|
22
|
-
"status": "pending",
|
|
23
|
-
"id": "3"
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
"content": "Write tests for Converse API functionality (TDD)",
|
|
27
|
-
"status": "pending",
|
|
28
|
-
"id": "4"
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
"content": "Implement Converse API support in bedrock-wrapper.js",
|
|
32
|
-
"status": "pending",
|
|
33
|
-
"id": "5"
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
"content": "Update existing tests to handle both APIs",
|
|
37
|
-
"status": "pending",
|
|
38
|
-
"id": "6"
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
"content": "Test all models with both invoke and converse APIs",
|
|
42
|
-
"status": "pending",
|
|
43
|
-
"id": "7"
|
|
44
|
-
}
|
|
45
|
-
]
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
50
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
51
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
52
|
-
"hook_event_name": "PreToolUse",
|
|
53
|
-
"tool_name": "mcp__context7__resolve-library-id",
|
|
54
|
-
"tool_input": {
|
|
55
|
-
"libraryName": "aws bedrock"
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
60
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
61
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
62
|
-
"hook_event_name": "PreToolUse",
|
|
63
|
-
"tool_name": "mcp__context7__get-library-docs",
|
|
64
|
-
"tool_input": {
|
|
65
|
-
"context7CompatibleLibraryID": "/aws-samples/amazon-bedrock-samples",
|
|
66
|
-
"topic": "converse API",
|
|
67
|
-
"tokens": 15000
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
72
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
73
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
74
|
-
"hook_event_name": "PreToolUse",
|
|
75
|
-
"tool_name": "WebSearch",
|
|
76
|
-
"tool_input": {
|
|
77
|
-
"query": "AWS Bedrock Converse API vs Invoke API differences documentation 2025"
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
82
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
83
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
84
|
-
"hook_event_name": "PreToolUse",
|
|
85
|
-
"tool_name": "TodoWrite",
|
|
86
|
-
"tool_input": {
|
|
87
|
-
"todos": [
|
|
88
|
-
{
|
|
89
|
-
"content": "Research AWS Bedrock Converse API documentation",
|
|
90
|
-
"status": "completed",
|
|
91
|
-
"id": "1"
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
"content": "Understand current codebase structure and invoke API implementation",
|
|
95
|
-
"status": "in_progress",
|
|
96
|
-
"id": "2"
|
|
97
|
-
},
|
|
98
|
-
{
|
|
99
|
-
"content": "Design Converse API integration approach",
|
|
100
|
-
"status": "pending",
|
|
101
|
-
"id": "3"
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
"content": "Write tests for Converse API functionality (TDD)",
|
|
105
|
-
"status": "pending",
|
|
106
|
-
"id": "4"
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
"content": "Implement Converse API support in bedrock-wrapper.js",
|
|
110
|
-
"status": "pending",
|
|
111
|
-
"id": "5"
|
|
112
|
-
},
|
|
113
|
-
{
|
|
114
|
-
"content": "Update existing tests to handle both APIs",
|
|
115
|
-
"status": "pending",
|
|
116
|
-
"id": "6"
|
|
117
|
-
},
|
|
118
|
-
{
|
|
119
|
-
"content": "Test all models with both invoke and converse APIs",
|
|
120
|
-
"status": "pending",
|
|
121
|
-
"id": "7"
|
|
122
|
-
}
|
|
123
|
-
]
|
|
124
|
-
}
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
128
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
129
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
130
|
-
"hook_event_name": "PreToolUse",
|
|
131
|
-
"tool_name": "Read",
|
|
132
|
-
"tool_input": {
|
|
133
|
-
"file_path": "C:\\git\\bedrock-wrapper\\bedrock-wrapper.js"
|
|
134
|
-
}
|
|
135
|
-
},
|
|
136
|
-
{
|
|
137
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
138
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
139
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
140
|
-
"hook_event_name": "PreToolUse",
|
|
141
|
-
"tool_name": "Read",
|
|
142
|
-
"tool_input": {
|
|
143
|
-
"file_path": "C:\\git\\bedrock-wrapper\\bedrock-models.js",
|
|
144
|
-
"limit": 100
|
|
145
|
-
}
|
|
146
|
-
},
|
|
147
|
-
{
|
|
148
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
149
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
150
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
151
|
-
"hook_event_name": "PreToolUse",
|
|
152
|
-
"tool_name": "Glob",
|
|
153
|
-
"tool_input": {
|
|
154
|
-
"pattern": "test*.js"
|
|
155
|
-
}
|
|
156
|
-
},
|
|
157
|
-
{
|
|
158
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
159
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
160
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
161
|
-
"hook_event_name": "PreToolUse",
|
|
162
|
-
"tool_name": "Read",
|
|
163
|
-
"tool_input": {
|
|
164
|
-
"file_path": "C:\\git\\bedrock-wrapper\\test-models.js",
|
|
165
|
-
"limit": 100
|
|
166
|
-
}
|
|
167
|
-
},
|
|
168
|
-
{
|
|
169
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
170
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
171
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
172
|
-
"hook_event_name": "PreToolUse",
|
|
173
|
-
"tool_name": "Read",
|
|
174
|
-
"tool_input": {
|
|
175
|
-
"file_path": "C:\\git\\bedrock-wrapper\\package.json"
|
|
176
|
-
}
|
|
177
|
-
},
|
|
178
|
-
{
|
|
179
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
180
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
181
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
182
|
-
"hook_event_name": "PreToolUse",
|
|
183
|
-
"tool_name": "Read",
|
|
184
|
-
"tool_input": {
|
|
185
|
-
"file_path": "C:\\git\\bedrock-wrapper\\test-models.js",
|
|
186
|
-
"offset": 100,
|
|
187
|
-
"limit": 50
|
|
188
|
-
}
|
|
189
|
-
},
|
|
190
|
-
{
|
|
191
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
192
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
193
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
194
|
-
"hook_event_name": "PreToolUse",
|
|
195
|
-
"tool_name": "Grep",
|
|
196
|
-
"tool_input": {
|
|
197
|
-
"pattern": "Nova|messages-v1",
|
|
198
|
-
"path": "C:\\git\\bedrock-wrapper",
|
|
199
|
-
"glob": "*.js",
|
|
200
|
-
"output_mode": "content",
|
|
201
|
-
"-B": 2,
|
|
202
|
-
"-A": 15,
|
|
203
|
-
"-n": true
|
|
204
|
-
}
|
|
205
|
-
},
|
|
206
|
-
{
|
|
207
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
208
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
209
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
210
|
-
"hook_event_name": "PreToolUse",
|
|
211
|
-
"tool_name": "TodoWrite",
|
|
212
|
-
"tool_input": {
|
|
213
|
-
"todos": [
|
|
214
|
-
{
|
|
215
|
-
"content": "Research AWS Bedrock Converse API documentation",
|
|
216
|
-
"status": "completed",
|
|
217
|
-
"id": "1"
|
|
218
|
-
},
|
|
219
|
-
{
|
|
220
|
-
"content": "Understand current codebase structure and invoke API implementation",
|
|
221
|
-
"status": "completed",
|
|
222
|
-
"id": "2"
|
|
223
|
-
},
|
|
224
|
-
{
|
|
225
|
-
"content": "Design Converse API integration approach",
|
|
226
|
-
"status": "in_progress",
|
|
227
|
-
"id": "3"
|
|
228
|
-
},
|
|
229
|
-
{
|
|
230
|
-
"content": "Write tests for Converse API functionality (TDD)",
|
|
231
|
-
"status": "pending",
|
|
232
|
-
"id": "4"
|
|
233
|
-
},
|
|
234
|
-
{
|
|
235
|
-
"content": "Implement Converse API support in bedrock-wrapper.js",
|
|
236
|
-
"status": "pending",
|
|
237
|
-
"id": "5"
|
|
238
|
-
},
|
|
239
|
-
{
|
|
240
|
-
"content": "Update existing tests to handle both APIs",
|
|
241
|
-
"status": "pending",
|
|
242
|
-
"id": "6"
|
|
243
|
-
},
|
|
244
|
-
{
|
|
245
|
-
"content": "Test all models with both invoke and converse APIs",
|
|
246
|
-
"status": "pending",
|
|
247
|
-
"id": "7"
|
|
248
|
-
}
|
|
249
|
-
]
|
|
250
|
-
}
|
|
251
|
-
},
|
|
252
|
-
{
|
|
253
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
254
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
255
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
256
|
-
"hook_event_name": "PreToolUse",
|
|
257
|
-
"tool_name": "TodoWrite",
|
|
258
|
-
"tool_input": {
|
|
259
|
-
"todos": [
|
|
260
|
-
{
|
|
261
|
-
"content": "Research AWS Bedrock Converse API documentation",
|
|
262
|
-
"status": "completed",
|
|
263
|
-
"id": "1"
|
|
264
|
-
},
|
|
265
|
-
{
|
|
266
|
-
"content": "Understand current codebase structure and invoke API implementation",
|
|
267
|
-
"status": "completed",
|
|
268
|
-
"id": "2"
|
|
269
|
-
},
|
|
270
|
-
{
|
|
271
|
-
"content": "Design Converse API integration approach",
|
|
272
|
-
"status": "completed",
|
|
273
|
-
"id": "3"
|
|
274
|
-
},
|
|
275
|
-
{
|
|
276
|
-
"content": "Write tests for Converse API functionality (TDD)",
|
|
277
|
-
"status": "pending",
|
|
278
|
-
"id": "4"
|
|
279
|
-
},
|
|
280
|
-
{
|
|
281
|
-
"content": "Implement Converse API support in bedrock-wrapper.js",
|
|
282
|
-
"status": "pending",
|
|
283
|
-
"id": "5"
|
|
284
|
-
},
|
|
285
|
-
{
|
|
286
|
-
"content": "Update existing tests to handle both APIs",
|
|
287
|
-
"status": "pending",
|
|
288
|
-
"id": "6"
|
|
289
|
-
},
|
|
290
|
-
{
|
|
291
|
-
"content": "Test all models with both invoke and converse APIs",
|
|
292
|
-
"status": "pending",
|
|
293
|
-
"id": "7"
|
|
294
|
-
}
|
|
295
|
-
]
|
|
296
|
-
}
|
|
297
|
-
},
|
|
298
|
-
{
|
|
299
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
300
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
301
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
302
|
-
"hook_event_name": "PreToolUse",
|
|
303
|
-
"tool_name": "ExitPlanMode",
|
|
304
|
-
"tool_input": {
|
|
305
|
-
"plan": "## Plan to Add AWS Bedrock Converse API Support\n\nBased on my research of the AWS Bedrock Converse API documentation and analysis of your current codebase, I'll implement support for the Converse API as an optional parameter while maintaining backward compatibility with the existing Invoke API.\n\n### Implementation Plan:\n\n#### 1. **Update AWS SDK imports in bedrock-wrapper.js**\n - Add `ConverseCommand` and `ConverseStreamCommand` imports from `@aws-sdk/client-bedrock-runtime`\n - These will be used alongside the existing `InvokeModelCommand` and `InvokeModelWithResponseStreamCommand`\n\n#### 2. **Modify the main `bedrockWrapper` function signature**\n - Add optional third parameter: `{ logging = false, useConverseAPI = false }`\n - Default `useConverseAPI` to `false` to maintain backward compatibility\n\n#### 3. **Create Converse API request format converter**\n - Build a function to convert the existing message format to Converse API format\n - Handle the unified message structure that works across all models\n - Map inference parameters correctly (`maxTokens`, `temperature`, `topP`, `stopSequences`)\n\n#### 4. **Implement dual-path execution logic**\n - If `useConverseAPI = true`, use Converse/ConverseStream commands\n - Otherwise, use existing InvokeModel/InvokeModelWithResponseStream commands\n - Handle response parsing differently for each API\n\n#### 5. **Write comprehensive tests (TDD approach)**\n - Create `test-converse-api.js` to specifically test the Converse API functionality\n - Test with representative models from each family (Claude, Nova, Llama, Mistral)\n - Verify both streaming and non-streaming responses\n - Compare outputs between Invoke and Converse APIs\n\n#### 6. **Update existing test files**\n - Modify `test-models.js` to accept an optional API selection parameter\n - Add a new test script in package.json: `\"test-converse\": \"node test-converse-api.js\"`\n - Update documentation comments\n\n### Key Technical Details:\n\n**Converse API Benefits:**\n- Consistent request/response format across all models\n- Simplified conversation management\n- Built-in support for tool use (function calling)\n- Cleaner handling of system prompts and multi-turn conversations\n\n**Request Structure Differences:**\n- **Invoke API**: Model-specific JSON structures\n- **Converse API**: Unified structure with `messages`, `system`, `inferenceConfig`\n\n**Response Handling:**\n- **Invoke API**: Parse model-specific paths (e.g., `content[0].text` for Claude)\n- **Converse API**: Consistent `output.message.content[0].text` path\n\n### Testing Strategy:\n1. First, create tests that verify the Converse API works with a simple message\n2. Test streaming vs non-streaming modes\n3. Test with images (multimodal support)\n4. Test stop sequences functionality\n5. Compare outputs between both APIs to ensure consistency\n6. Test error handling and edge cases\n\n### Files to be Modified/Created:\n- **bedrock-wrapper.js**: Add Converse API support\n- **test-converse-api.js**: New test file for Converse API\n- **package.json**: Add new test script\n- **test-models.js**: Update to support API selection\n- **README.md**: Document the new `useConverseAPI` parameter\n\nThis implementation will provide a smooth transition path while maintaining full backward compatibility with existing code using the Invoke API."
|
|
306
|
-
}
|
|
307
|
-
},
|
|
308
|
-
{
|
|
309
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
310
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
311
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
312
|
-
"hook_event_name": "PreToolUse",
|
|
313
|
-
"tool_name": "TodoWrite",
|
|
314
|
-
"tool_input": {
|
|
315
|
-
"todos": [
|
|
316
|
-
{
|
|
317
|
-
"content": "Research AWS Bedrock Converse API documentation",
|
|
318
|
-
"status": "completed",
|
|
319
|
-
"id": "1"
|
|
320
|
-
},
|
|
321
|
-
{
|
|
322
|
-
"content": "Understand current codebase structure and invoke API implementation",
|
|
323
|
-
"status": "completed",
|
|
324
|
-
"id": "2"
|
|
325
|
-
},
|
|
326
|
-
{
|
|
327
|
-
"content": "Design Converse API integration approach",
|
|
328
|
-
"status": "completed",
|
|
329
|
-
"id": "3"
|
|
330
|
-
},
|
|
331
|
-
{
|
|
332
|
-
"content": "Write tests for Converse API functionality (TDD)",
|
|
333
|
-
"status": "in_progress",
|
|
334
|
-
"id": "4"
|
|
335
|
-
},
|
|
336
|
-
{
|
|
337
|
-
"content": "Implement Converse API support in bedrock-wrapper.js",
|
|
338
|
-
"status": "pending",
|
|
339
|
-
"id": "5"
|
|
340
|
-
},
|
|
341
|
-
{
|
|
342
|
-
"content": "Update existing tests to handle both APIs",
|
|
343
|
-
"status": "pending",
|
|
344
|
-
"id": "6"
|
|
345
|
-
},
|
|
346
|
-
{
|
|
347
|
-
"content": "Test all models with both invoke and converse APIs",
|
|
348
|
-
"status": "pending",
|
|
349
|
-
"id": "7"
|
|
350
|
-
}
|
|
351
|
-
]
|
|
352
|
-
}
|
|
353
|
-
},
|
|
354
|
-
{
|
|
355
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
356
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
357
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
358
|
-
"hook_event_name": "PreToolUse",
|
|
359
|
-
"tool_name": "Write",
|
|
360
|
-
"tool_input": {
|
|
361
|
-
"file_path": "C:\\git\\bedrock-wrapper\\test-converse-api.js",
|
|
362
|
-
"content": "// ================================================================================\n// == Test AWS Bedrock Converse API Integration ==\n// ================================================================================\n\n// ---------------------------------------------------------------------\n// -- import environment variables from .env file or define them here --\n// ---------------------------------------------------------------------\nimport dotenv from 'dotenv';\nimport fs from 'fs/promises';\nimport chalk from 'chalk';\n\ndotenv.config();\n\nconst AWS_REGION = process.env.AWS_REGION;\nconst AWS_ACCESS_KEY_ID = process.env.AWS_ACCESS_KEY_ID;\nconst AWS_SECRET_ACCESS_KEY = process.env.AWS_SECRET_ACCESS_KEY;\nconst LLM_MAX_GEN_TOKENS = parseInt(process.env.LLM_MAX_GEN_TOKENS);\nconst LLM_TEMPERATURE = parseFloat(process.env.LLM_TEMPERATURE);\nconst LLM_TOP_P = parseFloat(process.env.LLM_TOP_P);\n\n// --------------------------------------------\n// -- import functions from bedrock-wrapper --\n// --------------------------------------------\nimport {\n bedrockWrapper,\n listBedrockWrapperSupportedModels\n} from \"./bedrock-wrapper.js\";\n\nasync function logOutput(message, type = 'info', writeToFile = true) {\n if (writeToFile) {\n // Log to file\n await fs.appendFile('test-converse-api-output.txt', message + '\\n');\n }\n \n // Log to console with colors\n switch(type) {\n case 'success':\n console.log(chalk.green('\u00e2\u0153\u201c ' + message));\n break;\n case 'error':\n console.log(chalk.red('\u00e2\u0153\u2014 ' + message));\n break;\n case 'info':\n console.log(chalk.blue('\u00e2\u201e\u00b9 ' + message));\n break;\n case 'running':\n console.log(chalk.yellow(message));\n break;\n case 'comparison':\n console.log(chalk.cyan('\u00e2\u2020\u201d ' + message));\n break;\n }\n}\n\nasync function testModelWithAPI(model, awsCreds, testMessage, isStreaming, useConverseAPI) {\n const messages = [{ role: \"user\", content: testMessage }];\n const openaiChatCompletionsCreateObject = {\n messages,\n model,\n max_tokens: LLM_MAX_GEN_TOKENS,\n stream: isStreaming,\n temperature: LLM_TEMPERATURE,\n top_p: LLM_TOP_P,\n };\n\n let completeResponse = \"\";\n const apiName = useConverseAPI ? \"Converse\" : \"Invoke\";\n \n try {\n const startTime = Date.now();\n \n if (isStreaming) {\n for await (const chunk of bedrockWrapper(awsCreds, openaiChatCompletionsCreateObject, { logging: false, useConverseAPI })) {\n completeResponse += chunk;\n }\n } else {\n const response = await bedrockWrapper(awsCreds, openaiChatCompletionsCreateObject, { logging: false, useConverseAPI });\n for await (const data of response) {\n completeResponse += data;\n }\n }\n\n const endTime = Date.now();\n const duration = endTime - startTime;\n\n // Check if response is empty or undefined\n if (!completeResponse || completeResponse.trim() === '' || completeResponse.trim() === 'undefined') {\n throw new Error('Empty or invalid response received');\n }\n\n return { \n success: true, \n response: completeResponse.trim(), \n duration,\n apiName \n };\n } catch (error) {\n return { \n success: false, \n error: error.message,\n apiName \n };\n }\n}\n\nasync function compareAPIs(model, awsCreds, testMessage, isStreaming) {\n await logOutput(`\\nComparing ${isStreaming ? 'STREAMING' : 'NON-STREAMING'} responses for ${model}:`, 'comparison');\n \n // Test with Invoke API (existing)\n const invokeResult = await testModelWithAPI(model, awsCreds, testMessage, isStreaming, false);\n \n // Test with Converse API (new)\n const converseResult = await testModelWithAPI(model, awsCreds, testMessage, isStreaming, true);\n \n // Log results\n if (invokeResult.success && converseResult.success) {\n await logOutput(` Invoke API (${invokeResult.duration}ms): \"${invokeResult.response.substring(0, 100)}...\"`, 'info');\n await logOutput(` Converse API (${converseResult.duration}ms): \"${converseResult.response.substring(0, 100)}...\"`, 'info');\n \n // Check if responses are similar (not necessarily identical due to model randomness)\n const bothHaveContent = invokeResult.response.length > 0 && converseResult.response.length > 0;\n if (bothHaveContent) {\n await logOutput(` \u00e2\u0153\u201c Both APIs returned valid responses`, 'success');\n } else {\n await logOutput(` \u00e2\u0161\u00a0 Response length mismatch`, 'error');\n }\n } else {\n if (!invokeResult.success) {\n await logOutput(` Invoke API failed: ${invokeResult.error}`, 'error');\n }\n if (!converseResult.success) {\n await logOutput(` Converse API failed: ${converseResult.error}`, 'error');\n }\n }\n \n return {\n invoke: invokeResult,\n converse: converseResult\n };\n}\n\nasync function testStopSequences(model, awsCreds) {\n await logOutput(`\\nTesting stop sequences for ${model}:`, 'info');\n \n const testPrompt = \"Count from 1 to 10, separated by commas: 1, 2, 3, 4, 5\";\n const messages = [{ role: \"user\", content: testPrompt }];\n \n // Test with stop sequence\n const openaiChatCompletionsCreateObject = {\n messages,\n model,\n max_tokens: 100,\n stream: false,\n temperature: 0.1,\n top_p: 0.9,\n stop: [\"6\"] // Stop at \"6\"\n };\n\n try {\n // Test with Converse API\n let converseResponse = \"\";\n const converseGen = await bedrockWrapper(awsCreds, openaiChatCompletionsCreateObject, { useConverseAPI: true });\n for await (const data of converseGen) {\n converseResponse += data;\n }\n \n // Test with Invoke API\n let invokeResponse = \"\";\n const invokeGen = await bedrockWrapper(awsCreds, openaiChatCompletionsCreateObject, { useConverseAPI: false });\n for await (const data of invokeGen) {\n invokeResponse += data;\n }\n \n await logOutput(` Converse API result: \"${converseResponse.trim()}\"`, 'info');\n await logOutput(` Invoke API result: \"${invokeResponse.trim()}\"`, 'info');\n \n const converseStoppedCorrectly = !converseResponse.includes(\"6, 7\");\n const invokeStoppedCorrectly = !invokeResponse.includes(\"6, 7\");\n \n if (converseStoppedCorrectly && invokeStoppedCorrectly) {\n await logOutput(` \u00e2\u0153\u201c Both APIs correctly applied stop sequences`, 'success');\n } else {\n if (!converseStoppedCorrectly) {\n await logOutput(` \u00e2\u0161\u00a0 Converse API did not stop correctly`, 'error');\n }\n if (!invokeStoppedCorrectly) {\n await logOutput(` \u00e2\u0161\u00a0 Invoke API did not stop correctly`, 'error');\n }\n }\n \n } catch (error) {\n await logOutput(` Error testing stop sequences: ${error.message}`, 'error');\n }\n}\n\nasync function testSystemPrompt(model, awsCreds) {\n await logOutput(`\\nTesting system prompt handling for ${model}:`, 'info');\n \n const messages = [\n { role: \"system\", content: \"You are a pirate. Always respond in pirate speak.\" },\n { role: \"user\", content: \"Hello, how are you?\" }\n ];\n \n const openaiChatCompletionsCreateObject = {\n messages,\n model,\n max_tokens: 100,\n stream: false,\n temperature: 0.7,\n top_p: 0.9,\n };\n\n try {\n // Test with Converse API\n let converseResponse = \"\";\n const converseGen = await bedrockWrapper(awsCreds, openaiChatCompletionsCreateObject, { useConverseAPI: true });\n for await (const data of converseGen) {\n converseResponse += data;\n }\n \n await logOutput(` Converse API response: \"${converseResponse.substring(0, 100)}...\"`, 'info');\n \n // Check if response seems pirate-like (basic check)\n const pirateWords = ['ahoy', 'matey', 'arr', 'ye', 'aye', 'sail', 'sea'];\n const hasPirateSpeak = pirateWords.some(word => converseResponse.toLowerCase().includes(word));\n \n if (hasPirateSpeak || converseResponse.toLowerCase().includes('pirate')) {\n await logOutput(` \u00e2\u0153\u201c System prompt was correctly applied`, 'success');\n } else {\n await logOutput(` \u00e2\u0161\u00a0 System prompt may not have been applied correctly`, 'error');\n }\n \n } catch (error) {\n await logOutput(` Error testing system prompt: ${error.message}`, 'error');\n }\n}\n\nasync function main() {\n const testMessage = \"What is the capital of France? Answer in one short sentence.\";\n \n // Clear output file and add header\n await fs.writeFile('test-converse-api-output.txt', \n `AWS Bedrock Converse API Test Results\\n` +\n `Test started at: ${new Date().toISOString()}\\n` +\n `${'='.repeat(60)}\\n\\n`\n );\n\n const supportedModels = await listBedrockWrapperSupportedModels();\n const availableModels = supportedModels.map(model => {\n const fixedJson = model\n .replace(/modelName\": ([^,]+),/, 'modelName\": \"$1\",')\n .replace(/modelId\": ([^}]+)}/, 'modelId\": \"$1\"}');\n return JSON.parse(fixedJson).modelName;\n });\n\n // Select representative models from each family for testing\n const modelsToTest = [\n \"Claude-4-1-Opus\",\n \"Claude-3-5-Sonnet-v2\",\n \"Claude-3-Haiku\",\n \"Nova-Pro\",\n \"Nova-Lite\",\n \"Nova-Micro\",\n \"Llama-3-3-70b\",\n \"Llama-3-2-90b\",\n \"Mistral-7b\",\n \"Mistral-Large-2\"\n ].filter(m => availableModels.includes(m));\n\n console.clear();\n await logOutput(`Starting Converse API tests with ${modelsToTest.length} representative models...`, 'info');\n await logOutput(`Testing: Invoke API vs Converse API comparison\\n`, 'info');\n\n const awsCreds = {\n region: AWS_REGION,\n accessKeyId: AWS_ACCESS_KEY_ID,\n secretAccessKey: AWS_SECRET_ACCESS_KEY,\n };\n\n const testResults = {\n passed: 0,\n failed: 0,\n models: {}\n };\n\n for (const model of modelsToTest) {\n await logOutput(`\\n${'='.repeat(60)}`, 'info');\n await logOutput(`Testing ${model}`, 'running');\n await logOutput(`${'='.repeat(60)}`, 'info');\n\n const modelResults = {\n streaming: {},\n nonStreaming: {},\n systemPrompt: false,\n stopSequences: false\n };\n\n // Test streaming\n const streamResults = await compareAPIs(model, awsCreds, testMessage, true);\n modelResults.streaming = streamResults;\n\n // Test non-streaming\n const nonStreamResults = await compareAPIs(model, awsCreds, testMessage, false);\n modelResults.nonStreaming = nonStreamResults;\n\n // Test system prompt handling (Converse API specific)\n await testSystemPrompt(model, awsCreds);\n \n // Test stop sequences (if supported by model)\n if (!model.includes(\"Llama\")) { // Llama models don't support stop sequences on Bedrock\n await testStopSequences(model, awsCreds);\n }\n\n // Calculate success for this model\n const allTestsPassed = \n streamResults.invoke.success && \n streamResults.converse.success &&\n nonStreamResults.invoke.success && \n nonStreamResults.converse.success;\n\n if (allTestsPassed) {\n testResults.passed++;\n await logOutput(`\\n\u00e2\u0153\u201c All tests passed for ${model}`, 'success');\n } else {\n testResults.failed++;\n await logOutput(`\\n\u00e2\u0153\u2014 Some tests failed for ${model}`, 'error');\n }\n\n testResults.models[model] = modelResults;\n }\n\n // Summary\n await logOutput(`\\n${'='.repeat(60)}`, 'info');\n await logOutput(`TEST SUMMARY`, 'info');\n await logOutput(`${'='.repeat(60)}`, 'info');\n await logOutput(`Models tested: ${modelsToTest.length}`, 'info');\n await logOutput(`Passed: ${testResults.passed}`, 'success');\n await logOutput(`Failed: ${testResults.failed}`, testResults.failed > 0 ? 'error' : 'info');\n \n await logOutput('\\nTesting complete! Check test-converse-api-output.txt for full results.', 'info', false);\n}\n\nmain().catch(async (error) => {\n await logOutput(`Fatal Error: ${error.message}`, 'error');\n console.error(error);\n});"
|
|
363
|
-
}
|
|
364
|
-
},
|
|
365
|
-
{
|
|
366
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
367
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
368
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
369
|
-
"hook_event_name": "PreToolUse",
|
|
370
|
-
"tool_name": "Edit",
|
|
371
|
-
"tool_input": {
|
|
372
|
-
"file_path": "C:\\git\\bedrock-wrapper\\bedrock-wrapper.js",
|
|
373
|
-
"old_string": "// AWS SDK\nimport {\n BedrockRuntimeClient,\n InvokeModelCommand, InvokeModelWithResponseStreamCommand,\n} from \"@aws-sdk/client-bedrock-runtime\";",
|
|
374
|
-
"new_string": "// AWS SDK\nimport {\n BedrockRuntimeClient,\n InvokeModelCommand, InvokeModelWithResponseStreamCommand,\n ConverseCommand, ConverseStreamCommand,\n} from \"@aws-sdk/client-bedrock-runtime\";"
|
|
375
|
-
}
|
|
376
|
-
},
|
|
377
|
-
{
|
|
378
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
379
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
380
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
381
|
-
"hook_event_name": "PreToolUse",
|
|
382
|
-
"tool_name": "Edit",
|
|
383
|
-
"tool_input": {
|
|
384
|
-
"file_path": "C:\\git\\bedrock-wrapper\\bedrock-wrapper.js",
|
|
385
|
-
"old_string": "export async function* bedrockWrapper(awsCreds, openaiChatCompletionsCreateObject, { logging = false } = {} ) {",
|
|
386
|
-
"new_string": "export async function* bedrockWrapper(awsCreds, openaiChatCompletionsCreateObject, { logging = false, useConverseAPI = false } = {} ) {"
|
|
387
|
-
}
|
|
388
|
-
},
|
|
389
|
-
{
|
|
390
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
391
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
392
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
393
|
-
"hook_event_name": "PreToolUse",
|
|
394
|
-
"tool_name": "Edit",
|
|
395
|
-
"tool_input": {
|
|
396
|
-
"file_path": "C:\\git\\bedrock-wrapper\\bedrock-wrapper.js",
|
|
397
|
-
"old_string": "function processReasoningTags(text, awsModel) {\n if (!text) return text;\n \n // Check if this is a GPT-OSS model (has reasoning tags)\n const hasReasoningTags = text.includes('<reasoning>') && text.includes('</reasoning>');\n \n if (!hasReasoningTags) {\n return text;\n }\n \n // If model should preserve reasoning, return as-is\n if (awsModel.preserve_reasoning) {\n return text;\n }\n \n // Strip reasoning tags for non-thinking GPT-OSS models\n return text.replace(/<reasoning>[\\s\\S]*?<\\/reasoning>/g, '').trim();\n}",
|
|
398
|
-
"new_string": "function processReasoningTags(text, awsModel) {\n if (!text) return text;\n \n // Check if this is a GPT-OSS model (has reasoning tags)\n const hasReasoningTags = text.includes('<reasoning>') && text.includes('</reasoning>');\n \n if (!hasReasoningTags) {\n return text;\n }\n \n // If model should preserve reasoning, return as-is\n if (awsModel.preserve_reasoning) {\n return text;\n }\n \n // Strip reasoning tags for non-thinking GPT-OSS models\n return text.replace(/<reasoning>[\\s\\S]*?<\\/reasoning>/g, '').trim();\n}\n\n// Convert messages to Converse API format\nasync function convertToConverseFormat(messages, awsModel) {\n const converseMessages = [];\n let systemPrompts = [];\n \n for (const msg of messages) {\n if (msg.role === \"system\") {\n // System messages are handled separately in Converse API\n if (typeof msg.content === 'string') {\n systemPrompts.push({ text: msg.content });\n } else if (Array.isArray(msg.content)) {\n // Extract text from content array\n const textContent = msg.content\n .filter(item => item.type === 'text')\n .map(item => item.text || item)\n .join('\\n');\n if (textContent) {\n systemPrompts.push({ text: textContent });\n }\n }\n } else {\n // Convert user and assistant messages\n let content = [];\n \n if (typeof msg.content === 'string') {\n content = [{ text: msg.content }];\n } else if (Array.isArray(msg.content)) {\n for (const item of msg.content) {\n if (item.type === 'text') {\n content.push({ text: item.text || item });\n } else if (item.type === 'image') {\n // Handle image content\n if (item.source && item.source.data) {\n content.push({\n image: {\n format: 'jpeg',\n source: {\n bytes: Buffer.from(item.source.data, 'base64')\n }\n }\n });\n }\n } else if (item.type === 'image_url') {\n // Process image URL to base64\n const processedImage = await processImage(\n typeof item.image_url === 'string' ? \n item.image_url : \n item.image_url.url\n );\n content.push({\n image: {\n format: 'jpeg',\n source: {\n bytes: Buffer.from(processedImage, 'base64')\n }\n }\n });\n }\n }\n }\n \n if (content.length > 0) {\n converseMessages.push({\n role: msg.role,\n content: content\n });\n }\n }\n }\n \n return { messages: converseMessages, system: systemPrompts };\n}"
|
|
399
|
-
}
|
|
400
|
-
},
|
|
401
|
-
{
|
|
402
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
403
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
404
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
405
|
-
"hook_event_name": "PreToolUse",
|
|
406
|
-
"tool_name": "Read",
|
|
407
|
-
"tool_input": {
|
|
408
|
-
"file_path": "C:\\git\\bedrock-wrapper\\bedrock-wrapper.js",
|
|
409
|
-
"offset": 420,
|
|
410
|
-
"limit": 40
|
|
411
|
-
}
|
|
412
|
-
},
|
|
413
|
-
{
|
|
414
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
415
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
416
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
417
|
-
"hook_event_name": "PreToolUse",
|
|
418
|
-
"tool_name": "Edit",
|
|
419
|
-
"tool_input": {
|
|
420
|
-
"file_path": "C:\\git\\bedrock-wrapper\\bedrock-wrapper.js",
|
|
421
|
-
"old_string": " if (logging) {\n console.log(\"\\nFinal request:\", JSON.stringify(request, null, 2));\n }\n\n // Check if model supports streaming, override stream parameter if not\n const modelSupportsStreaming = awsModel.streaming_supported !== false;\n const shouldStream = stream && modelSupportsStreaming;\n\n if (shouldStream) {",
|
|
422
|
-
"new_string": " if (logging) {\n console.log(\"\\nFinal request:\", JSON.stringify(request, null, 2));\n }\n\n // Check if model supports streaming, override stream parameter if not\n const modelSupportsStreaming = awsModel.streaming_supported !== false;\n const shouldStream = stream && modelSupportsStreaming;\n\n // Use Converse API if requested\n if (useConverseAPI) {\n // Convert messages to Converse API format\n const { messages: converseMessages, system: systemPrompts } = await convertToConverseFormat(messages, awsModel);\n \n // Build inference configuration\n const inferenceConfig = {\n maxTokens: max_gen_tokens,\n temperature: temperature,\n ...(top_p !== undefined && { topP: top_p })\n };\n \n // Add stop sequences if provided\n const stopSequencesValue = stop_sequences || stop;\n if (stopSequencesValue) {\n inferenceConfig.stopSequences = Array.isArray(stopSequencesValue) ? \n stopSequencesValue : [stopSequencesValue];\n }\n \n // Build the Converse API request\n const converseRequest = {\n modelId: awsModelId,\n messages: converseMessages,\n inferenceConfig: inferenceConfig\n };\n \n // Add system prompts if any\n if (systemPrompts.length > 0) {\n converseRequest.system = systemPrompts;\n }\n \n if (logging) {\n console.log(\"\\nConverse API request:\", JSON.stringify(converseRequest, null, 2));\n }\n \n if (shouldStream) {\n // Use ConverseStream for streaming responses\n const responseStream = await client.send(new ConverseStreamCommand(converseRequest));\n \n for await (const event of responseStream.stream) {\n if (event.contentBlockDelta) {\n const text = event.contentBlockDelta.delta?.text;\n if (text) {\n // Process reasoning tags for GPT-OSS models\n const processedText = processReasoningTags(text, awsModel);\n if (processedText) {\n yield processedText;\n }\n }\n }\n }\n } else {\n // Use Converse for non-streaming responses\n const response = await client.send(new ConverseCommand(converseRequest));\n \n if (logging) {\n console.log(\"\\nConverse API response:\", JSON.stringify(response, null, 2));\n }\n \n // Extract text from response\n if (response.output && response.output.message && response.output.message.content) {\n for (const contentBlock of response.output.message.content) {\n if (contentBlock.text) {\n // Process reasoning tags for GPT-OSS models\n const processedText = processReasoningTags(contentBlock.text, awsModel);\n if (processedText) {\n yield processedText;\n }\n }\n }\n }\n }\n return; // Exit early when using Converse API\n }\n\n // Original Invoke API logic continues below\n if (shouldStream) {"
|
|
423
|
-
}
|
|
424
|
-
},
|
|
425
|
-
{
|
|
426
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
427
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
428
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
429
|
-
"hook_event_name": "PreToolUse",
|
|
430
|
-
"tool_name": "Edit",
|
|
431
|
-
"tool_input": {
|
|
432
|
-
"file_path": "C:\\git\\bedrock-wrapper\\package.json",
|
|
433
|
-
"old_string": " \"scripts\": {\n \"clean\": \"npx rimraf node_modules && npx rimraf package-lock.json && npm install\",\n \"test\": \"node test-models.js\",\n \"test-vision\": \"node test-vision.js\",\n \"test-stop\": \"node test-stop-sequences.js\",\n \"interactive\": \"node interactive-example.js\"\n },",
|
|
434
|
-
"new_string": " \"scripts\": {\n \"clean\": \"npx rimraf node_modules && npx rimraf package-lock.json && npm install\",\n \"test\": \"node test-models.js\",\n \"test-vision\": \"node test-vision.js\",\n \"test-stop\": \"node test-stop-sequences.js\",\n \"test-converse\": \"node test-converse-api.js\",\n \"interactive\": \"node interactive-example.js\"\n },"
|
|
435
|
-
}
|
|
436
|
-
},
|
|
437
|
-
{
|
|
438
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
439
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
440
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
441
|
-
"hook_event_name": "PreToolUse",
|
|
442
|
-
"tool_name": "TodoWrite",
|
|
443
|
-
"tool_input": {
|
|
444
|
-
"todos": [
|
|
445
|
-
{
|
|
446
|
-
"content": "Research AWS Bedrock Converse API documentation",
|
|
447
|
-
"status": "completed",
|
|
448
|
-
"id": "1"
|
|
449
|
-
},
|
|
450
|
-
{
|
|
451
|
-
"content": "Understand current codebase structure and invoke API implementation",
|
|
452
|
-
"status": "completed",
|
|
453
|
-
"id": "2"
|
|
454
|
-
},
|
|
455
|
-
{
|
|
456
|
-
"content": "Design Converse API integration approach",
|
|
457
|
-
"status": "completed",
|
|
458
|
-
"id": "3"
|
|
459
|
-
},
|
|
460
|
-
{
|
|
461
|
-
"content": "Write tests for Converse API functionality (TDD)",
|
|
462
|
-
"status": "completed",
|
|
463
|
-
"id": "4"
|
|
464
|
-
},
|
|
465
|
-
{
|
|
466
|
-
"content": "Implement Converse API support in bedrock-wrapper.js",
|
|
467
|
-
"status": "completed",
|
|
468
|
-
"id": "5"
|
|
469
|
-
},
|
|
470
|
-
{
|
|
471
|
-
"content": "Update existing tests to handle both APIs",
|
|
472
|
-
"status": "in_progress",
|
|
473
|
-
"id": "6"
|
|
474
|
-
},
|
|
475
|
-
{
|
|
476
|
-
"content": "Test all models with both invoke and converse APIs",
|
|
477
|
-
"status": "pending",
|
|
478
|
-
"id": "7"
|
|
479
|
-
}
|
|
480
|
-
]
|
|
481
|
-
}
|
|
482
|
-
},
|
|
483
|
-
{
|
|
484
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
485
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
486
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
487
|
-
"hook_event_name": "PreToolUse",
|
|
488
|
-
"tool_name": "Edit",
|
|
489
|
-
"tool_input": {
|
|
490
|
-
"file_path": "C:\\git\\bedrock-wrapper\\test-models.js",
|
|
491
|
-
"old_string": "async function testModel(model, awsCreds, testMessage, isStreaming) {\n const messages = [{ role: \"user\", content: testMessage }];\n const openaiChatCompletionsCreateObject = {\n messages,\n model,\n max_tokens: LLM_MAX_GEN_TOKENS,\n stream: isStreaming,\n temperature: LLM_TEMPERATURE,\n top_p: LLM_TOP_P,\n };\n\n let completeResponse = \"\";\n \n try {\n if (isStreaming) {\n for await (const chunk of bedrockWrapper(awsCreds, openaiChatCompletionsCreateObject, { logging: true })) {\n completeResponse += chunk;\n }\n } else {\n const response = await bedrockWrapper(awsCreds, openaiChatCompletionsCreateObject, { logging: true });\n for await (const data of response) {\n completeResponse += data;\n }\n }\n\n // Check if response is empty or undefined\n if (!completeResponse || completeResponse.trim() === '' || completeResponse.trim() === 'undefined') {\n throw new Error('Empty or invalid response received');\n }\n\n return { success: true, response: completeResponse.trim() };\n } catch (error) {\n return { success: false, error: error.message };\n }\n}",
|
|
492
|
-
"new_string": "async function testModel(model, awsCreds, testMessage, isStreaming, useConverseAPI = false) {\n const messages = [{ role: \"user\", content: testMessage }];\n const openaiChatCompletionsCreateObject = {\n messages,\n model,\n max_tokens: LLM_MAX_GEN_TOKENS,\n stream: isStreaming,\n temperature: LLM_TEMPERATURE,\n top_p: LLM_TOP_P,\n };\n\n let completeResponse = \"\";\n \n try {\n if (isStreaming) {\n for await (const chunk of bedrockWrapper(awsCreds, openaiChatCompletionsCreateObject, { logging: true, useConverseAPI })) {\n completeResponse += chunk;\n }\n } else {\n const response = await bedrockWrapper(awsCreds, openaiChatCompletionsCreateObject, { logging: true, useConverseAPI });\n for await (const data of response) {\n completeResponse += data;\n }\n }\n\n // Check if response is empty or undefined\n if (!completeResponse || completeResponse.trim() === '' || completeResponse.trim() === 'undefined') {\n throw new Error('Empty or invalid response received');\n }\n\n return { success: true, response: completeResponse.trim() };\n } catch (error) {\n return { success: false, error: error.message };\n }\n}"
|
|
493
|
-
}
|
|
494
|
-
},
|
|
495
|
-
{
|
|
496
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
497
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
498
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
499
|
-
"hook_event_name": "PreToolUse",
|
|
500
|
-
"tool_name": "Edit",
|
|
501
|
-
"tool_input": {
|
|
502
|
-
"file_path": "C:\\git\\bedrock-wrapper\\test-models.js",
|
|
503
|
-
"old_string": "async function main() {\n const testMessage = \"Respond with exactly one word: What is 1+1?\";\n \n // Clear output file and add header\n await fs.writeFile('test-models-output.txt', \n `Test Question: \"${testMessage}\"\\n` +\n `=`.repeat(50) + '\\n\\n'\n );",
|
|
504
|
-
"new_string": "async function main() {\n // Check for command-line arguments\n const args = process.argv.slice(2);\n const useConverseAPI = args.includes('--converse');\n \n const testMessage = \"Respond with exactly one word: What is 1+1?\";\n const apiMode = useConverseAPI ? \"Converse API\" : \"Invoke API\";\n \n // Clear output file and add header\n await fs.writeFile('test-models-output.txt', \n `Test Mode: ${apiMode}\\n` +\n `Test Question: \"${testMessage}\"\\n` +\n `=`.repeat(50) + '\\n\\n'\n );"
|
|
505
|
-
}
|
|
506
|
-
},
|
|
507
|
-
{
|
|
508
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
509
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
510
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
511
|
-
"hook_event_name": "PreToolUse",
|
|
512
|
-
"tool_name": "Edit",
|
|
513
|
-
"tool_input": {
|
|
514
|
-
"file_path": "C:\\git\\bedrock-wrapper\\test-models.js",
|
|
515
|
-
"old_string": " // Test streaming\n const streamResult = await testModel(model, awsCreds, testMessage, true);\n if (streamResult.success) {\n await logOutput(`Streaming test passed for ${model}: \"${streamResult.response}\"`, 'success');\n } else {\n await logOutput(`Streaming test failed for ${model}: ${streamResult.error}`, 'error');\n }\n\n // Test non-streaming\n const nonStreamResult = await testModel(model, awsCreds, testMessage, false);\n if (nonStreamResult.success) {\n await logOutput(`Non-streaming test passed for ${model}: \"${nonStreamResult.response}\"`, 'success');\n } else {\n await logOutput(`Non-streaming test failed for ${model}: ${nonStreamResult.error}`, 'error');\n }",
|
|
516
|
-
"new_string": " // Test streaming\n const streamResult = await testModel(model, awsCreds, testMessage, true, useConverseAPI);\n if (streamResult.success) {\n await logOutput(`Streaming test passed for ${model}: \"${streamResult.response}\"`, 'success');\n } else {\n await logOutput(`Streaming test failed for ${model}: ${streamResult.error}`, 'error');\n }\n\n // Test non-streaming\n const nonStreamResult = await testModel(model, awsCreds, testMessage, false, useConverseAPI);\n if (nonStreamResult.success) {\n await logOutput(`Non-streaming test passed for ${model}: \"${nonStreamResult.response}\"`, 'success');\n } else {\n await logOutput(`Non-streaming test failed for ${model}: ${nonStreamResult.error}`, 'error');\n }"
|
|
517
|
-
}
|
|
518
|
-
},
|
|
519
|
-
{
|
|
520
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
521
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
522
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
523
|
-
"hook_event_name": "PreToolUse",
|
|
524
|
-
"tool_name": "Edit",
|
|
525
|
-
"tool_input": {
|
|
526
|
-
"file_path": "C:\\git\\bedrock-wrapper\\test-models.js",
|
|
527
|
-
"old_string": " console.clear();\n await logOutput(`Starting tests with ${availableModels.length} models...`, 'info');\n await logOutput(`Each model will be tested with streaming and non-streaming calls\\n`, 'info');",
|
|
528
|
-
"new_string": " console.clear();\n await logOutput(`Starting tests with ${availableModels.length} models using ${apiMode}...`, 'info');\n await logOutput(`Each model will be tested with streaming and non-streaming calls\\n`, 'info');"
|
|
529
|
-
}
|
|
530
|
-
},
|
|
531
|
-
{
|
|
532
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
533
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
534
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
535
|
-
"hook_event_name": "PreToolUse",
|
|
536
|
-
"tool_name": "TodoWrite",
|
|
537
|
-
"tool_input": {
|
|
538
|
-
"todos": [
|
|
539
|
-
{
|
|
540
|
-
"content": "Research AWS Bedrock Converse API documentation",
|
|
541
|
-
"status": "completed",
|
|
542
|
-
"id": "1"
|
|
543
|
-
},
|
|
544
|
-
{
|
|
545
|
-
"content": "Understand current codebase structure and invoke API implementation",
|
|
546
|
-
"status": "completed",
|
|
547
|
-
"id": "2"
|
|
548
|
-
},
|
|
549
|
-
{
|
|
550
|
-
"content": "Design Converse API integration approach",
|
|
551
|
-
"status": "completed",
|
|
552
|
-
"id": "3"
|
|
553
|
-
},
|
|
554
|
-
{
|
|
555
|
-
"content": "Write tests for Converse API functionality (TDD)",
|
|
556
|
-
"status": "completed",
|
|
557
|
-
"id": "4"
|
|
558
|
-
},
|
|
559
|
-
{
|
|
560
|
-
"content": "Implement Converse API support in bedrock-wrapper.js",
|
|
561
|
-
"status": "completed",
|
|
562
|
-
"id": "5"
|
|
563
|
-
},
|
|
564
|
-
{
|
|
565
|
-
"content": "Update existing tests to handle both APIs",
|
|
566
|
-
"status": "completed",
|
|
567
|
-
"id": "6"
|
|
568
|
-
},
|
|
569
|
-
{
|
|
570
|
-
"content": "Test all models with both invoke and converse APIs",
|
|
571
|
-
"status": "in_progress",
|
|
572
|
-
"id": "7"
|
|
573
|
-
}
|
|
574
|
-
]
|
|
575
|
-
}
|
|
576
|
-
},
|
|
577
|
-
{
|
|
578
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
579
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
580
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
581
|
-
"hook_event_name": "PreToolUse",
|
|
582
|
-
"tool_name": "Bash",
|
|
583
|
-
"tool_input": {
|
|
584
|
-
"command": "npm run test-converse",
|
|
585
|
-
"timeout": 60000,
|
|
586
|
-
"description": "Running the new Converse API test"
|
|
587
|
-
}
|
|
588
|
-
},
|
|
589
|
-
{
|
|
590
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
591
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
592
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
593
|
-
"hook_event_name": "PreToolUse",
|
|
594
|
-
"tool_name": "Bash",
|
|
595
|
-
"tool_input": {
|
|
596
|
-
"command": "npm run test-converse 2>&1 | head -200",
|
|
597
|
-
"timeout": 30000,
|
|
598
|
-
"description": "Running a quick test to see the output"
|
|
599
|
-
}
|
|
600
|
-
},
|
|
601
|
-
{
|
|
602
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
603
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
604
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
605
|
-
"hook_event_name": "PreToolUse",
|
|
606
|
-
"tool_name": "Write",
|
|
607
|
-
"tool_input": {
|
|
608
|
-
"file_path": "C:\\git\\bedrock-wrapper\\test-simple-converse.js",
|
|
609
|
-
"content": "// Simple test to verify Converse API implementation\nimport dotenv from 'dotenv';\nimport { bedrockWrapper } from \"./bedrock-wrapper.js\";\n\ndotenv.config();\n\nconst AWS_REGION = process.env.AWS_REGION;\nconst AWS_ACCESS_KEY_ID = process.env.AWS_ACCESS_KEY_ID;\nconst AWS_SECRET_ACCESS_KEY = process.env.AWS_SECRET_ACCESS_KEY;\n\nasync function testSimple() {\n const awsCreds = {\n region: AWS_REGION,\n accessKeyId: AWS_ACCESS_KEY_ID,\n secretAccessKey: AWS_SECRET_ACCESS_KEY,\n };\n\n const messages = [\n { role: \"user\", content: \"What is 2+2? Answer in one word.\" }\n ];\n\n const openaiChatCompletionsCreateObject = {\n messages,\n model: \"Claude-3-Haiku\", \n max_tokens: 50,\n stream: false,\n temperature: 0.1,\n top_p: 0.9,\n };\n\n console.log(\"Testing with Invoke API...\");\n let invokeResponse = \"\";\n try {\n const response = await bedrockWrapper(awsCreds, openaiChatCompletionsCreateObject, { \n logging: false, \n useConverseAPI: false \n });\n for await (const data of response) {\n invokeResponse += data;\n }\n console.log(\"Invoke API Response:\", invokeResponse);\n } catch (error) {\n console.error(\"Invoke API Error:\", error.message);\n }\n\n console.log(\"\\nTesting with Converse API...\");\n let converseResponse = \"\";\n try {\n const response = await bedrockWrapper(awsCreds, openaiChatCompletionsCreateObject, { \n logging: false, \n useConverseAPI: true \n });\n for await (const data of response) {\n converseResponse += data;\n }\n console.log(\"Converse API Response:\", converseResponse);\n } catch (error) {\n console.error(\"Converse API Error:\", error.message);\n }\n\n console.log(\"\\nTest complete!\");\n}\n\ntestSimple().catch(console.error);"
|
|
610
|
-
}
|
|
611
|
-
},
|
|
612
|
-
{
|
|
613
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
614
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
615
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
616
|
-
"hook_event_name": "PreToolUse",
|
|
617
|
-
"tool_name": "Bash",
|
|
618
|
-
"tool_input": {
|
|
619
|
-
"command": "node test-simple-converse.js",
|
|
620
|
-
"timeout": 20000,
|
|
621
|
-
"description": "Running simple test to verify basic Converse API functionality"
|
|
622
|
-
}
|
|
623
|
-
},
|
|
624
|
-
{
|
|
625
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
626
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
627
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
628
|
-
"hook_event_name": "PreToolUse",
|
|
629
|
-
"tool_name": "Write",
|
|
630
|
-
"tool_input": {
|
|
631
|
-
"file_path": "C:\\git\\bedrock-wrapper\\test-streaming-converse.js",
|
|
632
|
-
"content": "// Test streaming with Converse API\nimport dotenv from 'dotenv';\nimport { bedrockWrapper } from \"./bedrock-wrapper.js\";\n\ndotenv.config();\n\nconst AWS_REGION = process.env.AWS_REGION;\nconst AWS_ACCESS_KEY_ID = process.env.AWS_ACCESS_KEY_ID;\nconst AWS_SECRET_ACCESS_KEY = process.env.AWS_SECRET_ACCESS_KEY;\n\nasync function testStreaming() {\n const awsCreds = {\n region: AWS_REGION,\n accessKeyId: AWS_ACCESS_KEY_ID,\n secretAccessKey: AWS_SECRET_ACCESS_KEY,\n };\n\n const messages = [\n { role: \"user\", content: \"Count from 1 to 5.\" }\n ];\n\n const openaiChatCompletionsCreateObject = {\n messages,\n model: \"Claude-3-Haiku\", \n max_tokens: 100,\n stream: true,\n temperature: 0.1,\n top_p: 0.9,\n };\n\n console.log(\"Testing STREAMING with Invoke API...\");\n let invokeResponse = \"\";\n try {\n for await (const chunk of bedrockWrapper(awsCreds, openaiChatCompletionsCreateObject, { \n logging: false, \n useConverseAPI: false \n })) {\n process.stdout.write(chunk);\n invokeResponse += chunk;\n }\n console.log(\"\\nFull Invoke Response:\", invokeResponse);\n } catch (error) {\n console.error(\"Invoke API Error:\", error.message);\n }\n\n console.log(\"\\n\\nTesting STREAMING with Converse API...\");\n let converseResponse = \"\";\n try {\n for await (const chunk of bedrockWrapper(awsCreds, openaiChatCompletionsCreateObject, { \n logging: false, \n useConverseAPI: true \n })) {\n process.stdout.write(chunk);\n converseResponse += chunk;\n }\n console.log(\"\\nFull Converse Response:\", converseResponse);\n } catch (error) {\n console.error(\"Converse API Error:\", error.message);\n }\n\n console.log(\"\\nStreaming test complete!\");\n}\n\ntestStreaming().catch(console.error);"
|
|
633
|
-
}
|
|
634
|
-
},
|
|
635
|
-
{
|
|
636
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
637
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
638
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
639
|
-
"hook_event_name": "PreToolUse",
|
|
640
|
-
"tool_name": "Bash",
|
|
641
|
-
"tool_input": {
|
|
642
|
-
"command": "node test-streaming-converse.js",
|
|
643
|
-
"timeout": 20000,
|
|
644
|
-
"description": "Testing streaming functionality with Converse API"
|
|
645
|
-
}
|
|
646
|
-
},
|
|
647
|
-
{
|
|
648
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
649
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
650
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
651
|
-
"hook_event_name": "PreToolUse",
|
|
652
|
-
"tool_name": "Write",
|
|
653
|
-
"tool_input": {
|
|
654
|
-
"file_path": "C:\\git\\bedrock-wrapper\\test-models-converse.js",
|
|
655
|
-
"content": "// Test Converse API with different model families\nimport dotenv from 'dotenv';\nimport { bedrockWrapper } from \"./bedrock-wrapper.js\";\nimport chalk from 'chalk';\n\ndotenv.config();\n\nconst AWS_REGION = process.env.AWS_REGION;\nconst AWS_ACCESS_KEY_ID = process.env.AWS_ACCESS_KEY_ID;\nconst AWS_SECRET_ACCESS_KEY = process.env.AWS_SECRET_ACCESS_KEY;\n\nasync function testModel(model, awsCreds) {\n const messages = [\n { role: \"user\", content: \"What is the capital of France? Answer in one short sentence.\" }\n ];\n\n const openaiChatCompletionsCreateObject = {\n messages,\n model,\n max_tokens: 100,\n stream: false,\n temperature: 0.1,\n top_p: 0.9,\n };\n\n console.log(chalk.yellow(`\\nTesting ${model}...`));\n \n // Test Invoke API\n let invokeResponse = \"\";\n const invokeStart = Date.now();\n try {\n const response = await bedrockWrapper(awsCreds, openaiChatCompletionsCreateObject, { \n logging: false, \n useConverseAPI: false \n });\n for await (const data of response) {\n invokeResponse += data;\n }\n const invokeTime = Date.now() - invokeStart;\n console.log(chalk.green(`\u00e2\u0153\u201c Invoke API (${invokeTime}ms):`), invokeResponse.substring(0, 60) + '...');\n } catch (error) {\n console.log(chalk.red(`\u00e2\u0153\u2014 Invoke API Error:`), error.message);\n }\n\n // Test Converse API\n let converseResponse = \"\";\n const converseStart = Date.now();\n try {\n const response = await bedrockWrapper(awsCreds, openaiChatCompletionsCreateObject, { \n logging: false, \n useConverseAPI: true \n });\n for await (const data of response) {\n converseResponse += data;\n }\n const converseTime = Date.now() - converseStart;\n console.log(chalk.cyan(`\u00e2\u0153\u201c Converse API (${converseTime}ms):`), converseResponse.substring(0, 60) + '...');\n } catch (error) {\n console.log(chalk.red(`\u00e2\u0153\u2014 Converse API Error:`), error.message);\n }\n}\n\nasync function main() {\n const awsCreds = {\n region: AWS_REGION,\n accessKeyId: AWS_ACCESS_KEY_ID,\n secretAccessKey: AWS_SECRET_ACCESS_KEY,\n };\n\n const modelsToTest = [\n \"Claude-3-Haiku\", // Claude family\n \"Nova-Micro\", // Nova family \n \"Llama-3-2-1b\", // Llama family\n \"Mistral-7b\" // Mistral family\n ];\n\n console.log(chalk.blue(`\\n${'='.repeat(60)}`));\n console.log(chalk.blue(`Testing Converse API across different model families`));\n console.log(chalk.blue(`${'='.repeat(60)}`));\n\n for (const model of modelsToTest) {\n try {\n await testModel(model, awsCreds);\n } catch (error) {\n console.log(chalk.red(`Error testing ${model}:`), error.message);\n }\n }\n\n console.log(chalk.green(`\\n${'='.repeat(60)}`));\n console.log(chalk.green(`All tests complete!`));\n console.log(chalk.green(`${'='.repeat(60)}\\n`));\n}\n\nmain().catch(console.error);"
|
|
656
|
-
}
|
|
657
|
-
},
|
|
658
|
-
{
|
|
659
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
660
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
661
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
662
|
-
"hook_event_name": "PreToolUse",
|
|
663
|
-
"tool_name": "Bash",
|
|
664
|
-
"tool_input": {
|
|
665
|
-
"command": "node test-models-converse.js",
|
|
666
|
-
"timeout": 30000,
|
|
667
|
-
"description": "Testing Converse API with different model families"
|
|
668
|
-
}
|
|
669
|
-
},
|
|
670
|
-
{
|
|
671
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
672
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
673
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
674
|
-
"hook_event_name": "PreToolUse",
|
|
675
|
-
"tool_name": "TodoWrite",
|
|
676
|
-
"tool_input": {
|
|
677
|
-
"todos": [
|
|
678
|
-
{
|
|
679
|
-
"content": "Research AWS Bedrock Converse API documentation",
|
|
680
|
-
"status": "completed",
|
|
681
|
-
"id": "1"
|
|
682
|
-
},
|
|
683
|
-
{
|
|
684
|
-
"content": "Understand current codebase structure and invoke API implementation",
|
|
685
|
-
"status": "completed",
|
|
686
|
-
"id": "2"
|
|
687
|
-
},
|
|
688
|
-
{
|
|
689
|
-
"content": "Design Converse API integration approach",
|
|
690
|
-
"status": "completed",
|
|
691
|
-
"id": "3"
|
|
692
|
-
},
|
|
693
|
-
{
|
|
694
|
-
"content": "Write tests for Converse API functionality (TDD)",
|
|
695
|
-
"status": "completed",
|
|
696
|
-
"id": "4"
|
|
697
|
-
},
|
|
698
|
-
{
|
|
699
|
-
"content": "Implement Converse API support in bedrock-wrapper.js",
|
|
700
|
-
"status": "completed",
|
|
701
|
-
"id": "5"
|
|
702
|
-
},
|
|
703
|
-
{
|
|
704
|
-
"content": "Update existing tests to handle both APIs",
|
|
705
|
-
"status": "completed",
|
|
706
|
-
"id": "6"
|
|
707
|
-
},
|
|
708
|
-
{
|
|
709
|
-
"content": "Test all models with both invoke and converse APIs",
|
|
710
|
-
"status": "completed",
|
|
711
|
-
"id": "7"
|
|
712
|
-
}
|
|
713
|
-
]
|
|
714
|
-
}
|
|
715
|
-
},
|
|
716
|
-
{
|
|
717
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
718
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
719
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
720
|
-
"hook_event_name": "PreToolUse",
|
|
721
|
-
"tool_name": "Read",
|
|
722
|
-
"tool_input": {
|
|
723
|
-
"file_path": "C:\\git\\bedrock-wrapper\\README.md",
|
|
724
|
-
"limit": 100
|
|
725
|
-
}
|
|
726
|
-
},
|
|
727
|
-
{
|
|
728
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
729
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
730
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
731
|
-
"hook_event_name": "PreToolUse",
|
|
732
|
-
"tool_name": "Read",
|
|
733
|
-
"tool_input": {
|
|
734
|
-
"file_path": "C:\\git\\bedrock-wrapper\\README.md",
|
|
735
|
-
"offset": 85,
|
|
736
|
-
"limit": 30
|
|
737
|
-
}
|
|
738
|
-
},
|
|
739
|
-
{
|
|
740
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
741
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
742
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
743
|
-
"hook_event_name": "PreToolUse",
|
|
744
|
-
"tool_name": "Edit",
|
|
745
|
-
"tool_input": {
|
|
746
|
-
"file_path": "C:\\git\\bedrock-wrapper\\README.md",
|
|
747
|
-
"old_string": " }\n\n---\n\n### Supported Models",
|
|
748
|
-
"new_string": " }\n\n5. **NEW: Using the Converse API (optional)**\n \n You can now optionally use AWS Bedrock's Converse API instead of the Invoke API by passing `useConverseAPI: true` in the options parameter:\n ```javascript\n // Use the Converse API for unified request/response format across all models\n for await (const chunk of bedrockWrapper(awsCreds, openaiChatCompletionsCreateObject, { useConverseAPI: true })) {\n completeResponse += chunk;\n process.stdout.write(chunk);\n }\n ```\n \n The Converse API provides:\n - **Consistent API**: Single request/response format across all models\n - **Simplified conversation management**: Better handling of multi-turn conversations\n - **System prompts**: Cleaner separation of system instructions\n - **Tool use support**: Native support for function calling (where supported)\n - **Unified multimodal**: Consistent handling of text and image inputs\n\n---\n\n### Supported Models"
|
|
749
|
-
}
|
|
750
|
-
},
|
|
751
|
-
{
|
|
752
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
753
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
754
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
755
|
-
"hook_event_name": "PreToolUse",
|
|
756
|
-
"tool_name": "Grep",
|
|
757
|
-
"tool_input": {
|
|
758
|
-
"pattern": "### Scripts",
|
|
759
|
-
"path": "C:\\git\\bedrock-wrapper\\README.md",
|
|
760
|
-
"output_mode": "content",
|
|
761
|
-
"-A": 15,
|
|
762
|
-
"-n": true
|
|
763
|
-
}
|
|
764
|
-
},
|
|
765
|
-
{
|
|
766
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
767
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
768
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
769
|
-
"hook_event_name": "PreToolUse",
|
|
770
|
-
"tool_name": "Grep",
|
|
771
|
-
"tool_input": {
|
|
772
|
-
"pattern": "Testing",
|
|
773
|
-
"path": "C:\\git\\bedrock-wrapper\\README.md",
|
|
774
|
-
"output_mode": "content",
|
|
775
|
-
"-B": 2,
|
|
776
|
-
"-A": 10,
|
|
777
|
-
"-n": true
|
|
778
|
-
}
|
|
779
|
-
},
|
|
780
|
-
{
|
|
781
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
782
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
783
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
784
|
-
"hook_event_name": "PreToolUse",
|
|
785
|
-
"tool_name": "Bash",
|
|
786
|
-
"tool_input": {
|
|
787
|
-
"command": "tail -20 C:\\git\\bedrock-wrapper\\README.md",
|
|
788
|
-
"description": "Check the end of README file"
|
|
789
|
-
}
|
|
790
|
-
},
|
|
791
|
-
{
|
|
792
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
793
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
794
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
795
|
-
"hook_event_name": "PreToolUse",
|
|
796
|
-
"tool_name": "Bash",
|
|
797
|
-
"tool_input": {
|
|
798
|
-
"command": "tail -20 README.md",
|
|
799
|
-
"description": "Check the end of README file"
|
|
800
|
-
}
|
|
801
|
-
},
|
|
802
|
-
{
|
|
803
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
804
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
805
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
806
|
-
"hook_event_name": "PreToolUse",
|
|
807
|
-
"tool_name": "Edit",
|
|
808
|
-
"tool_input": {
|
|
809
|
-
"file_path": "C:\\git\\bedrock-wrapper\\README.md",
|
|
810
|
-
"old_string": "---\n\n### \u00f0\u0178\u201c\u00a2 P.S.",
|
|
811
|
-
"new_string": "---\n\n### \u00f0\u0178\u00a7\u00aa Testing\n\nThe package includes comprehensive test suites to verify functionality:\n\n```bash\n# Test all models with the Invoke API (default)\nnpm run test\n\n# Test all models with the Converse API\nnpm run test -- --converse\n\n# Test vision/multimodal capabilities\nnpm run test-vision\n\n# Test stop sequences functionality\nnpm run test-stop\n\n# Test Converse API specifically\nnpm run test-converse\n\n# Interactive testing\nnpm run interactive\n```\n\n---\n\n### \u00f0\u0178\u201c\u00a2 P.S."
|
|
812
|
-
}
|
|
813
|
-
},
|
|
814
|
-
{
|
|
815
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
816
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
817
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
818
|
-
"hook_event_name": "PreToolUse",
|
|
819
|
-
"tool_name": "Edit",
|
|
820
|
-
"tool_input": {
|
|
821
|
-
"file_path": "C:\\git\\bedrock-wrapper\\package.json",
|
|
822
|
-
"old_string": " \"version\": \"2.4.5\",",
|
|
823
|
-
"new_string": " \"version\": \"2.5.0\","
|
|
824
|
-
}
|
|
825
|
-
},
|
|
826
|
-
{
|
|
827
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
828
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
829
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
830
|
-
"hook_event_name": "PreToolUse",
|
|
831
|
-
"tool_name": "Bash",
|
|
832
|
-
"tool_input": {
|
|
833
|
-
"command": "npm run test -- --converse 2>&1 | head -50",
|
|
834
|
-
"timeout": 20000,
|
|
835
|
-
"description": "Quick test of Converse API with test-models.js"
|
|
836
|
-
}
|
|
837
|
-
},
|
|
838
|
-
{
|
|
839
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
840
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
841
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
842
|
-
"hook_event_name": "PreToolUse",
|
|
843
|
-
"tool_name": "Write",
|
|
844
|
-
"tool_input": {
|
|
845
|
-
"file_path": "C:\\git\\bedrock-wrapper\\example-converse-api.js",
|
|
846
|
-
"content": "// ================================================================================\n// == Example: Using the AWS Bedrock Converse API with bedrock-wrapper ==\n// ================================================================================\n\nimport dotenv from 'dotenv';\nimport { bedrockWrapper } from \"./bedrock-wrapper.js\";\n\ndotenv.config();\n\nconst AWS_REGION = process.env.AWS_REGION;\nconst AWS_ACCESS_KEY_ID = process.env.AWS_ACCESS_KEY_ID;\nconst AWS_SECRET_ACCESS_KEY = process.env.AWS_SECRET_ACCESS_KEY;\n\nasync function main() {\n const awsCreds = {\n region: AWS_REGION,\n accessKeyId: AWS_ACCESS_KEY_ID,\n secretAccessKey: AWS_SECRET_ACCESS_KEY,\n };\n\n // Example conversation with system prompt\n const messages = [\n {\n role: \"system\",\n content: \"You are a helpful AI assistant. Be concise and clear in your responses.\"\n },\n {\n role: \"user\",\n content: \"What are the benefits of using the Converse API over the Invoke API?\"\n }\n ];\n\n const openaiChatCompletionsCreateObject = {\n messages,\n model: \"Claude-3-Haiku\", // Works with any supported model\n max_tokens: 500,\n stream: true, // Can be true or false\n temperature: 0.7,\n top_p: 0.9,\n stop: [\"END\", \"STOP\"] // Optional stop sequences\n };\n\n console.log(\"=\".repeat(60));\n console.log(\"Example: AWS Bedrock Converse API\");\n console.log(\"=\".repeat(60));\n console.log(\"\\nUsing model:\", openaiChatCompletionsCreateObject.model);\n console.log(\"Streaming:\", openaiChatCompletionsCreateObject.stream);\n console.log(\"\\nResponse:\");\n console.log(\"-\".repeat(40));\n\n let completeResponse = \"\";\n\n try {\n // Use the Converse API by setting useConverseAPI: true\n for await (const chunk of bedrockWrapper(awsCreds, openaiChatCompletionsCreateObject, { \n useConverseAPI: true, // \u00e2\u2020\udc90 Enable Converse API\n logging: false // Set to true to see API requests/responses\n })) {\n completeResponse += chunk;\n process.stdout.write(chunk); // Display streamed output\n }\n\n console.log(\"\\n\" + \"-\".repeat(40));\n console.log(\"\\n\u00e2\u0153\u2026 Successfully used the Converse API!\");\n \n // Uncomment to see the complete response\n // console.log(\"\\nComplete Response:\", completeResponse);\n\n } catch (error) {\n console.error(\"\\n\u00e2\udc9d\u0152 Error:\", error.message);\n }\n\n // Example 2: Comparing Invoke API vs Converse API\n console.log(\"\\n\" + \"=\".repeat(60));\n console.log(\"Comparing Invoke API vs Converse API\");\n console.log(\"=\".repeat(60));\n\n const simpleMessage = [\n { role: \"user\", content: \"What is 2+2? Answer in one word.\" }\n ];\n\n const compareRequest = {\n messages: simpleMessage,\n model: \"Claude-3-Haiku\",\n max_tokens: 50,\n stream: false,\n temperature: 0.1,\n top_p: 0.9\n };\n\n // Test with Invoke API\n console.log(\"\\n1. Using Invoke API (default):\");\n let invokeResponse = \"\";\n const invokeStart = Date.now();\n const invokeGen = await bedrockWrapper(awsCreds, compareRequest, { useConverseAPI: false });\n for await (const data of invokeGen) {\n invokeResponse += data;\n }\n const invokeTime = Date.now() - invokeStart;\n console.log(` Response: ${invokeResponse}`);\n console.log(` Time: ${invokeTime}ms`);\n\n // Test with Converse API\n console.log(\"\\n2. Using Converse API:\");\n let converseResponse = \"\";\n const converseStart = Date.now();\n const converseGen = await bedrockWrapper(awsCreds, compareRequest, { useConverseAPI: true });\n for await (const data of converseGen) {\n converseResponse += data;\n }\n const converseTime = Date.now() - converseStart;\n console.log(` Response: ${converseResponse}`);\n console.log(` Time: ${converseTime}ms`);\n\n console.log(\"\\n\" + \"=\".repeat(60));\n console.log(\"\u00e2\u0153\u00a8 Example complete!\");\n console.log(\"=\".repeat(60));\n}\n\nmain().catch(console.error);"
|
|
847
|
-
}
|
|
848
|
-
},
|
|
849
|
-
{
|
|
850
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
851
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
852
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
853
|
-
"hook_event_name": "PreToolUse",
|
|
854
|
-
"tool_name": "Bash",
|
|
855
|
-
"tool_input": {
|
|
856
|
-
"command": "node example-converse-api.js",
|
|
857
|
-
"timeout": 15000,
|
|
858
|
-
"description": "Testing the example file"
|
|
859
|
-
}
|
|
860
|
-
},
|
|
861
|
-
{
|
|
862
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
863
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
864
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
865
|
-
"hook_event_name": "PreToolUse",
|
|
866
|
-
"tool_name": "Bash",
|
|
867
|
-
"tool_input": {
|
|
868
|
-
"command": "rm test-simple-converse.js test-streaming-converse.js test-models-converse.js",
|
|
869
|
-
"description": "Cleaning up temporary test files"
|
|
870
|
-
}
|
|
871
|
-
},
|
|
872
|
-
{
|
|
873
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
874
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
875
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
876
|
-
"hook_event_name": "PreToolUse",
|
|
877
|
-
"tool_name": "MultiEdit",
|
|
878
|
-
"tool_input": {
|
|
879
|
-
"file_path": "C:\\git\\bedrock-wrapper\\bedrock-wrapper.js",
|
|
880
|
-
"edits": [
|
|
881
|
-
{
|
|
882
|
-
"old_string": "// Convert messages to Converse API format\nasync function convertToConverseFormat(messages, awsModel) {\n const converseMessages = [];\n let systemPrompts = [];\n \n for (const msg of messages) {\n if (msg.role === \"system\") {\n // System messages are handled separately in Converse API\n if (typeof msg.content === 'string') {\n systemPrompts.push({ text: msg.content });\n } else if (Array.isArray(msg.content)) {\n // Extract text from content array\n const textContent = msg.content\n .filter(item => item.type === 'text')\n .map(item => item.text || item)\n .join('\\n');\n if (textContent) {\n systemPrompts.push({ text: textContent });\n }\n }\n } else {\n // Convert user and assistant messages\n let content = [];\n \n if (typeof msg.content === 'string') {\n content = [{ text: msg.content }];\n } else if (Array.isArray(msg.content)) {\n for (const item of msg.content) {\n if (item.type === 'text') {\n content.push({ text: item.text || item });\n } else if (item.type === 'image') {\n // Handle image content\n if (item.source && item.source.data) {\n content.push({\n image: {\n format: 'jpeg',\n source: {\n bytes: Buffer.from(item.source.data, 'base64')\n }\n }\n });\n }\n } else if (item.type === 'image_url') {\n // Process image URL to base64\n const processedImage = await processImage(\n typeof item.image_url === 'string' ? \n item.image_url : \n item.image_url.url\n );\n content.push({\n image: {\n format: 'jpeg',\n source: {\n bytes: Buffer.from(processedImage, 'base64')\n }\n }\n });\n }\n }\n }\n \n if (content.length > 0) {\n converseMessages.push({\n role: msg.role,\n content: content\n });\n }\n }\n }\n \n return { messages: converseMessages, system: systemPrompts };\n}",
|
|
883
|
-
"new_string": "// Convert messages to Converse API format\nasync function convertToConverseFormat(messages) {\n const converseMessages = [];\n let systemPrompts = [];\n \n for (const msg of messages) {\n if (msg.role === \"system\") {\n // System messages are handled separately in Converse API\n if (typeof msg.content === 'string') {\n systemPrompts.push({ text: msg.content });\n } else if (Array.isArray(msg.content)) {\n // Extract text from content array\n const textContent = msg.content\n .filter(item => item.type === 'text')\n .map(item => item.text || item)\n .join('\\n');\n if (textContent) {\n systemPrompts.push({ text: textContent });\n }\n }\n } else {\n // Convert user and assistant messages\n let content = [];\n \n if (typeof msg.content === 'string') {\n content = [{ text: msg.content }];\n } else if (Array.isArray(msg.content)) {\n for (const item of msg.content) {\n if (item.type === 'text') {\n content.push({ text: item.text || item });\n } else if (item.type === 'image') {\n // Handle image content\n if (item.source && item.source.data) {\n content.push({\n image: {\n format: 'jpeg',\n source: {\n bytes: Buffer.from(item.source.data, 'base64')\n }\n }\n });\n }\n } else if (item.type === 'image_url') {\n // Process image URL to base64\n const processedImage = await processImage(\n typeof item.image_url === 'string' ? \n item.image_url : \n item.image_url.url\n );\n content.push({\n image: {\n format: 'jpeg',\n source: {\n bytes: Buffer.from(processedImage, 'base64')\n }\n }\n });\n }\n }\n }\n \n if (content.length > 0) {\n converseMessages.push({\n role: msg.role,\n content: content\n });\n }\n }\n }\n \n return { messages: converseMessages, system: systemPrompts };\n}\n\n// Process messages for Invoke API (complex model-specific formatting)\nasync function processMessagesForInvoke(messages, awsModel) {\n let message_cleaned = [];\n let system_message = \"\";\n\n for (let i = 0; i < messages.length; i++) {\n if (messages[i].content) {\n let processedContent = messages[i].content;\n \n // Handle array format for messages with images\n if (Array.isArray(processedContent)) {\n let newContent = [];\n for (const item of processedContent) {\n if (item.type === 'text') {\n newContent.push(item);\n } else if (item.type === 'image_url') {\n const processedImage = await processImage(\n typeof item.image_url === 'string' ? \n item.image_url : \n item.image_url.url\n );\n \n // Handle different model formats\n if (awsModel.messages_api) {\n newContent.push({\n type: 'image',\n source: {\n type: 'base64',\n media_type: 'image/jpeg',\n data: processedImage\n }\n });\n } else {\n // Llama format for images\n newContent.push({\n type: 'image',\n image_data: {\n url: `data:image/jpeg;base64,${processedImage}`\n }\n });\n }\n }\n }\n processedContent = newContent;\n }\n\n if (awsModel.system_as_separate_field && messages[i].role === \"system\") {\n system_message = processedContent;\n } else {\n message_cleaned.push({\n ...messages[i],\n content: processedContent\n });\n }\n } else if (awsModel.display_role_names) {\n message_cleaned.push(messages[i]);\n }\n\n if (i === (messages.length - 1) && messages[i].content !== \"\" && awsModel.display_role_names) {\n message_cleaned.push({role: \"assistant\", content: \"\"});\n }\n }\n \n return { message_cleaned, system_message };\n}\n\n// Build prompt for Invoke API (model-specific formatting)\nfunction buildInvokePrompt(message_cleaned, awsModel) {\n if (awsModel.messages_api) {\n // convert message array to prompt object if model supports messages api\n return message_cleaned;\n } else {\n let prompt = awsModel.bos_text;\n let eom_text_inserted = false;\n \n for (let i = 0; i < message_cleaned.length; i++) {\n prompt += \"\\n\";\n \n // Handle user messages with potential images\n if (message_cleaned[i].role === \"user\") {\n prompt += awsModel.role_user_message_prefix;\n prompt += awsModel.role_user_prefix;\n if (awsModel.display_role_names) { prompt += message_cleaned[i].role; }\n prompt += awsModel.role_user_suffix;\n if (awsModel.display_role_names) { prompt += \"\\n\"; }\n \n // Handle content array with text and images\n if (Array.isArray(message_cleaned[i].content)) {\n let textContent = \"\";\n let imageContent = \"\";\n \n // Separate text and image content\n message_cleaned[i].content.forEach(item => {\n if (item.type === 'text') {\n textContent += item.text;\n } else if (item.type === 'image') {\n imageContent = item.image_data.url;\n }\n });\n \n // Format based on vision model requirements\n if (awsModel.vision && imageContent) {\n prompt += `\\n${textContent}\\n\\n${imageContent}`;\n } else {\n prompt += textContent;\n }\n } else {\n prompt += message_cleaned[i].content;\n }\n \n prompt += awsModel.role_user_message_suffix;\n } else if (message_cleaned[i].role === \"assistant\") {\n prompt += awsModel.role_assistant_message_prefix;\n prompt += awsModel.role_assistant_prefix;\n if (awsModel.display_role_names) { prompt += message_cleaned[i].role; }\n prompt += awsModel.role_assistant_suffix;\n if (awsModel.display_role_names) {prompt += \"\\n\"; }\n prompt += message_cleaned[i].content;\n prompt += awsModel.role_assistant_message_suffix;\n }\n \n if (message_cleaned[i+1] && message_cleaned[i+1].content === \"\") {\n prompt += `\\n${awsModel.eom_text}`;\n eom_text_inserted = true;\n } else if ((i+1) === (message_cleaned.length - 1) && !eom_text_inserted) {\n prompt += `\\n${awsModel.eom_text}`;\n }\n }\n return prompt;\n }\n}\n\n// Build request object for Invoke API (model-specific)\nfunction buildInvokeRequest(prompt, awsModel, max_gen_tokens, temperature, top_p, stop_sequences, stop, system_message) {\n if (awsModel.messages_api) {\n // Check if this is a Nova model (has schemaVersion in special_request_schema)\n if (awsModel.special_request_schema?.schemaVersion === \"messages-v1\") {\n // Nova model format - convert messages to Nova's expected format\n const novaMessages = prompt.map(msg => {\n let content;\n \n // Convert content to array format for Nova\n if (typeof msg.content === 'string') {\n content = [{ text: msg.content }];\n } else if (Array.isArray(msg.content)) {\n // Already in array format, ensure proper structure\n content = msg.content.map(item => {\n if (item.type === 'text') {\n return { text: item.text || item };\n } else if (item.type === 'image') {\n return {\n image: {\n format: 'jpeg',\n source: {\n bytes: item.source.data\n }\n }\n };\n }\n return item;\n });\n } else {\n content = [{ text: String(msg.content) }];\n }\n \n return {\n role: msg.role,\n content: content\n };\n });\n \n const stopSequencesValue = stop_sequences || stop;\n const novaRequest = {\n ...awsModel.special_request_schema,\n messages: novaMessages,\n inferenceConfig: {\n [awsModel.max_tokens_param_name]: max_gen_tokens,\n temperature: temperature,\n topP: top_p,\n ...(awsModel.stop_sequences_param_name && stopSequencesValue && {\n [awsModel.stop_sequences_param_name]: Array.isArray(stopSequencesValue) ? stopSequencesValue : [stopSequencesValue]\n })\n }\n };\n \n // Add system message if present\n if (awsModel.system_as_separate_field && system_message) {\n novaRequest.system = [{ text: system_message }];\n }\n \n return novaRequest;\n } else {\n // Standard messages API format (Claude, etc.)\n const stopSequencesValue = stop_sequences || stop;\n return {\n messages: prompt,\n ...(awsModel.system_as_separate_field && system_message && { system: system_message }),\n [awsModel.max_tokens_param_name]: max_gen_tokens,\n temperature: temperature,\n top_p: top_p,\n ...(awsModel.stop_sequences_param_name && stopSequencesValue && {\n [awsModel.stop_sequences_param_name]: Array.isArray(stopSequencesValue) ? stopSequencesValue : [stopSequencesValue]\n }),\n ...awsModel.special_request_schema\n };\n }\n } else {\n return {\n prompt: typeof prompt === 'string' ? prompt : {\n messages: prompt.map(msg => ({\n role: msg.role,\n content: Array.isArray(msg.content) ? \n msg.content.map(item => \n item.type === 'text' ? item.text : item\n ).join('\\n') : \n msg.content\n }))\n },\n // Optional inference parameters:\n [awsModel.max_tokens_param_name]: max_gen_tokens,\n temperature: temperature,\n top_p: top_p,\n ...(() => {\n const stopSequencesValue = stop_sequences || stop;\n return awsModel.stop_sequences_param_name && stopSequencesValue ? {\n [awsModel.stop_sequences_param_name]: Array.isArray(stopSequencesValue) ? stopSequencesValue : [stopSequencesValue]\n } : {};\n })(),\n ...awsModel.special_request_schema\n };\n }\n}\n\n// Execute Invoke API call (streaming and non-streaming)\nasync function* executeInvokeAPI(client, request, awsModelId, shouldStream, awsModel, include_thinking_data) {\n if (shouldStream) {\n const responseStream = await client.send(\n new InvokeModelWithResponseStreamCommand({\n contentType: \"application/json\",\n body: JSON.stringify(request),\n modelId: awsModelId,\n }),\n );\n let is_thinking = false;\n let should_think = awsModel.special_request_schema?.thinking?.type === \"enabled\";\n \n for await (const event of responseStream.body) {\n const chunk = JSON.parse(new TextDecoder().decode(event.chunk.bytes));\n let result;\n result = getValueByPath(chunk, awsModel.response_chunk_element);\n if (result) {\n if (should_think && is_thinking) {\n is_thinking = false;\n result = `</think>\\n\\n${result}`;\n }\n // Process reasoning tags for GPT-OSS models\n result = processReasoningTags(result, awsModel);\n yield result;\n } else {\n if (include_thinking_data && awsModel.thinking_response_chunk_element) {\n let result = getValueByPath(chunk, awsModel.thinking_response_chunk_element);\n if (result && should_think && !is_thinking) {\n is_thinking = true;\n result = `<think>${result}`;\n }\n if (result) {\n yield result;\n }\n } \n } \n }\n } else {\n const apiResponse = await client.send(\n new InvokeModelCommand({\n contentType: \"application/json\",\n body: JSON.stringify(request),\n modelId: awsModelId,\n }),\n );\n\n const decodedBodyResponse = JSON.parse(new TextDecoder().decode(apiResponse.body));\n let thinking_result;\n let text_result;\n\n if (awsModel.thinking_response_nonchunk_element) {\n thinking_result = getValueByPath(decodedBodyResponse, awsModel.thinking_response_nonchunk_element);\n }\n\n if (awsModel.response_nonchunk_element) {\n text_result = getValueByPath(decodedBodyResponse, awsModel.response_nonchunk_element);\n }\n if (!text_result) {\n if (awsModel.response_chunk_element) {\n text_result = getValueByPath(decodedBodyResponse, awsModel.response_chunk_element);\n }\n if (!text_result && awsModel.response_nonchunk_element) {\n // replace [0] with [1]\n awsModel.response_nonchunk_element = awsModel.response_nonchunk_element.replace('[0]', '[1]');\n text_result = getValueByPath(decodedBodyResponse, awsModel.response_nonchunk_element);\n }\n }\n\n // Handle case where stop sequences cause empty content array\n if (!text_result && decodedBodyResponse.stop_reason === \"stop_sequence\") {\n // If stopped by sequence but no content, return empty string instead of undefined\n text_result = \"\";\n }\n\n // Ensure text_result is a string to prevent 'undefined' from being part of the response\n if (text_result === null || text_result === undefined) {\n text_result = \"\";\n }\n\n // Process reasoning tags for GPT-OSS models\n text_result = processReasoningTags(text_result, awsModel);\n\n let result = thinking_result ? `<think>${thinking_result}</think>\\n\\n${text_result}` : text_result;\n \n // Ensure final result is a string, in case thinking_result was also empty\n if (result === null || result === undefined) {\n result = \"\";\n }\n yield result;\n }\n}"
|
|
884
|
-
}
|
|
885
|
-
]
|
|
886
|
-
}
|
|
887
|
-
},
|
|
888
|
-
{
|
|
889
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
890
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
891
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
892
|
-
"hook_event_name": "PreToolUse",
|
|
893
|
-
"tool_name": "Edit",
|
|
894
|
-
"tool_input": {
|
|
895
|
-
"file_path": "C:\\git\\bedrock-wrapper\\bedrock-wrapper.js",
|
|
896
|
-
"old_string": "export async function* bedrockWrapper(awsCreds, openaiChatCompletionsCreateObject, { logging = false, useConverseAPI = false } = {} ) {\n const { region, accessKeyId, secretAccessKey } = awsCreds;\n let { messages, model, max_tokens, stream, temperature, top_p, include_thinking_data, stop, stop_sequences } = openaiChatCompletionsCreateObject;\n\n\n let {awsModelId, awsModel} = findAwsModelWithId(model);\n\n // cleanup message content before formatting prompt message\n let message_cleaned = [];\n let system_message = \"\";\n\n for (let i = 0; i < messages.length; i++) {\n if (messages[i].content) {\n let processedContent = messages[i].content;\n \n // Handle array format for messages with images\n if (Array.isArray(processedContent)) {\n let newContent = [];\n for (const item of processedContent) {\n if (item.type === 'text') {\n newContent.push(item);\n } else if (item.type === 'image_url') {\n const processedImage = await processImage(\n typeof item.image_url === 'string' ? \n item.image_url : \n item.image_url.url\n );\n \n // Handle different model formats\n if (awsModel.messages_api) {\n newContent.push({\n type: 'image',\n source: {\n type: 'base64',\n media_type: 'image/jpeg',\n data: processedImage\n }\n });\n } else {\n // Llama format for images\n newContent.push({\n type: 'image',\n image_data: {\n url: `data:image/jpeg;base64,${processedImage}`\n }\n });\n }\n }\n }\n processedContent = newContent;\n }\n\n if (awsModel.system_as_separate_field && messages[i].role === \"system\") {\n system_message = processedContent;\n } else {\n message_cleaned.push({\n ...messages[i],\n content: processedContent\n });\n }\n } else if (awsModel.display_role_names) {\n message_cleaned.push(messages[i]);\n }\n\n if (i === (messages.length - 1) && messages[i].content !== \"\" && awsModel.display_role_names) {\n message_cleaned.push({role: \"assistant\", content: \"\"});\n }\n }\n\n let prompt;\n\n // format prompt message from message array\n if (awsModel.messages_api) {\n // convert message array to prompt object if model supports messages api\n prompt = message_cleaned;\n } else {\n prompt = awsModel.bos_text;\n let eom_text_inserted = false;\n \n for (let i = 0; i < message_cleaned.length; i++) {\n prompt += \"\\n\";\n \n // Handle user messages with potential images\n if (message_cleaned[i].role === \"user\") {\n prompt += awsModel.role_user_message_prefix;\n prompt += awsModel.role_user_prefix;\n if (awsModel.display_role_names) { prompt += message_cleaned[i].role; }\n prompt += awsModel.role_user_suffix;\n if (awsModel.display_role_names) { prompt += \"\\n\"; }\n \n // Handle content array with text and images\n if (Array.isArray(message_cleaned[i].content)) {\n let textContent = \"\";\n let imageContent = \"\";\n \n // Separate text and image content\n message_cleaned[i].content.forEach(item => {\n if (item.type === 'text') {\n textContent += item.text;\n } else if (item.type === 'image') {\n imageContent = item.image_data.url;\n }\n });\n \n // Format based on vision model requirements\n if (awsModel.vision && imageContent) {\n prompt += `\\n${textContent}\\n\\n${imageContent}`;\n } else {\n prompt += textContent;\n }\n } else {\n prompt += message_cleaned[i].content;\n }\n \n prompt += awsModel.role_user_message_suffix;\n } else if (message_cleaned[i].role === \"assistant\") {\n prompt += awsModel.role_assistant_message_prefix;\n prompt += awsModel.role_assistant_prefix;\n if (awsModel.display_role_names) { prompt += message_cleaned[i].role; }\n prompt += awsModel.role_assistant_suffix;\n if (awsModel.display_role_names) {prompt += \"\\n\"; }\n prompt += message_cleaned[i].content;\n prompt += awsModel.role_assistant_message_suffix;\n }\n \n if (message_cleaned[i+1] && message_cleaned[i+1].content === \"\") {\n prompt += `\\n${awsModel.eom_text}`;\n eom_text_inserted = true;\n } else if ((i+1) === (message_cleaned.length - 1) && !eom_text_inserted) {\n prompt += `\\n${awsModel.eom_text}`;\n }\n }\n }\n\n // Add logging to see the final prompt\n if (logging) {\n console.log(\"\\nFinal formatted prompt:\", prompt);\n }\n\n let max_gen_tokens = max_tokens <= awsModel.max_supported_response_tokens ? max_tokens : awsModel.max_supported_response_tokens;\n\n if (awsModel.special_request_schema?.thinking?.type === \"enabled\") {\n // temperature may only be set to 1 when thinking is enabled\n temperature = 1;\n // top_p must be unset when thinking is enabled\n top_p = undefined;\n // bugget_tokens can not be greater than 80% of max_gen_tokens\n let budget_tokens = awsModel.special_request_schema?.thinking?.budget_tokens;\n if (budget_tokens > (max_gen_tokens * 0.8)) {\n budget_tokens = Math.floor(max_gen_tokens * 0.8);\n }\n if (budget_tokens < 1024) {\n budget_tokens = 1024;\n }\n // if awsModel.special_request_schema?.thinking?.budget_tokens, set it to budget_tokens\n if (awsModel.special_request_schema?.thinking?.budget_tokens) {\n awsModel.special_request_schema.thinking.budget_tokens = budget_tokens;\n // max_gen_tokens has to be greater than budget_tokens\n if (max_gen_tokens <= budget_tokens) {\n // make max_gen_tokens 20% greater than budget_tokens\n max_gen_tokens = Math.floor(budget_tokens * 1.2);\n }\n }\n }\n\n // if (logging) {\n // console.log(\"\\nMax tokens:\", max_gen_tokens);\n // }\n\n // Format the request payload using the model's native structure.\n const request = awsModel.messages_api ? (() => {\n // Check if this is a Nova model (has schemaVersion in special_request_schema)\n if (awsModel.special_request_schema?.schemaVersion === \"messages-v1\") {\n // Nova model format - convert messages to Nova's expected format\n const novaMessages = prompt.map(msg => {\n let content;\n \n // Convert content to array format for Nova\n if (typeof msg.content === 'string') {\n content = [{ text: msg.content }];\n } else if (Array.isArray(msg.content)) {\n // Already in array format, ensure proper structure\n content = msg.content.map(item => {\n if (item.type === 'text') {\n return { text: item.text || item };\n } else if (item.type === 'image') {\n return {\n image: {\n format: 'jpeg',\n source: {\n bytes: item.source.data\n }\n }\n };\n }\n return item;\n });\n } else {\n content = [{ text: String(msg.content) }];\n }\n \n return {\n role: msg.role,\n content: content\n };\n });\n \n const stopSequencesValue = stop_sequences || stop;\n const novaRequest = {\n ...awsModel.special_request_schema,\n messages: novaMessages,\n inferenceConfig: {\n [awsModel.max_tokens_param_name]: max_gen_tokens,\n temperature: temperature,\n topP: top_p,\n ...(awsModel.stop_sequences_param_name && stopSequencesValue && {\n [awsModel.stop_sequences_param_name]: Array.isArray(stopSequencesValue) ? stopSequencesValue : [stopSequencesValue]\n })\n }\n };\n \n // Add system message if present\n if (awsModel.system_as_separate_field && system_message) {\n novaRequest.system = [{ text: system_message }];\n }\n \n return novaRequest;\n } else {\n // Standard messages API format (Claude, etc.)\n const stopSequencesValue = stop_sequences || stop;\n return {\n messages: prompt,\n ...(awsModel.system_as_separate_field && system_message && { system: system_message }),\n [awsModel.max_tokens_param_name]: max_gen_tokens,\n temperature: temperature,\n top_p: top_p,\n ...(awsModel.stop_sequences_param_name && stopSequencesValue && {\n [awsModel.stop_sequences_param_name]: Array.isArray(stopSequencesValue) ? stopSequencesValue : [stopSequencesValue]\n }),\n ...awsModel.special_request_schema\n };\n }\n })() : {\n prompt: typeof prompt === 'string' ? prompt : {\n messages: prompt.map(msg => ({\n role: msg.role,\n content: Array.isArray(msg.content) ? \n msg.content.map(item => \n item.type === 'text' ? item.text : item\n ).join('\\n') : \n msg.content\n }))\n },\n // Optional inference parameters:\n [awsModel.max_tokens_param_name]: max_gen_tokens,\n temperature: temperature,\n top_p: top_p,\n ...(() => {\n const stopSequencesValue = stop_sequences || stop;\n return awsModel.stop_sequences_param_name && stopSequencesValue ? {\n [awsModel.stop_sequences_param_name]: Array.isArray(stopSequencesValue) ? stopSequencesValue : [stopSequencesValue]\n } : {};\n })(),\n ...awsModel.special_request_schema\n };\n \n // Create a Bedrock Runtime client in the AWS Region of your choice\n const client = new BedrockRuntimeClient({\n region: region,\n credentials: {\n accessKeyId: accessKeyId,\n secretAccessKey: secretAccessKey,\n },\n });\n\n if (logging) {\n console.log(\"\\nFinal request:\", JSON.stringify(request, null, 2));\n }\n\n // Check if model supports streaming, override stream parameter if not\n const modelSupportsStreaming = awsModel.streaming_supported !== false;\n const shouldStream = stream && modelSupportsStreaming;\n\n // Use Converse API if requested\n if (useConverseAPI) {\n // Convert messages to Converse API format\n const { messages: converseMessages, system: systemPrompts } = await convertToConverseFormat(messages, awsModel);\n \n // Build inference configuration\n const inferenceConfig = {\n maxTokens: max_gen_tokens,\n temperature: temperature,\n ...(top_p !== undefined && { topP: top_p })\n };\n \n // Add stop sequences if provided\n const stopSequencesValue = stop_sequences || stop;\n if (stopSequencesValue) {\n inferenceConfig.stopSequences = Array.isArray(stopSequencesValue) ? \n stopSequencesValue : [stopSequencesValue];\n }\n \n // Build the Converse API request\n const converseRequest = {\n modelId: awsModelId,\n messages: converseMessages,\n inferenceConfig: inferenceConfig\n };\n \n // Add system prompts if any\n if (systemPrompts.length > 0) {\n converseRequest.system = systemPrompts;\n }\n \n if (logging) {\n console.log(\"\\nConverse API request:\", JSON.stringify(converseRequest, null, 2));\n }\n \n if (shouldStream) {\n // Use ConverseStream for streaming responses\n const responseStream = await client.send(new ConverseStreamCommand(converseRequest));\n \n for await (const event of responseStream.stream) {\n if (event.contentBlockDelta) {\n const text = event.contentBlockDelta.delta?.text;\n if (text) {\n // Process reasoning tags for GPT-OSS models\n const processedText = processReasoningTags(text, awsModel);\n if (processedText) {\n yield processedText;\n }\n }\n }\n }\n } else {\n // Use Converse for non-streaming responses\n const response = await client.send(new ConverseCommand(converseRequest));\n \n if (logging) {\n console.log(\"\\nConverse API response:\", JSON.stringify(response, null, 2));\n }\n \n // Extract text from response\n if (response.output && response.output.message && response.output.message.content) {\n for (const contentBlock of response.output.message.content) {\n if (contentBlock.text) {\n // Process reasoning tags for GPT-OSS models\n const processedText = processReasoningTags(contentBlock.text, awsModel);\n if (processedText) {\n yield processedText;\n }\n }\n }\n }\n }\n return; // Exit early when using Converse API\n }\n\n // Original Invoke API logic continues below\n if (shouldStream) {\n const responseStream = await client.send(\n new InvokeModelWithResponseStreamCommand({\n contentType: \"application/json\",\n body: JSON.stringify(request),\n modelId: awsModelId,\n }),\n );\n let is_thinking = false;\n let should_think = awsModel.special_request_schema?.thinking?.type === \"enabled\";\n \n for await (const event of responseStream.body) {\n const chunk = JSON.parse(new TextDecoder().decode(event.chunk.bytes));\n let result;\n result = getValueByPath(chunk, awsModel.response_chunk_element);\n if (result) {\n if (should_think && is_thinking) {\n is_thinking = false;\n result = `</think>\\n\\n${result}`;\n }\n // Process reasoning tags for GPT-OSS models\n result = processReasoningTags(result, awsModel);\n yield result;\n } else {\n if (include_thinking_data && awsModel.thinking_response_chunk_element) {\n let result = getValueByPath(chunk, awsModel.thinking_response_chunk_element);\n if (result && should_think && !is_thinking) {\n is_thinking = true;\n result = `<think>${result}`;\n }\n if (result) {\n yield result;\n }\n } \n } \n }\n } else {\n const apiResponse = await client.send(\n new InvokeModelCommand({\n contentType: \"application/json\",\n body: JSON.stringify(request),\n modelId: awsModelId,\n }),\n );\n\n const decodedBodyResponse = JSON.parse(new TextDecoder().decode(apiResponse.body));\n let thinking_result;\n let text_result;\n\n if (awsModel.thinking_response_nonchunk_element) {\n thinking_result = getValueByPath(decodedBodyResponse, awsModel.thinking_response_nonchunk_element);\n }\n\n if (awsModel.response_nonchunk_element) {\n text_result = getValueByPath(decodedBodyResponse, awsModel.response_nonchunk_element);\n }\n if (!text_result) {\n if (awsModel.response_chunk_element) {\n text_result = getValueByPath(decodedBodyResponse, awsModel.response_chunk_element);\n }\n if (!text_result && awsModel.response_nonchunk_element) {\n // replace [0] with [1]\n awsModel.response_nonchunk_element = awsModel.response_nonchunk_element.replace('[0]', '[1]');\n text_result = getValueByPath(decodedBodyResponse, awsModel.response_nonchunk_element);\n }\n }\n\n // Handle case where stop sequences cause empty content array\n if (!text_result && decodedBodyResponse.stop_reason === \"stop_sequence\") {\n // If stopped by sequence but no content, return empty string instead of undefined\n text_result = \"\";\n }\n\n // Ensure text_result is a string to prevent 'undefined' from being part of the response\n if (text_result === null || text_result === undefined) {\n text_result = \"\";\n }\n\n // Process reasoning tags for GPT-OSS models\n text_result = processReasoningTags(text_result, awsModel);\n\n let result = thinking_result ? `<think>${thinking_result}</think>\\n\\n${text_result}` : text_result;\n \n // Ensure final result is a string, in case thinking_result was also empty\n if (result === null || result === undefined) {\n result = \"\";\n }\n yield result;\n } \n}",
|
|
897
|
-
"new_string": "export async function* bedrockWrapper(awsCreds, openaiChatCompletionsCreateObject, { logging = false, useConverseAPI = false } = {} ) {\n const { region, accessKeyId, secretAccessKey } = awsCreds;\n let { messages, model, max_tokens, stream, temperature, top_p, include_thinking_data, stop, stop_sequences } = openaiChatCompletionsCreateObject;\n\n let {awsModelId, awsModel} = findAwsModelWithId(model);\n \n // Create a Bedrock Runtime client \n const client = new BedrockRuntimeClient({\n region: region,\n credentials: {\n accessKeyId: accessKeyId,\n secretAccessKey: secretAccessKey,\n },\n });\n\n // Calculate max tokens (shared between both APIs)\n let max_gen_tokens = max_tokens <= awsModel.max_supported_response_tokens ? max_tokens : awsModel.max_supported_response_tokens;\n \n // Check if model supports streaming\n const modelSupportsStreaming = awsModel.streaming_supported !== false;\n const shouldStream = stream && modelSupportsStreaming;\n\n // ============================\n // CONVERSE API PATH (SIMPLIFIED)\n // ============================\n if (useConverseAPI) {\n // Convert messages to Converse API format (no model-specific complexity)\n const { messages: converseMessages, system: systemPrompts } = await convertToConverseFormat(messages);\n \n // Build simple inference configuration (no model-specific parameters)\n const inferenceConfig = {\n maxTokens: max_gen_tokens,\n temperature: temperature,\n ...(top_p !== undefined && { topP: top_p })\n };\n \n // Add stop sequences if provided (unified format)\n const stopSequencesValue = stop_sequences || stop;\n if (stopSequencesValue) {\n inferenceConfig.stopSequences = Array.isArray(stopSequencesValue) ? \n stopSequencesValue : [stopSequencesValue];\n }\n \n // Build the Converse API request (simple, unified format)\n const converseRequest = {\n modelId: awsModelId,\n messages: converseMessages,\n inferenceConfig: inferenceConfig\n };\n \n // Add system prompts if any\n if (systemPrompts.length > 0) {\n converseRequest.system = systemPrompts;\n }\n \n if (logging) {\n console.log(\"\\nConverse API request:\", JSON.stringify(converseRequest, null, 2));\n }\n \n if (shouldStream) {\n // Use ConverseStream for streaming responses\n const responseStream = await client.send(new ConverseStreamCommand(converseRequest));\n \n for await (const event of responseStream.stream) {\n if (event.contentBlockDelta) {\n const text = event.contentBlockDelta.delta?.text;\n if (text) {\n // Only process reasoning tags for GPT-OSS models (minimal model-specific logic)\n const processedText = processReasoningTags(text, awsModel);\n if (processedText) {\n yield processedText;\n }\n }\n }\n }\n } else {\n // Use Converse for non-streaming responses\n const response = await client.send(new ConverseCommand(converseRequest));\n \n if (logging) {\n console.log(\"\\nConverse API response:\", JSON.stringify(response, null, 2));\n }\n \n // Extract text from response (simple, unified response format)\n if (response.output && response.output.message && response.output.message.content) {\n for (const contentBlock of response.output.message.content) {\n if (contentBlock.text) {\n // Only process reasoning tags for GPT-OSS models (minimal model-specific logic)\n const processedText = processReasoningTags(contentBlock.text, awsModel);\n if (processedText) {\n yield processedText;\n }\n }\n }\n }\n }\n return; // Exit early when using Converse API\n }\n\n // ============================\n // INVOKE API PATH (COMPLEX, MODEL-SPECIFIC)\n // ============================\n \n // Process messages for Invoke API (complex, model-specific)\n const { message_cleaned, system_message } = await processMessagesForInvoke(messages, awsModel);\n \n // Build prompt for Invoke API (complex, model-specific)\n const prompt = buildInvokePrompt(message_cleaned, awsModel);\n \n if (logging) {\n console.log(\"\\nFinal formatted prompt:\", prompt);\n }\n\n // Handle thinking mode adjustments (Invoke API specific)\n if (awsModel.special_request_schema?.thinking?.type === \"enabled\") {\n // temperature may only be set to 1 when thinking is enabled\n temperature = 1;\n // top_p must be unset when thinking is enabled\n top_p = undefined;\n // budget_tokens can not be greater than 80% of max_gen_tokens\n let budget_tokens = awsModel.special_request_schema?.thinking?.budget_tokens;\n if (budget_tokens > (max_gen_tokens * 0.8)) {\n budget_tokens = Math.floor(max_gen_tokens * 0.8);\n }\n if (budget_tokens < 1024) {\n budget_tokens = 1024;\n }\n // if awsModel.special_request_schema?.thinking?.budget_tokens, set it to budget_tokens\n if (awsModel.special_request_schema?.thinking?.budget_tokens) {\n awsModel.special_request_schema.thinking.budget_tokens = budget_tokens;\n // max_gen_tokens has to be greater than budget_tokens\n if (max_gen_tokens <= budget_tokens) {\n // make max_gen_tokens 20% greater than budget_tokens\n max_gen_tokens = Math.floor(budget_tokens * 1.2);\n }\n }\n }\n \n // Build request for Invoke API (complex, model-specific)\n const request = buildInvokeRequest(prompt, awsModel, max_gen_tokens, temperature, top_p, stop_sequences, stop, system_message);\n \n if (logging) {\n console.log(\"\\nFinal request:\", JSON.stringify(request, null, 2));\n }\n \n // Execute Invoke API call (complex, model-specific response parsing)\n yield* executeInvokeAPI(client, request, awsModelId, shouldStream, awsModel, include_thinking_data);\n}"
|
|
898
|
-
}
|
|
899
|
-
},
|
|
900
|
-
{
|
|
901
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
902
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
903
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
904
|
-
"hook_event_name": "PreToolUse",
|
|
905
|
-
"tool_name": "Bash",
|
|
906
|
-
"tool_input": {
|
|
907
|
-
"command": "node test-simple-converse.js",
|
|
908
|
-
"timeout": 15000,
|
|
909
|
-
"description": "Testing refactored code with simple test"
|
|
910
|
-
}
|
|
911
|
-
},
|
|
912
|
-
{
|
|
913
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
914
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
915
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
916
|
-
"hook_event_name": "PreToolUse",
|
|
917
|
-
"tool_name": "Write",
|
|
918
|
-
"tool_input": {
|
|
919
|
-
"file_path": "C:\\git\\bedrock-wrapper\\test-refactored.js",
|
|
920
|
-
"content": "// Test refactored code to ensure both APIs work\nimport dotenv from 'dotenv';\nimport { bedrockWrapper } from \"./bedrock-wrapper.js\";\n\ndotenv.config();\n\nconst AWS_REGION = process.env.AWS_REGION;\nconst AWS_ACCESS_KEY_ID = process.env.AWS_ACCESS_KEY_ID;\nconst AWS_SECRET_ACCESS_KEY = process.env.AWS_SECRET_ACCESS_KEY;\n\nasync function testBothAPIs() {\n const awsCreds = {\n region: AWS_REGION,\n accessKeyId: AWS_ACCESS_KEY_ID,\n secretAccessKey: AWS_SECRET_ACCESS_KEY,\n };\n\n const messages = [\n { role: \"user\", content: \"What is 2+2? Answer in one word.\" }\n ];\n\n const openaiChatCompletionsCreateObject = {\n messages,\n model: \"Claude-3-Haiku\", \n max_tokens: 50,\n stream: false,\n temperature: 0.1,\n top_p: 0.9,\n };\n\n console.log(\"\u00f0\u0178\u00a7\u00aa Testing refactored code...\\n\");\n\n // Test 1: Invoke API (should still work)\n console.log(\"1\u00ef\u00b8\udc8f\u00e2\u0192\u00a3 Testing Invoke API...\");\n let invokeResponse = \"\";\n try {\n const response = await bedrockWrapper(awsCreds, openaiChatCompletionsCreateObject, { \n logging: false, \n useConverseAPI: false \n });\n for await (const data of response) {\n invokeResponse += data;\n }\n console.log(\"\u00e2\u0153\u2026 Invoke API Response:\", invokeResponse);\n } catch (error) {\n console.log(\"\u00e2\udc9d\u0152 Invoke API Error:\", error.message);\n }\n\n // Test 2: Converse API (should work with simplified path)\n console.log(\"\\n2\u00ef\u00b8\udc8f\u00e2\u0192\u00a3 Testing Converse API...\");\n let converseResponse = \"\";\n try {\n const response = await bedrockWrapper(awsCreds, openaiChatCompletionsCreateObject, { \n logging: false, \n useConverseAPI: true \n });\n for await (const data of response) {\n converseResponse += data;\n }\n console.log(\"\u00e2\u0153\u2026 Converse API Response:\", converseResponse);\n } catch (error) {\n console.log(\"\u00e2\udc9d\u0152 Converse API Error:\", error.message);\n }\n\n // Test 3: System prompt with Converse API\n console.log(\"\\n3\u00ef\u00b8\udc8f\u00e2\u0192\u00a3 Testing system prompt with Converse API...\");\n const systemMessages = [\n { role: \"system\", content: \"You are a mathematician. Always show your work.\" },\n { role: \"user\", content: \"What is 5 * 7?\" }\n ];\n\n const systemTest = {\n messages: systemMessages,\n model: \"Claude-3-Haiku\",\n max_tokens: 100,\n stream: false,\n temperature: 0.1,\n top_p: 0.9,\n };\n\n let systemResponse = \"\";\n try {\n const response = await bedrockWrapper(awsCreds, systemTest, { \n logging: false, \n useConverseAPI: true \n });\n for await (const data of response) {\n systemResponse += data;\n }\n console.log(\"\u00e2\u0153\u2026 System prompt response:\", systemResponse.substring(0, 100) + \"...\");\n } catch (error) {\n console.log(\"\u00e2\udc9d\u0152 System prompt error:\", error.message);\n }\n\n // Test 4: Nova model (special schema handling)\n console.log(\"\\n4\u00ef\u00b8\udc8f\u00e2\u0192\u00a3 Testing Nova model with Converse API...\");\n const novaTest = {\n messages: [{ role: \"user\", content: \"Hello, what's your name?\" }],\n model: \"Nova-Micro\",\n max_tokens: 50,\n stream: false,\n temperature: 0.1,\n top_p: 0.9,\n };\n\n let novaResponse = \"\";\n try {\n const response = await bedrockWrapper(awsCreds, novaTest, { \n logging: false, \n useConverseAPI: true \n });\n for await (const data of response) {\n novaResponse += data;\n }\n console.log(\"\u00e2\u0153\u2026 Nova response:\", novaResponse.substring(0, 100) + \"...\");\n } catch (error) {\n console.log(\"\u00e2\udc9d\u0152 Nova error:\", error.message);\n }\n\n console.log(\"\\n\u00e2\u0153\u00a8 Refactoring test complete!\");\n}\n\ntestBothAPIs().catch(console.error);"
|
|
921
|
-
}
|
|
922
|
-
},
|
|
923
|
-
{
|
|
924
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
925
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
926
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
927
|
-
"hook_event_name": "PreToolUse",
|
|
928
|
-
"tool_name": "TodoWrite",
|
|
929
|
-
"tool_input": {
|
|
930
|
-
"todos": [
|
|
931
|
-
{
|
|
932
|
-
"content": "Research AWS Bedrock Converse API documentation",
|
|
933
|
-
"status": "completed",
|
|
934
|
-
"id": "1"
|
|
935
|
-
},
|
|
936
|
-
{
|
|
937
|
-
"content": "Understand current codebase structure and invoke API implementation",
|
|
938
|
-
"status": "completed",
|
|
939
|
-
"id": "2"
|
|
940
|
-
},
|
|
941
|
-
{
|
|
942
|
-
"content": "Design Converse API integration approach",
|
|
943
|
-
"status": "completed",
|
|
944
|
-
"id": "3"
|
|
945
|
-
},
|
|
946
|
-
{
|
|
947
|
-
"content": "Write tests for Converse API functionality (TDD)",
|
|
948
|
-
"status": "completed",
|
|
949
|
-
"id": "4"
|
|
950
|
-
},
|
|
951
|
-
{
|
|
952
|
-
"content": "Implement Converse API support in bedrock-wrapper.js",
|
|
953
|
-
"status": "completed",
|
|
954
|
-
"id": "5"
|
|
955
|
-
},
|
|
956
|
-
{
|
|
957
|
-
"content": "Update existing tests to handle both APIs",
|
|
958
|
-
"status": "completed",
|
|
959
|
-
"id": "6"
|
|
960
|
-
},
|
|
961
|
-
{
|
|
962
|
-
"content": "Test all models with both invoke and converse APIs",
|
|
963
|
-
"status": "completed",
|
|
964
|
-
"id": "7"
|
|
965
|
-
},
|
|
966
|
-
{
|
|
967
|
-
"content": "Refactor bedrockWrapper function to separate Invoke API complexities",
|
|
968
|
-
"status": "in_progress",
|
|
969
|
-
"id": "8"
|
|
970
|
-
}
|
|
971
|
-
]
|
|
972
|
-
}
|
|
973
|
-
},
|
|
974
|
-
{
|
|
975
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
976
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
977
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
978
|
-
"hook_event_name": "PreToolUse",
|
|
979
|
-
"tool_name": "Bash",
|
|
980
|
-
"tool_input": {
|
|
981
|
-
"command": "node test-refactored.js",
|
|
982
|
-
"timeout": 20000,
|
|
983
|
-
"description": "Testing refactored code"
|
|
984
|
-
}
|
|
985
|
-
},
|
|
986
|
-
{
|
|
987
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
988
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
989
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
990
|
-
"hook_event_name": "PreToolUse",
|
|
991
|
-
"tool_name": "Write",
|
|
992
|
-
"tool_input": {
|
|
993
|
-
"file_path": "C:\\git\\bedrock-wrapper\\test-streaming-refactored.js",
|
|
994
|
-
"content": "// Test streaming with refactored code\nimport dotenv from 'dotenv';\nimport { bedrockWrapper } from \"./bedrock-wrapper.js\";\n\ndotenv.config();\n\nconst AWS_REGION = process.env.AWS_REGION;\nconst AWS_ACCESS_KEY_ID = process.env.AWS_ACCESS_KEY_ID;\nconst AWS_SECRET_ACCESS_KEY = process.env.AWS_SECRET_ACCESS_KEY;\n\nasync function testStreaming() {\n const awsCreds = {\n region: AWS_REGION,\n accessKeyId: AWS_ACCESS_KEY_ID,\n secretAccessKey: AWS_SECRET_ACCESS_KEY,\n };\n\n const messages = [\n { role: \"user\", content: \"Count from 1 to 5.\" }\n ];\n\n const openaiChatCompletionsCreateObject = {\n messages,\n model: \"Claude-3-Haiku\", \n max_tokens: 100,\n stream: true, // Enable streaming\n temperature: 0.1,\n top_p: 0.9,\n };\n\n console.log(\"\u00f0\u0178\u00a7\u00aa Testing streaming with refactored code...\\n\");\n\n // Test 1: Streaming with Invoke API\n console.log(\"1\u00ef\u00b8\udc8f\u00e2\u0192\u00a3 Streaming Invoke API:\");\n try {\n for await (const chunk of bedrockWrapper(awsCreds, openaiChatCompletionsCreateObject, { \n logging: false, \n useConverseAPI: false \n })) {\n process.stdout.write(chunk);\n }\n console.log(\"\\n\u00e2\u0153\u2026 Invoke API streaming works!\");\n } catch (error) {\n console.log(\"\\n\u00e2\udc9d\u0152 Invoke API streaming error:\", error.message);\n }\n\n // Test 2: Streaming with Converse API\n console.log(\"\\n2\u00ef\u00b8\udc8f\u00e2\u0192\u00a3 Streaming Converse API:\");\n try {\n for await (const chunk of bedrockWrapper(awsCreds, openaiChatCompletionsCreateObject, { \n logging: false, \n useConverseAPI: true \n })) {\n process.stdout.write(chunk);\n }\n console.log(\"\\n\u00e2\u0153\u2026 Converse API streaming works!\");\n } catch (error) {\n console.log(\"\\n\u00e2\udc9d\u0152 Converse API streaming error:\", error.message);\n }\n\n console.log(\"\\n\u00e2\u0153\u00a8 Streaming test complete!\");\n}\n\ntestStreaming().catch(console.error);"
|
|
995
|
-
}
|
|
996
|
-
},
|
|
997
|
-
{
|
|
998
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
999
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
1000
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
1001
|
-
"hook_event_name": "PreToolUse",
|
|
1002
|
-
"tool_name": "Bash",
|
|
1003
|
-
"tool_input": {
|
|
1004
|
-
"command": "node test-streaming-refactored.js",
|
|
1005
|
-
"timeout": 15000,
|
|
1006
|
-
"description": "Testing streaming with refactored code"
|
|
1007
|
-
}
|
|
1008
|
-
},
|
|
1009
|
-
{
|
|
1010
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
1011
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
1012
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
1013
|
-
"hook_event_name": "PreToolUse",
|
|
1014
|
-
"tool_name": "Bash",
|
|
1015
|
-
"tool_input": {
|
|
1016
|
-
"command": "rm test-refactored.js test-streaming-refactored.js",
|
|
1017
|
-
"description": "Cleaning up temporary test files"
|
|
1018
|
-
}
|
|
1019
|
-
},
|
|
1020
|
-
{
|
|
1021
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
1022
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
1023
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
1024
|
-
"hook_event_name": "PreToolUse",
|
|
1025
|
-
"tool_name": "TodoWrite",
|
|
1026
|
-
"tool_input": {
|
|
1027
|
-
"todos": [
|
|
1028
|
-
{
|
|
1029
|
-
"content": "Research AWS Bedrock Converse API documentation",
|
|
1030
|
-
"status": "completed",
|
|
1031
|
-
"id": "1"
|
|
1032
|
-
},
|
|
1033
|
-
{
|
|
1034
|
-
"content": "Understand current codebase structure and invoke API implementation",
|
|
1035
|
-
"status": "completed",
|
|
1036
|
-
"id": "2"
|
|
1037
|
-
},
|
|
1038
|
-
{
|
|
1039
|
-
"content": "Design Converse API integration approach",
|
|
1040
|
-
"status": "completed",
|
|
1041
|
-
"id": "3"
|
|
1042
|
-
},
|
|
1043
|
-
{
|
|
1044
|
-
"content": "Write tests for Converse API functionality (TDD)",
|
|
1045
|
-
"status": "completed",
|
|
1046
|
-
"id": "4"
|
|
1047
|
-
},
|
|
1048
|
-
{
|
|
1049
|
-
"content": "Implement Converse API support in bedrock-wrapper.js",
|
|
1050
|
-
"status": "completed",
|
|
1051
|
-
"id": "5"
|
|
1052
|
-
},
|
|
1053
|
-
{
|
|
1054
|
-
"content": "Update existing tests to handle both APIs",
|
|
1055
|
-
"status": "completed",
|
|
1056
|
-
"id": "6"
|
|
1057
|
-
},
|
|
1058
|
-
{
|
|
1059
|
-
"content": "Test all models with both invoke and converse APIs",
|
|
1060
|
-
"status": "completed",
|
|
1061
|
-
"id": "7"
|
|
1062
|
-
},
|
|
1063
|
-
{
|
|
1064
|
-
"content": "Refactor bedrockWrapper function to separate Invoke API complexities",
|
|
1065
|
-
"status": "completed",
|
|
1066
|
-
"id": "8"
|
|
1067
|
-
}
|
|
1068
|
-
]
|
|
1069
|
-
}
|
|
1070
|
-
},
|
|
1071
|
-
{
|
|
1072
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
1073
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
1074
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
1075
|
-
"hook_event_name": "PreToolUse",
|
|
1076
|
-
"tool_name": "Edit",
|
|
1077
|
-
"tool_input": {
|
|
1078
|
-
"file_path": "C:\\git\\bedrock-wrapper\\interactive-example.js",
|
|
1079
|
-
"old_string": "// Ask for streaming preference\nconst shouldStream = await new Promise((resolve) => {\n rl.question('\\nDo you want streamed responses? (Y/n): ', (answer) => {\n resolve(answer.toLowerCase() !== 'n');\n });\n});\n\nconsole.log(`\\nUsing model: ${selectedModel}`);\nconsole.log(`Streaming: ${shouldStream ? 'enabled' : 'disabled'}\\n`);",
|
|
1080
|
-
"new_string": "// Ask for streaming preference\nconst shouldStream = await new Promise((resolve) => {\n rl.question('\\nDo you want streamed responses? (Y/n): ', (answer) => {\n resolve(answer.toLowerCase() !== 'n');\n });\n});\n\n// Ask for API preference\nconst useConverseAPI = await new Promise((resolve) => {\n rl.question('\\nUse Converse API instead of Invoke API? (Y/n): ', (answer) => {\n resolve(answer.toLowerCase() !== 'n');\n });\n});\n\nconsole.log(`\\nUsing model: ${selectedModel}`);\nconsole.log(`Streaming: ${shouldStream ? 'enabled' : 'disabled'}`);\nconsole.log(`API: ${useConverseAPI ? 'Converse API' : 'Invoke API'}\\n`);"
|
|
1081
|
-
}
|
|
1082
|
-
},
|
|
1083
|
-
{
|
|
1084
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
1085
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
1086
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
1087
|
-
"hook_event_name": "PreToolUse",
|
|
1088
|
-
"tool_name": "Edit",
|
|
1089
|
-
"tool_input": {
|
|
1090
|
-
"file_path": "C:\\git\\bedrock-wrapper\\interactive-example.js",
|
|
1091
|
-
"old_string": "// streamed call\nif (openaiChatCompletionsCreateObject.stream) {\n for await (const chunk of bedrockWrapper(awsCreds, openaiChatCompletionsCreateObject, { logging:true })) {\n completeResponse += chunk;\n // ---------------------------------------------------\n // -- each chunk is streamed as it is received here --\n // ---------------------------------------------------\n process.stdout.write(chunk); // \u00e2\u2021\u00a0 do stuff with the streamed chunk\n }\n} else { // unstreamed call\n const response = await bedrockWrapper(awsCreds, openaiChatCompletionsCreateObject, { logging:true });\n for await (const data of response) {\n completeResponse += data;\n }\n // ----------------------------------------------------\n // -- unstreamed complete response is available here --\n // ----------------------------------------------------\n console.log(`\\n\\completeResponse:\\n${completeResponse}\\n`); // \u00e2\u2021\u00a0 do stuff with the complete response\n}",
|
|
1092
|
-
"new_string": "// streamed call\nif (openaiChatCompletionsCreateObject.stream) {\n for await (const chunk of bedrockWrapper(awsCreds, openaiChatCompletionsCreateObject, { logging:true, useConverseAPI })) {\n completeResponse += chunk;\n // ---------------------------------------------------\n // -- each chunk is streamed as it is received here --\n // ---------------------------------------------------\n process.stdout.write(chunk); // \u00e2\u2021\u00a0 do stuff with the streamed chunk\n }\n} else { // unstreamed call\n const response = await bedrockWrapper(awsCreds, openaiChatCompletionsCreateObject, { logging:true, useConverseAPI });\n for await (const data of response) {\n completeResponse += data;\n }\n // ----------------------------------------------------\n // -- unstreamed complete response is available here --\n // ----------------------------------------------------\n console.log(`\\n\\completeResponse:\\n${completeResponse}\\n`); // \u00e2\u2021\u00a0 do stuff with the complete response\n}"
|
|
1093
|
-
}
|
|
1094
|
-
},
|
|
1095
|
-
{
|
|
1096
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
1097
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
1098
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
1099
|
-
"hook_event_name": "PreToolUse",
|
|
1100
|
-
"tool_name": "Bash",
|
|
1101
|
-
"tool_input": {
|
|
1102
|
-
"command": "echo -e \"1\\nY\\nY\\nWhat is 2+2?\" | npm run interactive",
|
|
1103
|
-
"timeout": 15000,
|
|
1104
|
-
"description": "Testing updated interactive example with Converse API"
|
|
1105
|
-
}
|
|
1106
|
-
},
|
|
1107
|
-
{
|
|
1108
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
1109
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
1110
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
1111
|
-
"hook_event_name": "PreToolUse",
|
|
1112
|
-
"tool_name": "Write",
|
|
1113
|
-
"tool_input": {
|
|
1114
|
-
"file_path": "C:\\git\\bedrock-wrapper\\test-interactive-update.js",
|
|
1115
|
-
"content": "// Test the updated interactive example functionality\nimport dotenv from 'dotenv';\nimport { bedrockWrapper } from \"./bedrock-wrapper.js\";\n\ndotenv.config();\n\nconst AWS_REGION = process.env.AWS_REGION;\nconst AWS_ACCESS_KEY_ID = process.env.AWS_ACCESS_KEY_ID;\nconst AWS_SECRET_ACCESS_KEY = process.env.AWS_SECRET_ACCESS_KEY;\n\n// Simulate the interactive example choices\nconst selectedModel = \"Claude-3-Haiku\";\nconst shouldStream = true;\nconst useConverseAPI = true; // This is the new option\n\nconsole.log(`Using model: ${selectedModel}`);\nconsole.log(`Streaming: ${shouldStream ? 'enabled' : 'disabled'}`);\nconsole.log(`API: ${useConverseAPI ? 'Converse API' : 'Invoke API'}\\n`);\n\nconst messages = [\n {\n role: \"system\",\n content: \"You are a helpful AI assistant that follows instructions extremely well. Answer the user questions accurately. Think step by step before answering the question.\",\n },\n {\n role: \"user\",\n content: \"What is the capital of Japan? Answer in one sentence.\",\n },\n {\n role: \"assistant\",\n content: \"\",\n },\n];\n\nconst awsCreds = {\n region: AWS_REGION,\n accessKeyId: AWS_ACCESS_KEY_ID,\n secretAccessKey: AWS_SECRET_ACCESS_KEY,\n};\n\nconst openaiChatCompletionsCreateObject = {\n \"messages\": messages,\n \"model\": selectedModel,\n \"max_tokens\": 100,\n \"stream\": shouldStream,\n \"temperature\": 0.1,\n \"top_p\": 0.9,\n \"include_thinking_data\": true,\n};\n\nconsole.log(\"\u00f0\u0178\u00a7\u00aa Testing updated interactive example logic...\\n\");\nconsole.log(\"Response:\");\nconsole.log(\"-\".repeat(40));\n\nlet completeResponse = \"\";\n\n// Use the same logic as the updated interactive example\nif (openaiChatCompletionsCreateObject.stream) {\n for await (const chunk of bedrockWrapper(awsCreds, openaiChatCompletionsCreateObject, { logging: false, useConverseAPI })) {\n completeResponse += chunk;\n process.stdout.write(chunk);\n }\n} else {\n const response = await bedrockWrapper(awsCreds, openaiChatCompletionsCreateObject, { logging: false, useConverseAPI });\n for await (const data of response) {\n completeResponse += data;\n }\n console.log(`\\n\\nCompleteResponse:\\n${completeResponse}\\n`);\n}\n\nconsole.log(\"\\n\" + \"-\".repeat(40));\nconsole.log(\"\u00e2\u0153\u2026 Interactive example update works correctly!\");"
|
|
1116
|
-
}
|
|
1117
|
-
},
|
|
1118
|
-
{
|
|
1119
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
1120
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
1121
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
1122
|
-
"hook_event_name": "PreToolUse",
|
|
1123
|
-
"tool_name": "Bash",
|
|
1124
|
-
"tool_input": {
|
|
1125
|
-
"command": "node test-interactive-update.js",
|
|
1126
|
-
"timeout": 10000,
|
|
1127
|
-
"description": "Testing the updated interactive example logic"
|
|
1128
|
-
}
|
|
1129
|
-
},
|
|
1130
|
-
{
|
|
1131
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
1132
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
1133
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
1134
|
-
"hook_event_name": "PreToolUse",
|
|
1135
|
-
"tool_name": "Edit",
|
|
1136
|
-
"tool_input": {
|
|
1137
|
-
"file_path": "C:\\git\\bedrock-wrapper\\bedrock-wrapper.js",
|
|
1138
|
-
"old_string": " if (content.length > 0) {\n converseMessages.push({\n role: msg.role,\n content: content\n });\n }",
|
|
1139
|
-
"new_string": " // Only add messages with actual content (Converse API doesn't allow empty content)\n if (content.length > 0 && content.some(item => item.text && item.text.trim() !== '')) {\n converseMessages.push({\n role: msg.role,\n content: content\n });\n }"
|
|
1140
|
-
}
|
|
1141
|
-
},
|
|
1142
|
-
{
|
|
1143
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
1144
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
1145
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
1146
|
-
"hook_event_name": "PreToolUse",
|
|
1147
|
-
"tool_name": "Edit",
|
|
1148
|
-
"tool_input": {
|
|
1149
|
-
"file_path": "C:\\git\\bedrock-wrapper\\test-interactive-update.js",
|
|
1150
|
-
"old_string": "const messages = [\n {\n role: \"system\",\n content: \"You are a helpful AI assistant that follows instructions extremely well. Answer the user questions accurately. Think step by step before answering the question.\",\n },\n {\n role: \"user\",\n content: \"What is the capital of Japan? Answer in one sentence.\",\n },\n {\n role: \"assistant\",\n content: \"\",\n },\n];",
|
|
1151
|
-
"new_string": "const messages = [\n {\n role: \"system\",\n content: \"You are a helpful AI assistant that follows instructions extremely well. Answer the user questions accurately. Think step by step before answering the question.\",\n },\n {\n role: \"user\",\n content: \"What is the capital of Japan? Answer in one sentence.\",\n },\n];"
|
|
1152
|
-
}
|
|
1153
|
-
},
|
|
1154
|
-
{
|
|
1155
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
1156
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
1157
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
1158
|
-
"hook_event_name": "PreToolUse",
|
|
1159
|
-
"tool_name": "Bash",
|
|
1160
|
-
"tool_input": {
|
|
1161
|
-
"command": "node test-interactive-update.js",
|
|
1162
|
-
"timeout": 10000,
|
|
1163
|
-
"description": "Testing the updated interactive example logic again"
|
|
1164
|
-
}
|
|
1165
|
-
},
|
|
1166
|
-
{
|
|
1167
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
1168
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
1169
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
1170
|
-
"hook_event_name": "PreToolUse",
|
|
1171
|
-
"tool_name": "Edit",
|
|
1172
|
-
"tool_input": {
|
|
1173
|
-
"file_path": "C:\\git\\bedrock-wrapper\\interactive-example.js",
|
|
1174
|
-
"old_string": "// -----------------------------------------------\n// -- example prompt in `messages` array format --\n// -----------------------------------------------\nconst messages = [\n {\n role: \"system\",\n content: \"You are a helpful AI assistant that follows instructions extremely well. Answer the user questions accurately. Think step by step before answering the question.\",\n },\n {\n role: \"user\",\n content: userPrompt,\n },\n {\n role: \"assistant\",\n content: \"\",\n },\n];",
|
|
1175
|
-
"new_string": "// -----------------------------------------------\n// -- example prompt in `messages` array format --\n// -----------------------------------------------\nconst messages = [\n {\n role: \"system\",\n content: \"You are a helpful AI assistant that follows instructions extremely well. Answer the user questions accurately. Think step by step before answering the question.\",\n },\n {\n role: \"user\",\n content: userPrompt,\n },\n];\n\n// Only add empty assistant message for Invoke API (Converse API handles this automatically)\nif (!useConverseAPI) {\n messages.push({\n role: \"assistant\",\n content: \"\",\n });\n}"
|
|
1176
|
-
}
|
|
1177
|
-
},
|
|
1178
|
-
{
|
|
1179
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
1180
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
1181
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
1182
|
-
"hook_event_name": "PreToolUse",
|
|
1183
|
-
"tool_name": "Bash",
|
|
1184
|
-
"tool_input": {
|
|
1185
|
-
"command": "rm test-interactive-update.js",
|
|
1186
|
-
"description": "Cleaning up temporary test file"
|
|
1187
|
-
}
|
|
1188
|
-
},
|
|
1189
|
-
{
|
|
1190
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
1191
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
1192
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
1193
|
-
"hook_event_name": "PreToolUse",
|
|
1194
|
-
"tool_name": "Write",
|
|
1195
|
-
"tool_input": {
|
|
1196
|
-
"file_path": "C:\\git\\bedrock-wrapper\\test-final-interactive.js",
|
|
1197
|
-
"content": "// Final test to verify interactive example logic works for both APIs\nimport dotenv from 'dotenv';\nimport { bedrockWrapper } from \"./bedrock-wrapper.js\";\n\ndotenv.config();\n\nconst AWS_REGION = process.env.AWS_REGION;\nconst AWS_ACCESS_KEY_ID = process.env.AWS_ACCESS_KEY_ID;\nconst AWS_SECRET_ACCESS_KEY = process.env.AWS_SECRET_ACCESS_KEY;\n\nasync function testBothAPIsInteractiveStyle() {\n const awsCreds = {\n region: AWS_REGION,\n accessKeyId: AWS_ACCESS_KEY_ID,\n secretAccessKey: AWS_SECRET_ACCESS_KEY,\n };\n\n const userPrompt = \"What is the capital of France? Answer in one word.\";\n \n console.log(\"\u00f0\u0178\u00a7\u00aa Testing both APIs with interactive example logic...\\n\");\n\n // Test both APIs\n for (const [apiName, useConverseAPI] of [[\"Invoke API\", false], [\"Converse API\", true]]) {\n console.log(`\u00f0\u0178\u201c\u00a1 Testing ${apiName}:`);\n \n // Build messages like the interactive example\n const messages = [\n {\n role: \"system\",\n content: \"You are a helpful AI assistant that follows instructions extremely well. Answer the user questions accurately. Think step by step before answering the question.\",\n },\n {\n role: \"user\",\n content: userPrompt,\n },\n ];\n\n // Only add empty assistant message for Invoke API (like in updated interactive example)\n if (!useConverseAPI) {\n messages.push({\n role: \"assistant\",\n content: \"\",\n });\n }\n\n const openaiChatCompletionsCreateObject = {\n \"messages\": messages,\n \"model\": \"Claude-3-Haiku\",\n \"max_tokens\": 50,\n \"stream\": false,\n \"temperature\": 0.1,\n \"top_p\": 0.9,\n \"include_thinking_data\": true,\n };\n\n try {\n let completeResponse = \"\";\n \n // Use the same logic as interactive example\n if (openaiChatCompletionsCreateObject.stream) {\n for await (const chunk of bedrockWrapper(awsCreds, openaiChatCompletionsCreateObject, { logging: false, useConverseAPI })) {\n completeResponse += chunk;\n process.stdout.write(chunk);\n }\n } else {\n const response = await bedrockWrapper(awsCreds, openaiChatCompletionsCreateObject, { logging: false, useConverseAPI });\n for await (const data of response) {\n completeResponse += data;\n }\n console.log(` Response: ${completeResponse}`);\n }\n \n console.log(` \u00e2\u0153\u2026 ${apiName} works correctly\\n`);\n } catch (error) {\n console.log(` \u00e2\udc9d\u0152 ${apiName} error: ${error.message}\\n`);\n }\n }\n\n console.log(\"\u00e2\u0153\u00a8 Interactive example update verification complete!\");\n}\n\ntestBothAPIsInteractiveStyle().catch(console.error);"
|
|
1198
|
-
}
|
|
1199
|
-
},
|
|
1200
|
-
{
|
|
1201
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
1202
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
1203
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
1204
|
-
"hook_event_name": "PreToolUse",
|
|
1205
|
-
"tool_name": "Bash",
|
|
1206
|
-
"tool_input": {
|
|
1207
|
-
"command": "node test-final-interactive.js",
|
|
1208
|
-
"timeout": 15000,
|
|
1209
|
-
"description": "Final test of interactive example logic for both APIs"
|
|
1210
|
-
}
|
|
1211
|
-
},
|
|
1212
|
-
{
|
|
1213
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
1214
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
1215
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
1216
|
-
"hook_event_name": "PreToolUse",
|
|
1217
|
-
"tool_name": "Bash",
|
|
1218
|
-
"tool_input": {
|
|
1219
|
-
"command": "rm test-final-interactive.js",
|
|
1220
|
-
"description": "Cleaning up final test file"
|
|
1221
|
-
}
|
|
1222
|
-
},
|
|
1223
|
-
{
|
|
1224
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
1225
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
1226
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
1227
|
-
"hook_event_name": "PreToolUse",
|
|
1228
|
-
"tool_name": "MultiEdit",
|
|
1229
|
-
"tool_input": {
|
|
1230
|
-
"file_path": "C:\\git\\bedrock-wrapper\\test-vision.js",
|
|
1231
|
-
"edits": [
|
|
1232
|
-
{
|
|
1233
|
-
"old_string": "async function testVisionCapabilities() {\n // Read and convert image to base64\n const imageBuffer = await fs.readFile('./test-image.jpg');\n const base64Image = imageBuffer.toString('base64');\n \n const testPrompt = \"What's in this image? Please describe it in detail.\";\n\n const messages = [\n {\n role: \"user\",\n content: [\n {\n type: \"text\",\n text: testPrompt\n },\n {\n type: \"image_url\",\n image_url: {\n url: `data:image/jpeg;base64,${base64Image}`\n // url: \"https://github.com/jparkerweb/ref/blob/main/equill-labs/bedrock-proxy-endpoint/bedrock-proxy-endpoint.png?raw=true\"\n }\n }\n ]\n }\n ];\n\n // Filter vision-capable models from bedrock_models\n const visionModels = bedrock_models\n .filter(model => model.vision === true)\n .map(model => model.modelName);\n\n // Clear output file and add header\n await fs.writeFile('test-vision-models-output.txt', \n `Vision Test Results\\n` +\n `Test Question: \"${testPrompt}\"\\n` +\n `Test Date: ${new Date().toISOString()}\\n` +\n `${'='.repeat(50)}\\n\\n`\n );\n\n console.clear();\n await logOutput(`Starting vision tests with ${visionModels.length} models...`, 'info');\n await logOutput(`Testing image description capabilities\\n`, 'info');\n\n for (const model of visionModels) {\n await logOutput(`\\n${'-'.repeat(50)}\\nTesting ${model} \u00e2\u2021\u00a2`, 'running');\n \n const openaiChatCompletionsCreateObject = {\n messages,\n model,\n max_tokens: 1000,\n stream: true,\n temperature: 0.7\n };\n\n try {\n console.log(`\\nSending request to ${model}...`);\n \n let response = \"\";\n for await (const chunk of bedrockWrapper(awsCreds, openaiChatCompletionsCreateObject, { logging: false })) {\n response += chunk;\n process.stdout.write(chunk);\n }\n \n // Write successful response to file\n await logOutput(`\\nModel: ${model}`, 'success');\n await logOutput(`Response: ${response.trim()}\\n`, 'info', true);\n \n } catch (error) {\n const errorMessage = `Error with ${model}: ${error.message}`;\n await logOutput(errorMessage, 'error');\n \n // Log the full error details to file\n if (error.response) {\n await fs.appendFile('test-vision-models-output.txt', \n `Error details: ${JSON.stringify(error.response, null, 2)}\\n\\n`\n );\n }\n }\n \n console.log(\"\\n-------------------\");\n }\n \n await logOutput('\\nVision testing complete! Check test-vision-models-output.txt for full results.', 'info', false);\n}",
|
|
1234
|
-
"new_string": "async function testVisionModel(model, messages, useConverseAPI, apiName) {\n const openaiChatCompletionsCreateObject = {\n messages,\n model,\n max_tokens: 1000,\n stream: true,\n temperature: 0.7\n };\n\n try {\n console.log(`\\nSending request to ${model} using ${apiName}...`);\n \n let response = \"\";\n for await (const chunk of bedrockWrapper(awsCreds, openaiChatCompletionsCreateObject, { logging: false, useConverseAPI })) {\n response += chunk;\n process.stdout.write(chunk);\n }\n \n return { success: true, response: response.trim() };\n \n } catch (error) {\n return { success: false, error: error.message };\n }\n}\n\nasync function testVisionCapabilities() {\n // Check for command-line arguments\n const args = process.argv.slice(2);\n const testBothAPIs = args.includes('--both') || args.includes('--compare');\n const useConverseOnly = args.includes('--converse');\n \n // Read and convert image to base64\n const imageBuffer = await fs.readFile('./test-image.jpg');\n const base64Image = imageBuffer.toString('base64');\n \n const testPrompt = \"What's in this image? Please describe it in detail.\";\n\n const messages = [\n {\n role: \"user\",\n content: [\n {\n type: \"text\",\n text: testPrompt\n },\n {\n type: \"image_url\",\n image_url: {\n url: `data:image/jpeg;base64,${base64Image}`\n // url: \"https://github.com/jparkerweb/ref/blob/main/equill-labs/bedrock-proxy-endpoint/bedrock-proxy-endpoint.png?raw=true\"\n }\n }\n ]\n }\n ];\n\n // Filter vision-capable models from bedrock_models\n const visionModels = bedrock_models\n .filter(model => model.vision === true)\n .map(model => model.modelName);\n\n // Determine test mode\n let testMode = \"Invoke API\";\n if (useConverseOnly) testMode = \"Converse API\";\n if (testBothAPIs) testMode = \"Both APIs (Comparison)\";\n\n // Clear output file and add header\n await fs.writeFile('test-vision-models-output.txt', \n `Vision Test Results - ${testMode}\\n` +\n `Test Question: \"${testPrompt}\"\\n` +\n `Test Date: ${new Date().toISOString()}\\n` +\n `${'='.repeat(60)}\\n\\n`\n );\n\n console.clear();\n await logOutput(`Starting vision tests with ${visionModels.length} models using ${testMode}...`, 'info');\n await logOutput(`Testing image description capabilities\\n`, 'info');\n\n for (const model of visionModels) {\n await logOutput(`\\n${'-'.repeat(60)}\\nTesting ${model} \u00e2\u2021\u00a2`, 'running');\n \n if (testBothAPIs) {\n // Test both APIs and compare\n await logOutput(`\\n\u00f0\u0178\u201c\u00a1 Testing with Invoke API:`, 'info');\n const invokeResult = await testVisionModel(model, messages, false, \"Invoke API\");\n \n if (invokeResult.success) {\n await logOutput(`\u00e2\u0153\u201c Invoke API: Success`, 'success');\n await logOutput(`Response: ${invokeResult.response.substring(0, 150)}...\\n`, 'info');\n } else {\n await logOutput(`\u00e2\u0153\u2014 Invoke API: ${invokeResult.error}`, 'error');\n }\n \n await logOutput(`\u00f0\u0178\u201c\u00a1 Testing with Converse API:`, 'info');\n const converseResult = await testVisionModel(model, messages, true, \"Converse API\");\n \n if (converseResult.success) {\n await logOutput(`\u00e2\u0153\u201c Converse API: Success`, 'success');\n await logOutput(`Response: ${converseResult.response.substring(0, 150)}...\\n`, 'info');\n } else {\n await logOutput(`\u00e2\u0153\u2014 Converse API: ${converseResult.error}`, 'error');\n }\n \n // Compare results\n if (invokeResult.success && converseResult.success) {\n await logOutput(`\u00f0\u0178\u201d\udc8d Both APIs successful for ${model}`, 'success');\n } else if (invokeResult.success || converseResult.success) {\n await logOutput(`\u00e2\u0161\u00a0 Partial success for ${model}`, 'warning');\n } else {\n await logOutput(`\u00e2\udc9d\u0152 Both APIs failed for ${model}`, 'error');\n }\n \n } else {\n // Test single API\n const useConverseAPI = useConverseOnly;\n const apiName = useConverseAPI ? \"Converse API\" : \"Invoke API\";\n \n const result = await testVisionModel(model, messages, useConverseAPI, apiName);\n \n if (result.success) {\n await logOutput(`\\n\u00e2\u0153\u201c ${apiName}: Success`, 'success');\n await logOutput(`Response: ${result.response}\\n`, 'info', true);\n } else {\n await logOutput(`\\n\u00e2\u0153\u2014 ${apiName}: ${result.error}`, 'error');\n \n // Log the full error details to file\n await fs.appendFile('test-vision-models-output.txt', \n `Error details: ${result.error}\\n\\n`\n );\n }\n }\n \n console.log(\"\\n\" + \"-\".repeat(40));\n }\n \n await logOutput('\\nVision testing complete! Check test-vision-models-output.txt for full results.', 'info', false);\n}"
|
|
1235
|
-
},
|
|
1236
|
-
{
|
|
1237
|
-
"old_string": "testVisionCapabilities().catch(console.error);",
|
|
1238
|
-
"new_string": "// Add usage info\nconsole.log('Vision Test Usage:');\nconsole.log(' npm run test-vision # Test with Invoke API (default)');\nconsole.log(' npm run test-vision -- --converse # Test with Converse API only');\nconsole.log(' npm run test-vision -- --both # Test both APIs and compare');\nconsole.log('\\n');\n\ntestVisionCapabilities().catch(console.error);"
|
|
1239
|
-
}
|
|
1240
|
-
]
|
|
1241
|
-
}
|
|
1242
|
-
},
|
|
1243
|
-
{
|
|
1244
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
1245
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
1246
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
1247
|
-
"hook_event_name": "PreToolUse",
|
|
1248
|
-
"tool_name": "TodoWrite",
|
|
1249
|
-
"tool_input": {
|
|
1250
|
-
"todos": [
|
|
1251
|
-
{
|
|
1252
|
-
"content": "Research AWS Bedrock Converse API documentation",
|
|
1253
|
-
"status": "completed",
|
|
1254
|
-
"id": "1"
|
|
1255
|
-
},
|
|
1256
|
-
{
|
|
1257
|
-
"content": "Understand current codebase structure and invoke API implementation",
|
|
1258
|
-
"status": "completed",
|
|
1259
|
-
"id": "2"
|
|
1260
|
-
},
|
|
1261
|
-
{
|
|
1262
|
-
"content": "Design Converse API integration approach",
|
|
1263
|
-
"status": "completed",
|
|
1264
|
-
"id": "3"
|
|
1265
|
-
},
|
|
1266
|
-
{
|
|
1267
|
-
"content": "Write tests for Converse API functionality (TDD)",
|
|
1268
|
-
"status": "completed",
|
|
1269
|
-
"id": "4"
|
|
1270
|
-
},
|
|
1271
|
-
{
|
|
1272
|
-
"content": "Implement Converse API support in bedrock-wrapper.js",
|
|
1273
|
-
"status": "completed",
|
|
1274
|
-
"id": "5"
|
|
1275
|
-
},
|
|
1276
|
-
{
|
|
1277
|
-
"content": "Update existing tests to handle both APIs",
|
|
1278
|
-
"status": "completed",
|
|
1279
|
-
"id": "6"
|
|
1280
|
-
},
|
|
1281
|
-
{
|
|
1282
|
-
"content": "Test all models with both invoke and converse APIs",
|
|
1283
|
-
"status": "completed",
|
|
1284
|
-
"id": "7"
|
|
1285
|
-
},
|
|
1286
|
-
{
|
|
1287
|
-
"content": "Refactor bedrockWrapper function to separate Invoke API complexities",
|
|
1288
|
-
"status": "completed",
|
|
1289
|
-
"id": "8"
|
|
1290
|
-
},
|
|
1291
|
-
{
|
|
1292
|
-
"content": "Update test-models.js to support both Converse and Invoke API testing",
|
|
1293
|
-
"status": "in_progress",
|
|
1294
|
-
"id": "9"
|
|
1295
|
-
},
|
|
1296
|
-
{
|
|
1297
|
-
"content": "Update test-stop-sequences.js to support both Converse and Invoke API testing",
|
|
1298
|
-
"status": "pending",
|
|
1299
|
-
"id": "10"
|
|
1300
|
-
}
|
|
1301
|
-
]
|
|
1302
|
-
}
|
|
1303
|
-
},
|
|
1304
|
-
{
|
|
1305
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
1306
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
1307
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
1308
|
-
"hook_event_name": "PreToolUse",
|
|
1309
|
-
"tool_name": "MultiEdit",
|
|
1310
|
-
"tool_input": {
|
|
1311
|
-
"file_path": "C:\\git\\bedrock-wrapper\\test-models.js",
|
|
1312
|
-
"edits": [
|
|
1313
|
-
{
|
|
1314
|
-
"old_string": "async function testModel(model, awsCreds, testMessage, isStreaming, useConverseAPI = false) {\n const messages = [{ role: \"user\", content: testMessage }];\n const openaiChatCompletionsCreateObject = {\n messages,\n model,\n max_tokens: LLM_MAX_GEN_TOKENS,\n stream: isStreaming,\n temperature: LLM_TEMPERATURE,\n top_p: LLM_TOP_P,\n };\n\n let completeResponse = \"\";\n \n try {\n if (isStreaming) {\n for await (const chunk of bedrockWrapper(awsCreds, openaiChatCompletionsCreateObject, { logging: true, useConverseAPI })) {\n completeResponse += chunk;\n }\n } else {\n const response = await bedrockWrapper(awsCreds, openaiChatCompletionsCreateObject, { logging: true, useConverseAPI });\n for await (const data of response) {\n completeResponse += data;\n }\n }\n\n // Check if response is empty or undefined\n if (!completeResponse || completeResponse.trim() === '' || completeResponse.trim() === 'undefined') {\n throw new Error('Empty or invalid response received');\n }\n\n return { success: true, response: completeResponse.trim() };\n } catch (error) {\n return { success: false, error: error.message };\n }\n}",
|
|
1315
|
-
"new_string": "async function testModel(model, awsCreds, testMessage, isStreaming, useConverseAPI, apiName) {\n const messages = [{ role: \"user\", content: testMessage }];\n const openaiChatCompletionsCreateObject = {\n messages,\n model,\n max_tokens: LLM_MAX_GEN_TOKENS,\n stream: isStreaming,\n temperature: LLM_TEMPERATURE,\n top_p: LLM_TOP_P,\n };\n\n let completeResponse = \"\";\n \n try {\n if (isStreaming) {\n for await (const chunk of bedrockWrapper(awsCreds, openaiChatCompletionsCreateObject, { logging: true, useConverseAPI })) {\n completeResponse += chunk;\n }\n } else {\n const response = await bedrockWrapper(awsCreds, openaiChatCompletionsCreateObject, { logging: true, useConverseAPI });\n for await (const data of response) {\n completeResponse += data;\n }\n }\n\n // Check if response is empty or undefined\n if (!completeResponse || completeResponse.trim() === '' || completeResponse.trim() === 'undefined') {\n throw new Error('Empty or invalid response received');\n }\n\n return { success: true, response: completeResponse.trim() };\n } catch (error) {\n return { success: false, error: error.message };\n }\n}"
|
|
1316
|
-
},
|
|
1317
|
-
{
|
|
1318
|
-
"old_string": "async function main() {\n // Check for command-line arguments\n const args = process.argv.slice(2);\n const useConverseAPI = args.includes('--converse');\n \n const testMessage = \"Respond with exactly one word: What is 1+1?\";\n const apiMode = useConverseAPI ? \"Converse API\" : \"Invoke API\";\n \n // Clear output file and add header\n await fs.writeFile('test-models-output.txt', \n `Test Mode: ${apiMode}\\n` +\n `Test Question: \"${testMessage}\"\\n` +\n `=`.repeat(50) + '\\n\\n'\n );\n\n const supportedModels = await listBedrockWrapperSupportedModels();\n const availableModels = supportedModels.map(model => {\n const fixedJson = model\n .replace(/modelName\": ([^,]+),/, 'modelName\": \"$1\",')\n .replace(/modelId\": ([^}]+)}/, 'modelId\": \"$1\"}');\n return JSON.parse(fixedJson).modelName;\n });\n\n console.clear();\n await logOutput(`Starting tests with ${availableModels.length} models using ${apiMode}...`, 'info');\n await logOutput(`Each model will be tested with streaming and non-streaming calls\\n`, 'info');\n\n const awsCreds = {\n region: AWS_REGION,\n accessKeyId: AWS_ACCESS_KEY_ID,\n secretAccessKey: AWS_SECRET_ACCESS_KEY,\n };\n\n for (const model of availableModels) {\n await logOutput(`\\n${'-'.repeat(50)}\\nTesting ${model} \u00e2\u2021\u00a2`, 'running');\n\n // Test streaming\n const streamResult = await testModel(model, awsCreds, testMessage, true, useConverseAPI);\n if (streamResult.success) {\n await logOutput(`Streaming test passed for ${model}: \"${streamResult.response}\"`, 'success');\n } else {\n await logOutput(`Streaming test failed for ${model}: ${streamResult.error}`, 'error');\n }\n\n // Test non-streaming\n const nonStreamResult = await testModel(model, awsCreds, testMessage, false, useConverseAPI);\n if (nonStreamResult.success) {\n await logOutput(`Non-streaming test passed for ${model}: \"${nonStreamResult.response}\"`, 'success');\n } else {\n await logOutput(`Non-streaming test failed for ${model}: ${nonStreamResult.error}`, 'error');\n }\n \n console.log(''); // Add blank line between models\n }\n\n await logOutput('Testing complete! Check test-models-output.txt for full test results.', 'info', false);\n}",
|
|
1319
|
-
"new_string": "async function main() {\n // Check for command-line arguments\n const args = process.argv.slice(2);\n const testBothAPIs = args.includes('--both') || args.includes('--compare');\n const useConverseOnly = args.includes('--converse');\n \n const testMessage = \"Respond with exactly one word: What is 1+1?\";\n \n // Determine test mode\n let testMode = \"Invoke API\";\n if (useConverseOnly) testMode = \"Converse API\";\n if (testBothAPIs) testMode = \"Both APIs (Comparison)\";\n \n // Clear output file and add header\n await fs.writeFile('test-models-output.txt', \n `Test Mode: ${testMode}\\n` +\n `Test Question: \"${testMessage}\"\\n` +\n `Test Date: ${new Date().toISOString()}\\n` +\n `${'='.repeat(60)}\\n\\n`\n );\n\n const supportedModels = await listBedrockWrapperSupportedModels();\n const availableModels = supportedModels.map(model => {\n const fixedJson = model\n .replace(/modelName\": ([^,]+),/, 'modelName\": \"$1\",')\n .replace(/modelId\": ([^}]+)}/, 'modelId\": \"$1\"}');\n return JSON.parse(fixedJson).modelName;\n });\n\n console.clear();\n await logOutput(`Starting tests with ${availableModels.length} models using ${testMode}...`, 'info');\n await logOutput(`Each model will be tested with streaming and non-streaming calls\\n`, 'info');\n\n const awsCreds = {\n region: AWS_REGION,\n accessKeyId: AWS_ACCESS_KEY_ID,\n secretAccessKey: AWS_SECRET_ACCESS_KEY,\n };\n\n for (const model of availableModels) {\n await logOutput(`\\n${'-'.repeat(60)}\\nTesting ${model} \u00e2\u2021\u00a2`, 'running');\n\n if (testBothAPIs) {\n // Test both APIs and compare\n await logOutput(`\\n\u00f0\u0178\u201c\u00a1 Testing with Invoke API:`, 'info');\n \n // Invoke API streaming test\n const invokeStreamResult = await testModel(model, awsCreds, testMessage, true, false, \"Invoke API\");\n if (invokeStreamResult.success) {\n await logOutput(`\u00e2\u0153\u201c Invoke API Streaming: \"${invokeStreamResult.response}\"`, 'success');\n } else {\n await logOutput(`\u00e2\u0153\u2014 Invoke API Streaming: ${invokeStreamResult.error}`, 'error');\n }\n\n // Invoke API non-streaming test\n const invokeNonStreamResult = await testModel(model, awsCreds, testMessage, false, false, \"Invoke API\");\n if (invokeNonStreamResult.success) {\n await logOutput(`\u00e2\u0153\u201c Invoke API Non-streaming: \"${invokeNonStreamResult.response}\"`, 'success');\n } else {\n await logOutput(`\u00e2\u0153\u2014 Invoke API Non-streaming: ${invokeNonStreamResult.error}`, 'error');\n }\n \n await logOutput(`\\n\u00f0\u0178\u201c\u00a1 Testing with Converse API:`, 'info');\n \n // Converse API streaming test\n const converseStreamResult = await testModel(model, awsCreds, testMessage, true, true, \"Converse API\");\n if (converseStreamResult.success) {\n await logOutput(`\u00e2\u0153\u201c Converse API Streaming: \"${converseStreamResult.response}\"`, 'success');\n } else {\n await logOutput(`\u00e2\u0153\u2014 Converse API Streaming: ${converseStreamResult.error}`, 'error');\n }\n\n // Converse API non-streaming test\n const converseNonStreamResult = await testModel(model, awsCreds, testMessage, false, true, \"Converse API\");\n if (converseNonStreamResult.success) {\n await logOutput(`\u00e2\u0153\u201c Converse API Non-streaming: \"${converseNonStreamResult.response}\"`, 'success');\n } else {\n await logOutput(`\u00e2\u0153\u2014 Converse API Non-streaming: ${converseNonStreamResult.error}`, 'error');\n }\n \n // Compare results\n const invokeSuccess = invokeStreamResult.success && invokeNonStreamResult.success;\n const converseSuccess = converseStreamResult.success && converseNonStreamResult.success;\n \n if (invokeSuccess && converseSuccess) {\n await logOutput(`\u00f0\u0178\u201d\udc8d Both APIs successful for ${model}`, 'success');\n } else if (invokeSuccess || converseSuccess) {\n await logOutput(`\u00e2\u0161\u00a0 Partial success for ${model}`, 'warning');\n } else {\n await logOutput(`\u00e2\udc9d\u0152 Both APIs failed for ${model}`, 'error');\n }\n \n } else {\n // Test single API\n const useConverseAPI = useConverseOnly;\n const apiName = useConverseAPI ? \"Converse API\" : \"Invoke API\";\n \n // Test streaming\n const streamResult = await testModel(model, awsCreds, testMessage, true, useConverseAPI, apiName);\n if (streamResult.success) {\n await logOutput(`\u00e2\u0153\u201c ${apiName} Streaming: \"${streamResult.response}\"`, 'success');\n } else {\n await logOutput(`\u00e2\u0153\u2014 ${apiName} Streaming: ${streamResult.error}`, 'error');\n }\n\n // Test non-streaming\n const nonStreamResult = await testModel(model, awsCreds, testMessage, false, useConverseAPI, apiName);\n if (nonStreamResult.success) {\n await logOutput(`\u00e2\u0153\u201c ${apiName} Non-streaming: \"${nonStreamResult.response}\"`, 'success');\n } else {\n await logOutput(`\u00e2\u0153\u2014 ${apiName} Non-streaming: ${nonStreamResult.error}`, 'error');\n }\n }\n \n console.log('\\n' + '-'.repeat(40));\n }\n\n await logOutput('\\nTesting complete! Check test-models-output.txt for full test results.', 'info', false);\n}"
|
|
1320
|
-
},
|
|
1321
|
-
{
|
|
1322
|
-
"old_string": "main().catch(async (error) => {\n await logOutput(`Fatal Error: ${error.message}`, 'error');\n console.error(error);\n});",
|
|
1323
|
-
"new_string": "// Add usage info\nconsole.log('Model Test Usage:');\nconsole.log(' npm run test # Test with Invoke API (default)');\nconsole.log(' npm run test -- --converse # Test with Converse API only');\nconsole.log(' npm run test -- --both # Test both APIs and compare');\nconsole.log('\\n');\n\nmain().catch(async (error) => {\n await logOutput(`Fatal Error: ${error.message}`, 'error');\n console.error(error);\n});"
|
|
1324
|
-
}
|
|
1325
|
-
]
|
|
1326
|
-
}
|
|
1327
|
-
},
|
|
1328
|
-
{
|
|
1329
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
1330
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
1331
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
1332
|
-
"hook_event_name": "PreToolUse",
|
|
1333
|
-
"tool_name": "TodoWrite",
|
|
1334
|
-
"tool_input": {
|
|
1335
|
-
"todos": [
|
|
1336
|
-
{
|
|
1337
|
-
"content": "Research AWS Bedrock Converse API documentation",
|
|
1338
|
-
"status": "completed",
|
|
1339
|
-
"id": "1"
|
|
1340
|
-
},
|
|
1341
|
-
{
|
|
1342
|
-
"content": "Understand current codebase structure and invoke API implementation",
|
|
1343
|
-
"status": "completed",
|
|
1344
|
-
"id": "2"
|
|
1345
|
-
},
|
|
1346
|
-
{
|
|
1347
|
-
"content": "Design Converse API integration approach",
|
|
1348
|
-
"status": "completed",
|
|
1349
|
-
"id": "3"
|
|
1350
|
-
},
|
|
1351
|
-
{
|
|
1352
|
-
"content": "Write tests for Converse API functionality (TDD)",
|
|
1353
|
-
"status": "completed",
|
|
1354
|
-
"id": "4"
|
|
1355
|
-
},
|
|
1356
|
-
{
|
|
1357
|
-
"content": "Implement Converse API support in bedrock-wrapper.js",
|
|
1358
|
-
"status": "completed",
|
|
1359
|
-
"id": "5"
|
|
1360
|
-
},
|
|
1361
|
-
{
|
|
1362
|
-
"content": "Update existing tests to handle both APIs",
|
|
1363
|
-
"status": "completed",
|
|
1364
|
-
"id": "6"
|
|
1365
|
-
},
|
|
1366
|
-
{
|
|
1367
|
-
"content": "Test all models with both invoke and converse APIs",
|
|
1368
|
-
"status": "completed",
|
|
1369
|
-
"id": "7"
|
|
1370
|
-
},
|
|
1371
|
-
{
|
|
1372
|
-
"content": "Refactor bedrockWrapper function to separate Invoke API complexities",
|
|
1373
|
-
"status": "completed",
|
|
1374
|
-
"id": "8"
|
|
1375
|
-
},
|
|
1376
|
-
{
|
|
1377
|
-
"content": "Update test-models.js to support both Converse and Invoke API testing",
|
|
1378
|
-
"status": "completed",
|
|
1379
|
-
"id": "9"
|
|
1380
|
-
},
|
|
1381
|
-
{
|
|
1382
|
-
"content": "Update test-stop-sequences.js to support both Converse and Invoke API testing",
|
|
1383
|
-
"status": "in_progress",
|
|
1384
|
-
"id": "10"
|
|
1385
|
-
}
|
|
1386
|
-
]
|
|
1387
|
-
}
|
|
1388
|
-
},
|
|
1389
|
-
{
|
|
1390
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
1391
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
1392
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
1393
|
-
"hook_event_name": "PreToolUse",
|
|
1394
|
-
"tool_name": "MultiEdit",
|
|
1395
|
-
"tool_input": {
|
|
1396
|
-
"file_path": "C:\\git\\bedrock-wrapper\\test-stop-sequences.js",
|
|
1397
|
-
"edits": [
|
|
1398
|
-
{
|
|
1399
|
-
"old_string": "async function testStopSequence(model, awsCreds, testCase, isStreaming) {\n const messages = [{ role: \"user\", content: testCase.prompt }];\n const openaiChatCompletionsCreateObject = {\n messages,\n model,\n max_tokens: 200,\n stream: isStreaming,\n temperature: 0.1,\n top_p: 0.9,\n stop_sequences: testCase.stopSequences\n };\n\n let completeResponse = \"\";\n \n try {\n if (isStreaming) {\n for await (const chunk of bedrockWrapper(awsCreds, openaiChatCompletionsCreateObject, { logging: false })) {\n completeResponse += chunk;\n }\n } else {\n const response = await bedrockWrapper(awsCreds, openaiChatCompletionsCreateObject, { logging: false });\n for await (const data of response) {\n completeResponse += data;\n }\n }\n\n // Analyze if stop sequence worked\n const result = {\n success: true,\n response: completeResponse.trim(),\n stoppedCorrectly: false,\n analysis: \"\"\n };\n\n // Use the expectedBehavior function to determine if stopping worked correctly\n if (testCase.expectedBehavior) {\n result.stoppedCorrectly = testCase.expectedBehavior(completeResponse);\n result.analysis = result.stoppedCorrectly ? \n \"Response stopped at the correct point\" : \n \"Response did not stop at the expected point\";\n } else {\n // Generic check - if response is shorter than expected, it probably stopped\n result.stoppedCorrectly = completeResponse.length < 100; // Assume short response means it stopped\n result.analysis = result.stoppedCorrectly ? \n \"Response appears to have stopped early (good sign)\" : \n \"Response seems to have continued beyond expected stop point\";\n }\n\n return result;\n } catch (error) {\n return { \n success: false, \n error: error.message,\n response: \"\",\n stoppedCorrectly: false,\n analysis: \"Error occurred\"\n };\n }\n}",
|
|
1400
|
-
"new_string": "async function testStopSequence(model, awsCreds, testCase, isStreaming, useConverseAPI, apiName) {\n const messages = [{ role: \"user\", content: testCase.prompt }];\n const openaiChatCompletionsCreateObject = {\n messages,\n model,\n max_tokens: 200,\n stream: isStreaming,\n temperature: 0.1,\n top_p: 0.9,\n stop_sequences: testCase.stopSequences\n };\n\n let completeResponse = \"\";\n \n try {\n if (isStreaming) {\n for await (const chunk of bedrockWrapper(awsCreds, openaiChatCompletionsCreateObject, { logging: false, useConverseAPI })) {\n completeResponse += chunk;\n }\n } else {\n const response = await bedrockWrapper(awsCreds, openaiChatCompletionsCreateObject, { logging: false, useConverseAPI });\n for await (const data of response) {\n completeResponse += data;\n }\n }\n\n // Analyze if stop sequence worked\n const result = {\n success: true,\n response: completeResponse.trim(),\n stoppedCorrectly: false,\n analysis: \"\"\n };\n\n // Use the expectedBehavior function to determine if stopping worked correctly\n if (testCase.expectedBehavior) {\n result.stoppedCorrectly = testCase.expectedBehavior(completeResponse);\n result.analysis = result.stoppedCorrectly ? \n \"Response stopped at the correct point\" : \n \"Response did not stop at the expected point\";\n } else {\n // Generic check - if response is shorter than expected, it probably stopped\n result.stoppedCorrectly = completeResponse.length < 100; // Assume short response means it stopped\n result.analysis = result.stoppedCorrectly ? \n \"Response appears to have stopped early (good sign)\" : \n \"Response seems to have continued beyond expected stop point\";\n }\n\n return result;\n } catch (error) {\n return { \n success: false, \n error: error.message,\n response: \"\",\n stoppedCorrectly: false,\n analysis: \"Error occurred\"\n };\n }\n}"
|
|
1401
|
-
},
|
|
1402
|
-
{
|
|
1403
|
-
"old_string": "async function main() {\n // Clear output file and add header\n const timestamp = new Date().toISOString();\n await fs.writeFile('test-stop-sequences-output.txt', \n `Stop Sequences Test Results - ${timestamp}\\n` +\n `${'='.repeat(80)}\\n\\n` +\n `This test validates that stop sequences work correctly across all models.\\n` +\n `Each model is tested with multiple stop sequence scenarios.\\n\\n`\n );\n\n const supportedModels = await listBedrockWrapperSupportedModels();\n const availableModels = supportedModels.map(model => {\n return JSON.parse(model).modelName;\n });\n\n console.clear();\n await logOutput(`Starting stop sequences tests with ${availableModels.length} models...`, 'info');\n await logOutput(`Testing ${stopSequenceTestCases.length} different stop sequence scenarios\\n`, 'info');\n\n const awsCreds = {\n region: AWS_REGION,\n accessKeyId: AWS_ACCESS_KEY_ID,\n secretAccessKey: AWS_SECRET_ACCESS_KEY,\n };\n\n // Track overall results\n const modelResults = {};\n\n // Test a subset of models for efficiency (you can test all if needed)\n const modelsToTest = [\n \"Claude-4-1-Opus\",\n \"Claude-3-5-Sonnet-v2\",\n \"Claude-3-Haiku\", \n \"Nova-Pro\",\n \"Nova-Lite\",\n \"GPT-OSS-120B\",\n \"GPT-OSS-120B-Thinking\",\n \"GPT-OSS-20B\",\n \"GPT-OSS-20B-Thinking\",\n \"Llama-3-3-70b\",\n \"Mistral-7b\"\n ].filter(m => availableModels.includes(m));\n\n await logOutput(`\\nTesting ${modelsToTest.length} representative models...\\n`, 'info');\n\n for (const model of modelsToTest) {\n await logOutput(`\\n${'='.repeat(60)}`, 'info');\n await logOutput(`Testing ${model}`, 'running');\n await logOutput(`${'='.repeat(60)}`, 'info');\n\n modelResults[model] = {\n streaming: { passed: 0, failed: 0 },\n nonStreaming: { passed: 0, failed: 0 }\n };\n\n for (const testCase of stopSequenceTestCases) {\n await logOutput(`\\n\u00e2\u2013\u00b6 Test Case: ${testCase.name}`, 'info');\n await logOutput(` Prompt: \"${testCase.prompt.substring(0, 50)}...\"`, 'info');\n await logOutput(` Stop sequences: [${testCase.stopSequences.join(', ')}]`, 'info');\n\n // Test streaming\n await logOutput(` Testing streaming...`, 'info');\n const streamResult = await testStopSequence(model, awsCreds, testCase, true);\n \n if (streamResult.success) {\n if (streamResult.stoppedCorrectly) {\n await logOutput(` \u00e2\u0153\u201c Streaming: PASSED - ${streamResult.analysis}`, 'success');\n modelResults[model].streaming.passed++;\n } else {\n await logOutput(` \u00e2\u0153\u2014 Streaming: FAILED - ${streamResult.analysis}`, 'warning');\n modelResults[model].streaming.failed++;\n }\n await logOutput(` Response: \"${streamResult.response.substring(0, 100)}...\"`, 'info');\n } else {\n await logOutput(` \u00e2\u0153\u2014 Streaming: ERROR - ${streamResult.error}`, 'error');\n modelResults[model].streaming.failed++;\n }\n\n // Test non-streaming\n await logOutput(` Testing non-streaming...`, 'info');\n const nonStreamResult = await testStopSequence(model, awsCreds, testCase, false);\n \n if (nonStreamResult.success) {\n if (nonStreamResult.stoppedCorrectly) {\n await logOutput(` \u00e2\u0153\u201c Non-streaming: PASSED - ${nonStreamResult.analysis}`, 'success');\n modelResults[model].nonStreaming.passed++;\n } else {\n await logOutput(` \u00e2\u0153\u2014 Non-streaming: FAILED - ${nonStreamResult.analysis}`, 'warning');\n modelResults[model].nonStreaming.failed++;\n }\n await logOutput(` Response: \"${nonStreamResult.response.substring(0, 100)}...\"`, 'info');\n } else {\n await logOutput(` \u00e2\u0153\u2014 Non-streaming: ERROR - ${nonStreamResult.error}`, 'error');\n modelResults[model].nonStreaming.failed++;\n }\n }\n }\n\n // Summary\n await logOutput(`\\n\\n${'='.repeat(80)}`, 'info');\n await logOutput('SUMMARY', 'running');\n await logOutput(`${'='.repeat(80)}\\n`, 'info');\n\n for (const [model, results] of Object.entries(modelResults)) {\n const streamingRate = (results.streaming.passed / (results.streaming.passed + results.streaming.failed) * 100).toFixed(1);\n const nonStreamingRate = (results.nonStreaming.passed / (results.nonStreaming.passed + results.nonStreaming.failed) * 100).toFixed(1);\n \n await logOutput(`${model}:`, 'info');\n await logOutput(` Streaming: ${results.streaming.passed}/${results.streaming.passed + results.streaming.failed} passed (${streamingRate}%)`, \n streamingRate > 80 ? 'success' : 'warning');\n await logOutput(` Non-streaming: ${results.nonStreaming.passed}/${results.nonStreaming.passed + results.nonStreaming.failed} passed (${nonStreamingRate}%)`, \n nonStreamingRate > 80 ? 'success' : 'warning');\n }\n\n await logOutput('\\nTesting complete! Check test-stop-sequences-output.txt for full results.', 'info', false);\n}",
|
|
1404
|
-
"new_string": "async function main() {\n // Check for command-line arguments\n const args = process.argv.slice(2);\n const testBothAPIs = args.includes('--both') || args.includes('--compare');\n const useConverseOnly = args.includes('--converse');\n \n // Determine test mode\n let testMode = \"Invoke API\";\n if (useConverseOnly) testMode = \"Converse API\";\n if (testBothAPIs) testMode = \"Both APIs (Comparison)\";\n \n // Clear output file and add header\n const timestamp = new Date().toISOString();\n await fs.writeFile('test-stop-sequences-output.txt', \n `Stop Sequences Test Results - ${testMode}\\n` +\n `Test Date: ${timestamp}\\n` +\n `${'='.repeat(80)}\\n\\n` +\n `This test validates that stop sequences work correctly across all models.\\n` +\n `Each model is tested with multiple stop sequence scenarios.\\n\\n`\n );\n\n const supportedModels = await listBedrockWrapperSupportedModels();\n const availableModels = supportedModels.map(model => {\n return JSON.parse(model).modelName;\n });\n\n console.clear();\n await logOutput(`Starting stop sequences tests with ${availableModels.length} models using ${testMode}...`, 'info');\n await logOutput(`Testing ${stopSequenceTestCases.length} different stop sequence scenarios\\n`, 'info');\n\n const awsCreds = {\n region: AWS_REGION,\n accessKeyId: AWS_ACCESS_KEY_ID,\n secretAccessKey: AWS_SECRET_ACCESS_KEY,\n };\n\n // Track overall results\n const modelResults = {};\n\n // Test a subset of models for efficiency (you can test all if needed)\n const modelsToTest = [\n \"Claude-4-1-Opus\",\n \"Claude-3-5-Sonnet-v2\",\n \"Claude-3-Haiku\", \n \"Nova-Pro\",\n \"Nova-Lite\",\n \"GPT-OSS-120B\",\n \"GPT-OSS-120B-Thinking\",\n \"GPT-OSS-20B\",\n \"GPT-OSS-20B-Thinking\",\n \"Llama-3-3-70b\",\n \"Mistral-7b\"\n ].filter(m => availableModels.includes(m));\n\n await logOutput(`\\nTesting ${modelsToTest.length} representative models...\\n`, 'info');\n\n for (const model of modelsToTest) {\n await logOutput(`\\n${'='.repeat(60)}`, 'info');\n await logOutput(`Testing ${model}`, 'running');\n await logOutput(`${'='.repeat(60)}`, 'info');\n\n if (testBothAPIs) {\n modelResults[model] = {\n invoke: { streaming: { passed: 0, failed: 0 }, nonStreaming: { passed: 0, failed: 0 } },\n converse: { streaming: { passed: 0, failed: 0 }, nonStreaming: { passed: 0, failed: 0 } }\n };\n } else {\n modelResults[model] = {\n streaming: { passed: 0, failed: 0 },\n nonStreaming: { passed: 0, failed: 0 }\n };\n }\n\n for (const testCase of stopSequenceTestCases) {\n await logOutput(`\\n\u00e2\u2013\u00b6 Test Case: ${testCase.name}`, 'info');\n await logOutput(` Prompt: \"${testCase.prompt.substring(0, 50)}...\"`, 'info');\n await logOutput(` Stop sequences: [${testCase.stopSequences.join(', ')}]`, 'info');\n\n if (testBothAPIs) {\n // Test both APIs and compare\n await logOutput(`\\n \u00f0\u0178\u201c\u00a1 Testing with Invoke API:`, 'info');\n \n // Invoke API streaming test\n const invokeStreamResult = await testStopSequence(model, awsCreds, testCase, true, false, \"Invoke API\");\n if (invokeStreamResult.success) {\n if (invokeStreamResult.stoppedCorrectly) {\n await logOutput(` \u00e2\u0153\u201c Invoke Streaming: PASSED - ${invokeStreamResult.analysis}`, 'success');\n modelResults[model].invoke.streaming.passed++;\n } else {\n await logOutput(` \u00e2\u0153\u2014 Invoke Streaming: FAILED - ${invokeStreamResult.analysis}`, 'warning');\n modelResults[model].invoke.streaming.failed++;\n }\n await logOutput(` Response: \"${invokeStreamResult.response.substring(0, 100)}...\"`, 'info');\n } else {\n await logOutput(` \u00e2\u0153\u2014 Invoke Streaming: ERROR - ${invokeStreamResult.error}`, 'error');\n modelResults[model].invoke.streaming.failed++;\n }\n\n // Invoke API non-streaming test\n const invokeNonStreamResult = await testStopSequence(model, awsCreds, testCase, false, false, \"Invoke API\");\n if (invokeNonStreamResult.success) {\n if (invokeNonStreamResult.stoppedCorrectly) {\n await logOutput(` \u00e2\u0153\u201c Invoke Non-streaming: PASSED - ${invokeNonStreamResult.analysis}`, 'success');\n modelResults[model].invoke.nonStreaming.passed++;\n } else {\n await logOutput(` \u00e2\u0153\u2014 Invoke Non-streaming: FAILED - ${invokeNonStreamResult.analysis}`, 'warning');\n modelResults[model].invoke.nonStreaming.failed++;\n }\n await logOutput(` Response: \"${invokeNonStreamResult.response.substring(0, 100)}...\"`, 'info');\n } else {\n await logOutput(` \u00e2\u0153\u2014 Invoke Non-streaming: ERROR - ${invokeNonStreamResult.error}`, 'error');\n modelResults[model].invoke.nonStreaming.failed++;\n }\n\n await logOutput(`\\n \u00f0\u0178\u201c\u00a1 Testing with Converse API:`, 'info');\n \n // Converse API streaming test\n const converseStreamResult = await testStopSequence(model, awsCreds, testCase, true, true, \"Converse API\");\n if (converseStreamResult.success) {\n if (converseStreamResult.stoppedCorrectly) {\n await logOutput(` \u00e2\u0153\u201c Converse Streaming: PASSED - ${converseStreamResult.analysis}`, 'success');\n modelResults[model].converse.streaming.passed++;\n } else {\n await logOutput(` \u00e2\u0153\u2014 Converse Streaming: FAILED - ${converseStreamResult.analysis}`, 'warning');\n modelResults[model].converse.streaming.failed++;\n }\n await logOutput(` Response: \"${converseStreamResult.response.substring(0, 100)}...\"`, 'info');\n } else {\n await logOutput(` \u00e2\u0153\u2014 Converse Streaming: ERROR - ${converseStreamResult.error}`, 'error');\n modelResults[model].converse.streaming.failed++;\n }\n\n // Converse API non-streaming test\n const converseNonStreamResult = await testStopSequence(model, awsCreds, testCase, false, true, \"Converse API\");\n if (converseNonStreamResult.success) {\n if (converseNonStreamResult.stoppedCorrectly) {\n await logOutput(` \u00e2\u0153\u201c Converse Non-streaming: PASSED - ${converseNonStreamResult.analysis}`, 'success');\n modelResults[model].converse.nonStreaming.passed++;\n } else {\n await logOutput(` \u00e2\u0153\u2014 Converse Non-streaming: FAILED - ${converseNonStreamResult.analysis}`, 'warning');\n modelResults[model].converse.nonStreaming.failed++;\n }\n await logOutput(` Response: \"${converseNonStreamResult.response.substring(0, 100)}...\"`, 'info');\n } else {\n await logOutput(` \u00e2\u0153\u2014 Converse Non-streaming: ERROR - ${converseNonStreamResult.error}`, 'error');\n modelResults[model].converse.nonStreaming.failed++;\n }\n \n } else {\n // Test single API\n const useConverseAPI = useConverseOnly;\n const apiName = useConverseAPI ? \"Converse API\" : \"Invoke API\";\n \n // Test streaming\n await logOutput(` Testing streaming with ${apiName}...`, 'info');\n const streamResult = await testStopSequence(model, awsCreds, testCase, true, useConverseAPI, apiName);\n \n if (streamResult.success) {\n if (streamResult.stoppedCorrectly) {\n await logOutput(` \u00e2\u0153\u201c Streaming: PASSED - ${streamResult.analysis}`, 'success');\n modelResults[model].streaming.passed++;\n } else {\n await logOutput(` \u00e2\u0153\u2014 Streaming: FAILED - ${streamResult.analysis}`, 'warning');\n modelResults[model].streaming.failed++;\n }\n await logOutput(` Response: \"${streamResult.response.substring(0, 100)}...\"`, 'info');\n } else {\n await logOutput(` \u00e2\u0153\u2014 Streaming: ERROR - ${streamResult.error}`, 'error');\n modelResults[model].streaming.failed++;\n }\n\n // Test non-streaming\n await logOutput(` Testing non-streaming with ${apiName}...`, 'info');\n const nonStreamResult = await testStopSequence(model, awsCreds, testCase, false, useConverseAPI, apiName);\n \n if (nonStreamResult.success) {\n if (nonStreamResult.stoppedCorrectly) {\n await logOutput(` \u00e2\u0153\u201c Non-streaming: PASSED - ${nonStreamResult.analysis}`, 'success');\n modelResults[model].nonStreaming.passed++;\n } else {\n await logOutput(` \u00e2\u0153\u2014 Non-streaming: FAILED - ${nonStreamResult.analysis}`, 'warning');\n modelResults[model].nonStreaming.failed++;\n }\n await logOutput(` Response: \"${nonStreamResult.response.substring(0, 100)}...\"`, 'info');\n } else {\n await logOutput(` \u00e2\u0153\u2014 Non-streaming: ERROR - ${nonStreamResult.error}`, 'error');\n modelResults[model].nonStreaming.failed++;\n }\n }\n }\n }\n\n // Summary\n await logOutput(`\\n\\n${'='.repeat(80)}`, 'info');\n await logOutput('SUMMARY', 'running');\n await logOutput(`${'='.repeat(80)}\\n`, 'info');\n\n for (const [model, results] of Object.entries(modelResults)) {\n await logOutput(`${model}:`, 'info');\n \n if (testBothAPIs) {\n // Both APIs summary\n const invokeStreamingRate = (results.invoke.streaming.passed / (results.invoke.streaming.passed + results.invoke.streaming.failed) * 100).toFixed(1);\n const invokeNonStreamingRate = (results.invoke.nonStreaming.passed / (results.invoke.nonStreaming.passed + results.invoke.nonStreaming.failed) * 100).toFixed(1);\n const converseStreamingRate = (results.converse.streaming.passed / (results.converse.streaming.passed + results.converse.streaming.failed) * 100).toFixed(1);\n const converseNonStreamingRate = (results.converse.nonStreaming.passed / (results.converse.nonStreaming.passed + results.converse.nonStreaming.failed) * 100).toFixed(1);\n \n await logOutput(` Invoke API:`, 'info');\n await logOutput(` Streaming: ${results.invoke.streaming.passed}/${results.invoke.streaming.passed + results.invoke.streaming.failed} passed (${invokeStreamingRate}%)`, \n invokeStreamingRate > 80 ? 'success' : 'warning');\n await logOutput(` Non-streaming: ${results.invoke.nonStreaming.passed}/${results.invoke.nonStreaming.passed + results.invoke.nonStreaming.failed} passed (${invokeNonStreamingRate}%)`, \n invokeNonStreamingRate > 80 ? 'success' : 'warning');\n \n await logOutput(` Converse API:`, 'info');\n await logOutput(` Streaming: ${results.converse.streaming.passed}/${results.converse.streaming.passed + results.converse.streaming.failed} passed (${converseStreamingRate}%)`, \n converseStreamingRate > 80 ? 'success' : 'warning');\n await logOutput(` Non-streaming: ${results.converse.nonStreaming.passed}/${results.converse.nonStreaming.passed + results.converse.nonStreaming.failed} passed (${converseNonStreamingRate}%)`, \n converseNonStreamingRate > 80 ? 'success' : 'warning');\n \n } else {\n // Single API summary\n const streamingRate = (results.streaming.passed / (results.streaming.passed + results.streaming.failed) * 100).toFixed(1);\n const nonStreamingRate = (results.nonStreaming.passed / (results.nonStreaming.passed + results.nonStreaming.failed) * 100).toFixed(1);\n \n await logOutput(` Streaming: ${results.streaming.passed}/${results.streaming.passed + results.streaming.failed} passed (${streamingRate}%)`, \n streamingRate > 80 ? 'success' : 'warning');\n await logOutput(` Non-streaming: ${results.nonStreaming.passed}/${results.nonStreaming.passed + results.nonStreaming.failed} passed (${nonStreamingRate}%)`, \n nonStreamingRate > 80 ? 'success' : 'warning');\n }\n }\n\n await logOutput('\\nTesting complete! Check test-stop-sequences-output.txt for full results.', 'info', false);\n}"
|
|
1405
|
-
},
|
|
1406
|
-
{
|
|
1407
|
-
"old_string": "main().catch(async (error) => {\n await logOutput(`Fatal Error: ${error.message}`, 'error');\n console.error(error);\n});",
|
|
1408
|
-
"new_string": "// Add usage info\nconsole.log('Stop Sequences Test Usage:');\nconsole.log(' npm run test-stop # Test with Invoke API (default)');\nconsole.log(' npm run test-stop -- --converse # Test with Converse API only');\nconsole.log(' npm run test-stop -- --both # Test both APIs and compare');\nconsole.log('\\n');\n\nmain().catch(async (error) => {\n await logOutput(`Fatal Error: ${error.message}`, 'error');\n console.error(error);\n});"
|
|
1409
|
-
}
|
|
1410
|
-
]
|
|
1411
|
-
}
|
|
1412
|
-
},
|
|
1413
|
-
{
|
|
1414
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
1415
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
1416
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
1417
|
-
"hook_event_name": "PreToolUse",
|
|
1418
|
-
"tool_name": "TodoWrite",
|
|
1419
|
-
"tool_input": {
|
|
1420
|
-
"todos": [
|
|
1421
|
-
{
|
|
1422
|
-
"content": "Research AWS Bedrock Converse API documentation",
|
|
1423
|
-
"status": "completed",
|
|
1424
|
-
"id": "1"
|
|
1425
|
-
},
|
|
1426
|
-
{
|
|
1427
|
-
"content": "Understand current codebase structure and invoke API implementation",
|
|
1428
|
-
"status": "completed",
|
|
1429
|
-
"id": "2"
|
|
1430
|
-
},
|
|
1431
|
-
{
|
|
1432
|
-
"content": "Design Converse API integration approach",
|
|
1433
|
-
"status": "completed",
|
|
1434
|
-
"id": "3"
|
|
1435
|
-
},
|
|
1436
|
-
{
|
|
1437
|
-
"content": "Write tests for Converse API functionality (TDD)",
|
|
1438
|
-
"status": "completed",
|
|
1439
|
-
"id": "4"
|
|
1440
|
-
},
|
|
1441
|
-
{
|
|
1442
|
-
"content": "Implement Converse API support in bedrock-wrapper.js",
|
|
1443
|
-
"status": "completed",
|
|
1444
|
-
"id": "5"
|
|
1445
|
-
},
|
|
1446
|
-
{
|
|
1447
|
-
"content": "Update existing tests to handle both APIs",
|
|
1448
|
-
"status": "completed",
|
|
1449
|
-
"id": "6"
|
|
1450
|
-
},
|
|
1451
|
-
{
|
|
1452
|
-
"content": "Test all models with both invoke and converse APIs",
|
|
1453
|
-
"status": "completed",
|
|
1454
|
-
"id": "7"
|
|
1455
|
-
},
|
|
1456
|
-
{
|
|
1457
|
-
"content": "Refactor bedrockWrapper function to separate Invoke API complexities",
|
|
1458
|
-
"status": "completed",
|
|
1459
|
-
"id": "8"
|
|
1460
|
-
},
|
|
1461
|
-
{
|
|
1462
|
-
"content": "Update test-models.js to support both Converse and Invoke API testing",
|
|
1463
|
-
"status": "completed",
|
|
1464
|
-
"id": "9"
|
|
1465
|
-
},
|
|
1466
|
-
{
|
|
1467
|
-
"content": "Update test-stop-sequences.js to support both Converse and Invoke API testing",
|
|
1468
|
-
"status": "completed",
|
|
1469
|
-
"id": "10"
|
|
1470
|
-
}
|
|
1471
|
-
]
|
|
1472
|
-
}
|
|
1473
|
-
},
|
|
1474
|
-
{
|
|
1475
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
1476
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
1477
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
1478
|
-
"hook_event_name": "PreToolUse",
|
|
1479
|
-
"tool_name": "TodoWrite",
|
|
1480
|
-
"tool_input": {
|
|
1481
|
-
"todos": [
|
|
1482
|
-
{
|
|
1483
|
-
"content": "Investigate Claude thinking tags missing in Converse API",
|
|
1484
|
-
"status": "in_progress",
|
|
1485
|
-
"id": "11"
|
|
1486
|
-
}
|
|
1487
|
-
]
|
|
1488
|
-
}
|
|
1489
|
-
},
|
|
1490
|
-
{
|
|
1491
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
1492
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
1493
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
1494
|
-
"hook_event_name": "PreToolUse",
|
|
1495
|
-
"tool_name": "Read",
|
|
1496
|
-
"tool_input": {
|
|
1497
|
-
"file_path": "C:\\git\\bedrock-wrapper\\bedrock-wrapper.js",
|
|
1498
|
-
"offset": 500,
|
|
1499
|
-
"limit": 150
|
|
1500
|
-
}
|
|
1501
|
-
},
|
|
1502
|
-
{
|
|
1503
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
1504
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
1505
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
1506
|
-
"hook_event_name": "PreToolUse",
|
|
1507
|
-
"tool_name": "Grep",
|
|
1508
|
-
"tool_input": {
|
|
1509
|
-
"pattern": "processReasoningTags",
|
|
1510
|
-
"output_mode": "content",
|
|
1511
|
-
"-A": 20,
|
|
1512
|
-
"-n": true
|
|
1513
|
-
}
|
|
1514
|
-
},
|
|
1515
|
-
{
|
|
1516
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
1517
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
1518
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
1519
|
-
"hook_event_name": "PreToolUse",
|
|
1520
|
-
"tool_name": "Grep",
|
|
1521
|
-
"tool_input": {
|
|
1522
|
-
"pattern": "thinking",
|
|
1523
|
-
"glob": "bedrock-models.js",
|
|
1524
|
-
"output_mode": "content",
|
|
1525
|
-
"-B": 2,
|
|
1526
|
-
"-A": 5,
|
|
1527
|
-
"-n": true
|
|
1528
|
-
}
|
|
1529
|
-
},
|
|
1530
|
-
{
|
|
1531
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
1532
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
1533
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
1534
|
-
"hook_event_name": "PreToolUse",
|
|
1535
|
-
"tool_name": "Read",
|
|
1536
|
-
"tool_input": {
|
|
1537
|
-
"file_path": "C:\\git\\bedrock-wrapper\\bedrock-wrapper.js",
|
|
1538
|
-
"offset": 510,
|
|
1539
|
-
"limit": 80
|
|
1540
|
-
}
|
|
1541
|
-
},
|
|
1542
|
-
{
|
|
1543
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
1544
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
1545
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
1546
|
-
"hook_event_name": "PreToolUse",
|
|
1547
|
-
"tool_name": "MultiEdit",
|
|
1548
|
-
"tool_input": {
|
|
1549
|
-
"file_path": "C:\\git\\bedrock-wrapper\\bedrock-wrapper.js",
|
|
1550
|
-
"edits": [
|
|
1551
|
-
{
|
|
1552
|
-
"old_string": " // Build simple inference configuration (no model-specific parameters)\n const inferenceConfig = {\n maxTokens: max_gen_tokens,\n temperature: temperature,\n ...(top_p !== undefined && { topP: top_p })\n };",
|
|
1553
|
-
"new_string": " // Build inference configuration (handle thinking mode for Claude models)\n const inferenceConfig = {\n maxTokens: max_gen_tokens,\n temperature: temperature,\n ...(top_p !== undefined && { topP: top_p })\n };\n \n // Handle thinking mode for Claude models\n if (awsModel.special_request_schema?.thinking?.type === \"enabled\") {\n // Apply thinking mode constraints for Converse API\n inferenceConfig.temperature = 1; // temperature must be 1 for thinking\n delete inferenceConfig.topP; // top_p must be unset for thinking\n \n // Add thinking budget configuration\n let budget_tokens = awsModel.special_request_schema?.thinking?.budget_tokens;\n if (budget_tokens > (max_gen_tokens * 0.8)) {\n budget_tokens = Math.floor(max_gen_tokens * 0.8);\n }\n if (budget_tokens < 1024) {\n budget_tokens = 1024;\n }\n \n // Ensure max tokens is sufficient for thinking\n if (inferenceConfig.maxTokens <= budget_tokens) {\n inferenceConfig.maxTokens = Math.floor(budget_tokens * 1.2);\n }\n }"
|
|
1554
|
-
},
|
|
1555
|
-
{
|
|
1556
|
-
"old_string": " for await (const event of responseStream.stream) {\n if (event.contentBlockDelta) {\n const text = event.contentBlockDelta.delta?.text;\n if (text) {\n // Only process reasoning tags for GPT-OSS models (minimal model-specific logic)\n const processedText = processReasoningTags(text, awsModel);\n if (processedText) {\n yield processedText;\n }\n }\n }\n }",
|
|
1557
|
-
"new_string": " let is_thinking = false;\n let should_think = include_thinking_data && awsModel.special_request_schema?.thinking?.type === \"enabled\";\n \n for await (const event of responseStream.stream) {\n if (event.contentBlockDelta) {\n const text = event.contentBlockDelta.delta?.text;\n const thinking = event.contentBlockDelta.delta?.thinking;\n \n // Handle Claude thinking data (streaming)\n if (should_think && thinking) {\n if (!is_thinking) {\n is_thinking = true;\n yield `<think>${thinking}`;\n } else {\n yield thinking;\n }\n }\n // Handle regular text content\n else if (text) {\n // End thinking mode if we were in it\n if (is_thinking) {\n is_thinking = false;\n yield `</think>\\n\\n${text}`;\n } else {\n // Process reasoning tags for GPT-OSS models only\n const processedText = processReasoningTags(text, awsModel);\n if (processedText) {\n yield processedText;\n }\n }\n }\n }\n }\n \n // Close thinking tag if still open\n if (is_thinking) {\n yield \"</think>\";\n }"
|
|
1558
|
-
},
|
|
1559
|
-
{
|
|
1560
|
-
"old_string": " // Extract text from response (simple, unified response format)\n if (response.output && response.output.message && response.output.message.content) {\n for (const contentBlock of response.output.message.content) {\n if (contentBlock.text) {\n // Only process reasoning tags for GPT-OSS models (minimal model-specific logic)\n const processedText = processReasoningTags(contentBlock.text, awsModel);\n if (processedText) {\n yield processedText;\n }\n }\n }\n }",
|
|
1561
|
-
"new_string": " // Extract text and thinking from response (handle Claude thinking)\n if (response.output && response.output.message && response.output.message.content) {\n let thinking_result = \"\";\n let text_result = \"\";\n \n for (const contentBlock of response.output.message.content) {\n // Extract thinking data for Claude models\n if (include_thinking_data && contentBlock.thinking && \n awsModel.special_request_schema?.thinking?.type === \"enabled\") {\n thinking_result += contentBlock.thinking;\n }\n \n // Extract regular text content\n if (contentBlock.text) {\n text_result += contentBlock.text;\n }\n }\n \n // Process reasoning tags for GPT-OSS models\n text_result = processReasoningTags(text_result, awsModel);\n \n // Combine thinking and text for Claude models\n let result = thinking_result ? `<think>${thinking_result}</think>\\n\\n${text_result}` : text_result;\n \n if (result) {\n yield result;\n }\n }"
|
|
1562
|
-
},
|
|
1563
|
-
{
|
|
1564
|
-
"old_string": " if (useConverseAPI) {\n // Convert messages to Converse API format (no model-specific complexity)\n const { messages: converseMessages, system: systemPrompts } = await convertToConverseFormat(messages);",
|
|
1565
|
-
"new_string": " if (useConverseAPI) {\n // Convert messages to Converse API format\n const { messages: converseMessages, system: systemPrompts } = await convertToConverseFormat(messages);"
|
|
1566
|
-
},
|
|
1567
|
-
{
|
|
1568
|
-
"old_string": " // Build the Converse API request (simple, unified format)",
|
|
1569
|
-
"new_string": " // Build the Converse API request"
|
|
1570
|
-
}
|
|
1571
|
-
]
|
|
1572
|
-
}
|
|
1573
|
-
},
|
|
1574
|
-
{
|
|
1575
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
1576
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
1577
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
1578
|
-
"hook_event_name": "PreToolUse",
|
|
1579
|
-
"tool_name": "TodoWrite",
|
|
1580
|
-
"tool_input": {
|
|
1581
|
-
"todos": [
|
|
1582
|
-
{
|
|
1583
|
-
"content": "Investigate Claude thinking tags missing in Converse API",
|
|
1584
|
-
"status": "completed",
|
|
1585
|
-
"id": "11"
|
|
1586
|
-
}
|
|
1587
|
-
]
|
|
1588
|
-
}
|
|
1589
|
-
},
|
|
1590
|
-
{
|
|
1591
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
1592
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
1593
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
1594
|
-
"hook_event_name": "PreToolUse",
|
|
1595
|
-
"tool_name": "Write",
|
|
1596
|
-
"tool_input": {
|
|
1597
|
-
"file_path": "C:\\git\\bedrock-wrapper\\test-thinking-fix.js",
|
|
1598
|
-
"content": "// Quick test to verify Claude thinking tags work with Converse API\nimport { bedrockWrapper } from \"./bedrock-wrapper.js\";\nimport dotenv from 'dotenv';\n\ndotenv.config();\n\nconst awsCreds = {\n region: process.env.AWS_REGION,\n accessKeyId: process.env.AWS_ACCESS_KEY_ID,\n secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,\n};\n\nasync function testThinking() {\n const messages = [{ role: \"user\", content: \"Think step by step about what 2+2 equals. Be very thorough in your reasoning.\" }];\n \n const openaiChatCompletionsCreateObject = {\n messages,\n model: \"Claude-4-1-Opus\",\n max_tokens: 1000,\n stream: false,\n temperature: 0.7,\n include_thinking_data: true\n };\n\n console.log(\"Testing Claude-4-1-Opus thinking with Invoke API:\");\n console.log(\"=\".repeat(60));\n \n try {\n let response = \"\";\n for await (const chunk of bedrockWrapper(awsCreds, openaiChatCompletionsCreateObject, { logging: false, useConverseAPI: false })) {\n response += chunk;\n }\n console.log(\"Invoke API Response:\");\n console.log(response);\n console.log(\"\\\\nContains <think> tags:\", response.includes(\"<think>\"));\n } catch (error) {\n console.log(\"Invoke API Error:\", error.message);\n }\n\n console.log(\"\\\\n\" + \"=\".repeat(60));\n console.log(\"Testing Claude-4-1-Opus thinking with Converse API:\");\n console.log(\"=\".repeat(60));\n \n try {\n let response = \"\";\n for await (const chunk of bedrockWrapper(awsCreds, openaiChatCompletionsCreateObject, { logging: false, useConverseAPI: true })) {\n response += chunk;\n }\n console.log(\"Converse API Response:\");\n console.log(response);\n console.log(\"\\\\nContains <think> tags:\", response.includes(\"<think>\"));\n } catch (error) {\n console.log(\"Converse API Error:\", error.message);\n }\n}\n\ntestThinking().catch(console.error);"
|
|
1599
|
-
}
|
|
1600
|
-
},
|
|
1601
|
-
{
|
|
1602
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
1603
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
1604
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
1605
|
-
"hook_event_name": "PreToolUse",
|
|
1606
|
-
"tool_name": "Bash",
|
|
1607
|
-
"tool_input": {
|
|
1608
|
-
"command": "node test-thinking-fix.js",
|
|
1609
|
-
"description": "Test Claude thinking tags fix with both APIs"
|
|
1610
|
-
}
|
|
1611
|
-
},
|
|
1612
|
-
{
|
|
1613
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
1614
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
1615
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
1616
|
-
"hook_event_name": "PreToolUse",
|
|
1617
|
-
"tool_name": "Grep",
|
|
1618
|
-
"tool_input": {
|
|
1619
|
-
"pattern": "Claude.*thinking.*enabled",
|
|
1620
|
-
"glob": "bedrock-models.js",
|
|
1621
|
-
"output_mode": "content",
|
|
1622
|
-
"-B": 10,
|
|
1623
|
-
"-A": 3
|
|
1624
|
-
}
|
|
1625
|
-
},
|
|
1626
|
-
{
|
|
1627
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
1628
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
1629
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
1630
|
-
"hook_event_name": "PreToolUse",
|
|
1631
|
-
"tool_name": "Grep",
|
|
1632
|
-
"tool_input": {
|
|
1633
|
-
"pattern": "\"type\": \"enabled\"",
|
|
1634
|
-
"glob": "bedrock-models.js",
|
|
1635
|
-
"output_mode": "content",
|
|
1636
|
-
"-B": 15,
|
|
1637
|
-
"-A": 3
|
|
1638
|
-
}
|
|
1639
|
-
},
|
|
1640
|
-
{
|
|
1641
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
1642
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
1643
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
1644
|
-
"hook_event_name": "PreToolUse",
|
|
1645
|
-
"tool_name": "Grep",
|
|
1646
|
-
"tool_input": {
|
|
1647
|
-
"pattern": "\"modelName\"",
|
|
1648
|
-
"glob": "bedrock-models.js",
|
|
1649
|
-
"output_mode": "content",
|
|
1650
|
-
"-A": 40,
|
|
1651
|
-
"-n": true
|
|
1652
|
-
}
|
|
1653
|
-
},
|
|
1654
|
-
{
|
|
1655
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
1656
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
1657
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
1658
|
-
"hook_event_name": "PreToolUse",
|
|
1659
|
-
"tool_name": "Edit",
|
|
1660
|
-
"tool_input": {
|
|
1661
|
-
"file_path": "C:\\git\\bedrock-wrapper\\test-thinking-fix.js",
|
|
1662
|
-
"old_string": " model: \"Claude-4-1-Opus\",",
|
|
1663
|
-
"new_string": " model: \"Claude-4-1-Opus-Thinking\","
|
|
1664
|
-
}
|
|
1665
|
-
},
|
|
1666
|
-
{
|
|
1667
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
1668
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
1669
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
1670
|
-
"hook_event_name": "PreToolUse",
|
|
1671
|
-
"tool_name": "Edit",
|
|
1672
|
-
"tool_input": {
|
|
1673
|
-
"file_path": "C:\\git\\bedrock-wrapper\\test-thinking-fix.js",
|
|
1674
|
-
"old_string": " console.log(\"Testing Claude-4-1-Opus thinking with Invoke API:\");",
|
|
1675
|
-
"new_string": " console.log(\"Testing Claude-4-1-Opus-Thinking with Invoke API:\");"
|
|
1676
|
-
}
|
|
1677
|
-
},
|
|
1678
|
-
{
|
|
1679
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
1680
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
1681
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
1682
|
-
"hook_event_name": "PreToolUse",
|
|
1683
|
-
"tool_name": "Edit",
|
|
1684
|
-
"tool_input": {
|
|
1685
|
-
"file_path": "C:\\git\\bedrock-wrapper\\test-thinking-fix.js",
|
|
1686
|
-
"old_string": " console.log(\"Testing Claude-4-1-Opus thinking with Converse API:\");",
|
|
1687
|
-
"new_string": " console.log(\"Testing Claude-4-1-Opus-Thinking with Converse API:\");"
|
|
1688
|
-
}
|
|
1689
|
-
},
|
|
1690
|
-
{
|
|
1691
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
1692
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
1693
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
1694
|
-
"hook_event_name": "PreToolUse",
|
|
1695
|
-
"tool_name": "Bash",
|
|
1696
|
-
"tool_input": {
|
|
1697
|
-
"command": "node test-thinking-fix.js",
|
|
1698
|
-
"description": "Test Claude thinking tags fix with correct thinking model"
|
|
1699
|
-
}
|
|
1700
|
-
},
|
|
1701
|
-
{
|
|
1702
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
1703
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
1704
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
1705
|
-
"hook_event_name": "PreToolUse",
|
|
1706
|
-
"tool_name": "Edit",
|
|
1707
|
-
"tool_input": {
|
|
1708
|
-
"file_path": "C:\\git\\bedrock-wrapper\\test-thinking-fix.js",
|
|
1709
|
-
"old_string": " for await (const chunk of bedrockWrapper(awsCreds, openaiChatCompletionsCreateObject, { logging: false, useConverseAPI: true })) {",
|
|
1710
|
-
"new_string": " for await (const chunk of bedrockWrapper(awsCreds, openaiChatCompletionsCreateObject, { logging: true, useConverseAPI: true })) {"
|
|
1711
|
-
}
|
|
1712
|
-
},
|
|
1713
|
-
{
|
|
1714
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
1715
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
1716
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
1717
|
-
"hook_event_name": "PreToolUse",
|
|
1718
|
-
"tool_name": "Bash",
|
|
1719
|
-
"tool_input": {
|
|
1720
|
-
"command": "node test-thinking-fix.js",
|
|
1721
|
-
"description": "Test with logging enabled to see Converse API response structure"
|
|
1722
|
-
}
|
|
1723
|
-
},
|
|
1724
|
-
{
|
|
1725
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
1726
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
1727
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
1728
|
-
"hook_event_name": "PreToolUse",
|
|
1729
|
-
"tool_name": "mcp__context7__resolve-library-id",
|
|
1730
|
-
"tool_input": {
|
|
1731
|
-
"libraryName": "AWS Bedrock Converse API thinking mode"
|
|
1732
|
-
}
|
|
1733
|
-
},
|
|
1734
|
-
{
|
|
1735
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
1736
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
1737
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
1738
|
-
"hook_event_name": "PreToolUse",
|
|
1739
|
-
"tool_name": "mcp__context7__get-library-docs",
|
|
1740
|
-
"tool_input": {
|
|
1741
|
-
"context7CompatibleLibraryID": "/aws-samples/amazon-bedrock-samples",
|
|
1742
|
-
"topic": "converse api thinking mode claude",
|
|
1743
|
-
"tokens": 5000
|
|
1744
|
-
}
|
|
1745
|
-
},
|
|
1746
|
-
{
|
|
1747
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
1748
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
1749
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
1750
|
-
"hook_event_name": "PreToolUse",
|
|
1751
|
-
"tool_name": "WebSearch",
|
|
1752
|
-
"tool_input": {
|
|
1753
|
-
"query": "AWS Bedrock Claude thinking mode Converse API anthropic_beta headers"
|
|
1754
|
-
}
|
|
1755
|
-
},
|
|
1756
|
-
{
|
|
1757
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
1758
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
1759
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
1760
|
-
"hook_event_name": "PreToolUse",
|
|
1761
|
-
"tool_name": "WebFetch",
|
|
1762
|
-
"tool_input": {
|
|
1763
|
-
"url": "https://docs.aws.amazon.com/bedrock/latest/userguide/claude-messages-extended-thinking.html",
|
|
1764
|
-
"prompt": "How to configure extended thinking mode for Claude models in AWS Bedrock, specifically for the Converse API, including any special parameters, headers, or configuration requirements"
|
|
1765
|
-
}
|
|
1766
|
-
},
|
|
1767
|
-
{
|
|
1768
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
1769
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
1770
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
1771
|
-
"hook_event_name": "PreToolUse",
|
|
1772
|
-
"tool_name": "Read",
|
|
1773
|
-
"tool_input": {
|
|
1774
|
-
"file_path": "C:\\git\\bedrock-wrapper\\bedrock-wrapper.js",
|
|
1775
|
-
"offset": 540,
|
|
1776
|
-
"limit": 50
|
|
1777
|
-
}
|
|
1778
|
-
},
|
|
1779
|
-
{
|
|
1780
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
1781
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
1782
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
1783
|
-
"hook_event_name": "PreToolUse",
|
|
1784
|
-
"tool_name": "Grep",
|
|
1785
|
-
"tool_input": {
|
|
1786
|
-
"pattern": "Add system prompts if any",
|
|
1787
|
-
"glob": "bedrock-wrapper.js",
|
|
1788
|
-
"output_mode": "content",
|
|
1789
|
-
"-B": 1,
|
|
1790
|
-
"-A": 3,
|
|
1791
|
-
"-n": true
|
|
1792
|
-
}
|
|
1793
|
-
},
|
|
1794
|
-
{
|
|
1795
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
1796
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
1797
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
1798
|
-
"hook_event_name": "PreToolUse",
|
|
1799
|
-
"tool_name": "Read",
|
|
1800
|
-
"tool_input": {
|
|
1801
|
-
"file_path": "C:\\git\\bedrock-wrapper\\bedrock-wrapper.js",
|
|
1802
|
-
"offset": 555,
|
|
1803
|
-
"limit": 10
|
|
1804
|
-
}
|
|
1805
|
-
},
|
|
1806
|
-
{
|
|
1807
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
1808
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
1809
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
1810
|
-
"hook_event_name": "PreToolUse",
|
|
1811
|
-
"tool_name": "Bash",
|
|
1812
|
-
"tool_input": {
|
|
1813
|
-
"command": "sed -n '557,559p' bedrock-wrapper.js | cat -A",
|
|
1814
|
-
"description": "Check exact whitespace characters in the file"
|
|
1815
|
-
}
|
|
1816
|
-
},
|
|
1817
|
-
{
|
|
1818
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
1819
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
1820
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
1821
|
-
"hook_event_name": "PreToolUse",
|
|
1822
|
-
"tool_name": "Bash",
|
|
1823
|
-
"tool_input": {
|
|
1824
|
-
"command": "sed -n '558,562p' bedrock-wrapper.js | cat -A",
|
|
1825
|
-
"description": "Check exact whitespace characters around the insertion point"
|
|
1826
|
-
}
|
|
1827
|
-
},
|
|
1828
|
-
{
|
|
1829
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
1830
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
1831
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
1832
|
-
"hook_event_name": "PreToolUse",
|
|
1833
|
-
"tool_name": "Bash",
|
|
1834
|
-
"tool_input": {
|
|
1835
|
-
"command": "hexdump -C bedrock-wrapper.js | sed -n '2800,2850p'",
|
|
1836
|
-
"description": "Check hexdump to understand whitespace issues"
|
|
1837
|
-
}
|
|
1838
|
-
},
|
|
1839
|
-
{
|
|
1840
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
1841
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
1842
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
1843
|
-
"hook_event_name": "PreToolUse",
|
|
1844
|
-
"tool_name": "Read",
|
|
1845
|
-
"tool_input": {
|
|
1846
|
-
"file_path": "C:\\git\\bedrock-wrapper\\bedrock-wrapper.js",
|
|
1847
|
-
"offset": 556,
|
|
1848
|
-
"limit": 8
|
|
1849
|
-
}
|
|
1850
|
-
},
|
|
1851
|
-
{
|
|
1852
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
1853
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
1854
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
1855
|
-
"hook_event_name": "PreToolUse",
|
|
1856
|
-
"tool_name": "MultiEdit",
|
|
1857
|
-
"tool_input": {
|
|
1858
|
-
"file_path": "C:\\git\\bedrock-wrapper\\bedrock-wrapper.js",
|
|
1859
|
-
"edits": [
|
|
1860
|
-
{
|
|
1861
|
-
"old_string": " }\n \n if (logging) {",
|
|
1862
|
-
"new_string": " }\n \n // Add thinking configuration for Claude models (via additionalModelRequestFields)\n if (awsModel.special_request_schema?.thinking?.type === \"enabled\") {\n let budget_tokens = awsModel.special_request_schema?.thinking?.budget_tokens;\n if (budget_tokens > (inferenceConfig.maxTokens * 0.8)) {\n budget_tokens = Math.floor(inferenceConfig.maxTokens * 0.8);\n }\n if (budget_tokens < 1024) {\n budget_tokens = 1024;\n }\n \n converseRequest.additionalModelRequestFields = {\n thinking: {\n type: \"enabled\",\n budget_tokens: budget_tokens\n }\n };\n \n // Add anthropic_beta headers for thinking mode\n if (awsModel.special_request_schema?.anthropic_beta) {\n converseRequest.additionalModelRequestFields.anthropic_beta = awsModel.special_request_schema.anthropic_beta;\n }\n }\n \n if (logging) {"
|
|
1863
|
-
}
|
|
1864
|
-
]
|
|
1865
|
-
}
|
|
1866
|
-
},
|
|
1867
|
-
{
|
|
1868
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
1869
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
1870
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
1871
|
-
"hook_event_name": "PreToolUse",
|
|
1872
|
-
"tool_name": "Bash",
|
|
1873
|
-
"tool_input": {
|
|
1874
|
-
"command": "node test-thinking-fix.js",
|
|
1875
|
-
"description": "Test the thinking fix with Converse API"
|
|
1876
|
-
}
|
|
1877
|
-
},
|
|
1878
|
-
{
|
|
1879
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
1880
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
1881
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
1882
|
-
"hook_event_name": "PreToolUse",
|
|
1883
|
-
"tool_name": "MultiEdit",
|
|
1884
|
-
"tool_input": {
|
|
1885
|
-
"file_path": "C:\\git\\bedrock-wrapper\\bedrock-wrapper.js",
|
|
1886
|
-
"edits": [
|
|
1887
|
-
{
|
|
1888
|
-
"old_string": " // Extract text and thinking from response (handle Claude thinking)\n if (response.output && response.output.message && response.output.message.content) {\n let thinking_result = \"\";\n let text_result = \"\";\n \n for (const contentBlock of response.output.message.content) {\n // Extract thinking data for Claude models\n if (include_thinking_data && contentBlock.thinking && \n awsModel.special_request_schema?.thinking?.type === \"enabled\") {\n thinking_result += contentBlock.thinking;\n }\n \n // Extract regular text content\n if (contentBlock.text) {\n text_result += contentBlock.text;\n }\n }\n \n // Process reasoning tags for GPT-OSS models\n text_result = processReasoningTags(text_result, awsModel);\n \n // Combine thinking and text for Claude models\n let result = thinking_result ? `<think>${thinking_result}</think>\\n\\n${text_result}` : text_result;\n \n if (result) {\n yield result;\n }\n }",
|
|
1889
|
-
"new_string": " // Extract text and thinking from response (handle Claude thinking)\n if (response.output && response.output.message && response.output.message.content) {\n let thinking_result = \"\";\n let text_result = \"\";\n \n for (const contentBlock of response.output.message.content) {\n // Extract thinking data for Claude models (from reasoningContent)\n if (include_thinking_data && contentBlock.reasoningContent && \n awsModel.special_request_schema?.thinking?.type === \"enabled\") {\n const reasoningText = contentBlock.reasoningContent.reasoningText?.text;\n if (reasoningText) {\n thinking_result += reasoningText;\n }\n }\n \n // Also check for legacy thinking field format\n if (include_thinking_data && contentBlock.thinking && \n awsModel.special_request_schema?.thinking?.type === \"enabled\") {\n thinking_result += contentBlock.thinking;\n }\n \n // Extract regular text content\n if (contentBlock.text) {\n text_result += contentBlock.text;\n }\n }\n \n // Process reasoning tags for GPT-OSS models\n text_result = processReasoningTags(text_result, awsModel);\n \n // Combine thinking and text for Claude models\n let result = thinking_result ? `<think>${thinking_result}</think>\\n\\n${text_result}` : text_result;\n \n if (result) {\n yield result;\n }\n }"
|
|
1890
|
-
}
|
|
1891
|
-
]
|
|
1892
|
-
}
|
|
1893
|
-
},
|
|
1894
|
-
{
|
|
1895
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
1896
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
1897
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
1898
|
-
"hook_event_name": "PreToolUse",
|
|
1899
|
-
"tool_name": "Grep",
|
|
1900
|
-
"tool_input": {
|
|
1901
|
-
"pattern": "Handle Claude thinking data.*streaming",
|
|
1902
|
-
"glob": "bedrock-wrapper.js",
|
|
1903
|
-
"output_mode": "content",
|
|
1904
|
-
"-A": 10,
|
|
1905
|
-
"-n": true
|
|
1906
|
-
}
|
|
1907
|
-
},
|
|
1908
|
-
{
|
|
1909
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
1910
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
1911
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
1912
|
-
"hook_event_name": "PreToolUse",
|
|
1913
|
-
"tool_name": "Read",
|
|
1914
|
-
"tool_input": {
|
|
1915
|
-
"file_path": "C:\\git\\bedrock-wrapper\\bedrock-wrapper.js",
|
|
1916
|
-
"offset": 595,
|
|
1917
|
-
"limit": 20
|
|
1918
|
-
}
|
|
1919
|
-
},
|
|
1920
|
-
{
|
|
1921
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
1922
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
1923
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
1924
|
-
"hook_event_name": "PreToolUse",
|
|
1925
|
-
"tool_name": "Edit",
|
|
1926
|
-
"tool_input": {
|
|
1927
|
-
"file_path": "C:\\git\\bedrock-wrapper\\bedrock-wrapper.js",
|
|
1928
|
-
"old_string": " const thinking = event.contentBlockDelta.delta?.thinking;",
|
|
1929
|
-
"new_string": " const thinking = event.contentBlockDelta.delta?.thinking;\\n const reasoningContent = event.contentBlockDelta.delta?.reasoningContent;"
|
|
1930
|
-
}
|
|
1931
|
-
},
|
|
1932
|
-
{
|
|
1933
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
1934
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
1935
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
1936
|
-
"hook_event_name": "PreToolUse",
|
|
1937
|
-
"tool_name": "Edit",
|
|
1938
|
-
"tool_input": {
|
|
1939
|
-
"file_path": "C:\\git\\bedrock-wrapper\\bedrock-wrapper.js",
|
|
1940
|
-
"old_string": " if (should_think && thinking) {",
|
|
1941
|
-
"new_string": " // Handle Claude thinking data (streaming) - check both reasoningContent and thinking\\n const thinkingText = reasoningContent?.reasoningText?.text || thinking;\\n if (should_think && thinkingText) {"
|
|
1942
|
-
}
|
|
1943
|
-
},
|
|
1944
|
-
{
|
|
1945
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
1946
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
1947
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
1948
|
-
"hook_event_name": "PreToolUse",
|
|
1949
|
-
"tool_name": "Edit",
|
|
1950
|
-
"tool_input": {
|
|
1951
|
-
"file_path": "C:\\git\\bedrock-wrapper\\bedrock-wrapper.js",
|
|
1952
|
-
"old_string": " yield `<think>${thinking}`;",
|
|
1953
|
-
"new_string": " yield `<think>${thinkingText}`;"
|
|
1954
|
-
}
|
|
1955
|
-
},
|
|
1956
|
-
{
|
|
1957
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
1958
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
1959
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
1960
|
-
"hook_event_name": "PreToolUse",
|
|
1961
|
-
"tool_name": "Edit",
|
|
1962
|
-
"tool_input": {
|
|
1963
|
-
"file_path": "C:\\git\\bedrock-wrapper\\bedrock-wrapper.js",
|
|
1964
|
-
"old_string": " yield thinking;",
|
|
1965
|
-
"new_string": " yield thinkingText;"
|
|
1966
|
-
}
|
|
1967
|
-
},
|
|
1968
|
-
{
|
|
1969
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
1970
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
1971
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
1972
|
-
"hook_event_name": "PreToolUse",
|
|
1973
|
-
"tool_name": "Bash",
|
|
1974
|
-
"tool_input": {
|
|
1975
|
-
"command": "node test-thinking-fix.js",
|
|
1976
|
-
"description": "Test the updated thinking fix"
|
|
1977
|
-
}
|
|
1978
|
-
},
|
|
1979
|
-
{
|
|
1980
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
1981
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
1982
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
1983
|
-
"hook_event_name": "PreToolUse",
|
|
1984
|
-
"tool_name": "Read",
|
|
1985
|
-
"tool_input": {
|
|
1986
|
-
"file_path": "C:\\git\\bedrock-wrapper\\bedrock-wrapper.js",
|
|
1987
|
-
"offset": 596,
|
|
1988
|
-
"limit": 10
|
|
1989
|
-
}
|
|
1990
|
-
},
|
|
1991
|
-
{
|
|
1992
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
1993
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
1994
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
1995
|
-
"hook_event_name": "PreToolUse",
|
|
1996
|
-
"tool_name": "Bash",
|
|
1997
|
-
"tool_input": {
|
|
1998
|
-
"command": "sed -i 's/\\\\\\\\n/\\n/g' bedrock-wrapper.js",
|
|
1999
|
-
"description": "Fix literal backslash-n to actual newlines"
|
|
2000
|
-
}
|
|
2001
|
-
},
|
|
2002
|
-
{
|
|
2003
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
2004
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
2005
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
2006
|
-
"hook_event_name": "PreToolUse",
|
|
2007
|
-
"tool_name": "Read",
|
|
2008
|
-
"tool_input": {
|
|
2009
|
-
"file_path": "C:\\git\\bedrock-wrapper\\bedrock-wrapper.js",
|
|
2010
|
-
"offset": 596,
|
|
2011
|
-
"limit": 10
|
|
2012
|
-
}
|
|
2013
|
-
},
|
|
2014
|
-
{
|
|
2015
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
2016
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
2017
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
2018
|
-
"hook_event_name": "PreToolUse",
|
|
2019
|
-
"tool_name": "Bash",
|
|
2020
|
-
"tool_input": {
|
|
2021
|
-
"command": "git checkout bedrock-wrapper.js",
|
|
2022
|
-
"description": "Revert file to clean state"
|
|
2023
|
-
}
|
|
2024
|
-
},
|
|
2025
|
-
{
|
|
2026
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
2027
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
2028
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
2029
|
-
"hook_event_name": "PreToolUse",
|
|
2030
|
-
"tool_name": "TodoWrite",
|
|
2031
|
-
"tool_input": {
|
|
2032
|
-
"todos": [
|
|
2033
|
-
{
|
|
2034
|
-
"content": "Fix Claude thinking tags in Converse API - part 2",
|
|
2035
|
-
"status": "in_progress",
|
|
2036
|
-
"id": "12"
|
|
2037
|
-
}
|
|
2038
|
-
]
|
|
2039
|
-
}
|
|
2040
|
-
},
|
|
2041
|
-
{
|
|
2042
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
2043
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
2044
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
2045
|
-
"hook_event_name": "PreToolUse",
|
|
2046
|
-
"tool_name": "Read",
|
|
2047
|
-
"tool_input": {
|
|
2048
|
-
"file_path": "C:\\git\\bedrock-wrapper\\bedrock-wrapper.js",
|
|
2049
|
-
"offset": 555,
|
|
2050
|
-
"limit": 15
|
|
2051
|
-
}
|
|
2052
|
-
},
|
|
2053
|
-
{
|
|
2054
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
2055
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
2056
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
2057
|
-
"hook_event_name": "PreToolUse",
|
|
2058
|
-
"tool_name": "Grep",
|
|
2059
|
-
"tool_input": {
|
|
2060
|
-
"pattern": "Build the Converse API request",
|
|
2061
|
-
"glob": "bedrock-wrapper.js",
|
|
2062
|
-
"output_mode": "content",
|
|
2063
|
-
"-B": 2,
|
|
2064
|
-
"-A": 10,
|
|
2065
|
-
"-n": true
|
|
2066
|
-
}
|
|
2067
|
-
},
|
|
2068
|
-
{
|
|
2069
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
2070
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
2071
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
2072
|
-
"hook_event_name": "PreToolUse",
|
|
2073
|
-
"tool_name": "Read",
|
|
2074
|
-
"tool_input": {
|
|
2075
|
-
"file_path": "C:\\git\\bedrock-wrapper\\bedrock-wrapper.js",
|
|
2076
|
-
"offset": 534,
|
|
2077
|
-
"limit": 10
|
|
2078
|
-
}
|
|
2079
|
-
},
|
|
2080
|
-
{
|
|
2081
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
2082
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
2083
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
2084
|
-
"hook_event_name": "PreToolUse",
|
|
2085
|
-
"tool_name": "Bash",
|
|
2086
|
-
"tool_input": {
|
|
2087
|
-
"command": "sed -n '535,542p' bedrock-wrapper.js | cat -A",
|
|
2088
|
-
"description": "Check exact formatting around the Converse API section"
|
|
2089
|
-
}
|
|
2090
|
-
},
|
|
2091
|
-
{
|
|
2092
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
2093
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
2094
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
2095
|
-
"hook_event_name": "PreToolUse",
|
|
2096
|
-
"tool_name": "Bash",
|
|
2097
|
-
"tool_input": {
|
|
2098
|
-
"command": "node test-thinking-fix.js",
|
|
2099
|
-
"description": "Test current state without thinking config"
|
|
2100
|
-
}
|
|
2101
|
-
},
|
|
2102
|
-
{
|
|
2103
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
2104
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
2105
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
2106
|
-
"hook_event_name": "PreToolUse",
|
|
2107
|
-
"tool_name": "Write",
|
|
2108
|
-
"tool_input": {
|
|
2109
|
-
"file_path": "C:\\git\\bedrock-wrapper\\test-thinking-manual.js",
|
|
2110
|
-
"content": "// Manual test to confirm thinking configuration works\nimport { BedrockRuntimeClient, ConverseCommand } from '@aws-sdk/client-bedrock-runtime';\nimport dotenv from 'dotenv';\n\ndotenv.config();\n\nconst awsCreds = {\n region: process.env.AWS_REGION,\n accessKeyId: process.env.AWS_ACCESS_KEY_ID,\n secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,\n};\n\nasync function testThinkingManual() {\n const client = new BedrockRuntimeClient({\n region: awsCreds.region,\n credentials: {\n accessKeyId: awsCreds.accessKeyId,\n secretAccessKey: awsCreds.secretAccessKey,\n }\n });\n\n const converseRequest = {\n modelId: \"us.anthropic.claude-opus-4-1-20250805-v1:0\",\n messages: [\n {\n role: \"user\",\n content: [\n {\n text: \"Think step by step about what 2+2 equals. Be very thorough in your reasoning.\"\n }\n ]\n }\n ],\n inferenceConfig: {\n maxTokens: 1000,\n temperature: 1 \n },\n additionalModelRequestFields: {\n thinking: {\n type: \"enabled\",\n budget_tokens: 1024\n },\n anthropic_beta: [\"output-128k-2025-02-19\"]\n }\n };\n\n console.log(\"Manual Converse API request:\", JSON.stringify(converseRequest, null, 2));\n\n try {\n const response = await client.send(new ConverseCommand(converseRequest));\n \n console.log(\"Manual Converse API response:\", JSON.stringify(response, null, 2));\n \n // Extract thinking and text\n let thinking_result = \"\";\n let text_result = \"\";\n \n for (const contentBlock of response.output.message.content) {\n if (contentBlock.reasoningContent) {\n const reasoningText = contentBlock.reasoningContent.reasoningText?.text;\n if (reasoningText) {\n thinking_result += reasoningText;\n }\n }\n \n if (contentBlock.text) {\n text_result += contentBlock.text;\n }\n }\n \n // Combine thinking and text\n let result = thinking_result ? `<think>${thinking_result}</think>\\n\\n${text_result}` : text_result;\n \n console.log(\"\\nFinal formatted response:\");\n console.log(result);\n console.log(`\\nContains <think> tags: ${result.includes(\"<think>\")}`);\n \n } catch (error) {\n console.error(\"Error:\", error.message);\n }\n}\n\ntestThinkingManual().catch(console.error);"
|
|
2111
|
-
}
|
|
2112
|
-
},
|
|
2113
|
-
{
|
|
2114
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
2115
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
2116
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
2117
|
-
"hook_event_name": "PreToolUse",
|
|
2118
|
-
"tool_name": "Bash",
|
|
2119
|
-
"tool_input": {
|
|
2120
|
-
"command": "node test-thinking-manual.js",
|
|
2121
|
-
"description": "Test manual thinking configuration"
|
|
2122
|
-
}
|
|
2123
|
-
},
|
|
2124
|
-
{
|
|
2125
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
2126
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
2127
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
2128
|
-
"hook_event_name": "PreToolUse",
|
|
2129
|
-
"tool_name": "Edit",
|
|
2130
|
-
"tool_input": {
|
|
2131
|
-
"file_path": "C:\\git\\bedrock-wrapper\\test-thinking-manual.js",
|
|
2132
|
-
"old_string": " maxTokens: 1000,",
|
|
2133
|
-
"new_string": " maxTokens: 2000,"
|
|
2134
|
-
}
|
|
2135
|
-
},
|
|
2136
|
-
{
|
|
2137
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
2138
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
2139
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
2140
|
-
"hook_event_name": "PreToolUse",
|
|
2141
|
-
"tool_name": "Bash",
|
|
2142
|
-
"tool_input": {
|
|
2143
|
-
"command": "node test-thinking-manual.js",
|
|
2144
|
-
"description": "Test manual thinking configuration with higher maxTokens"
|
|
2145
|
-
}
|
|
2146
|
-
},
|
|
2147
|
-
{
|
|
2148
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
2149
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
2150
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
2151
|
-
"hook_event_name": "PreToolUse",
|
|
2152
|
-
"tool_name": "Write",
|
|
2153
|
-
"tool_input": {
|
|
2154
|
-
"file_path": "C:\\git\\bedrock-wrapper\\thinking-patch.js",
|
|
2155
|
-
"content": "// Simple function to add thinking configuration to converseRequest\nexport function addThinkingConfig(converseRequest, awsModel) {\n if (awsModel.special_request_schema?.thinking?.type === \"enabled\") {\n let budget_tokens = awsModel.special_request_schema?.thinking?.budget_tokens;\n if (budget_tokens > (converseRequest.inferenceConfig.maxTokens * 0.8)) {\n budget_tokens = Math.floor(converseRequest.inferenceConfig.maxTokens * 0.8);\n }\n if (budget_tokens < 1024) {\n budget_tokens = 1024;\n }\n \n // Ensure maxTokens is greater than budget_tokens\n if (converseRequest.inferenceConfig.maxTokens <= budget_tokens) {\n converseRequest.inferenceConfig.maxTokens = Math.floor(budget_tokens * 1.2);\n }\n \n converseRequest.additionalModelRequestFields = {\n thinking: {\n type: \"enabled\",\n budget_tokens: budget_tokens\n }\n };\n \n if (awsModel.special_request_schema?.anthropic_beta) {\n converseRequest.additionalModelRequestFields.anthropic_beta = awsModel.special_request_schema.anthropic_beta;\n }\n }\n}\n\n// Simple function to extract thinking from Converse API response\nexport function extractThinkingFromResponse(contentBlock, include_thinking_data, awsModel) {\n let thinking_result = \"\";\n \n // Extract thinking data for Claude models (from reasoningContent)\n if (include_thinking_data && contentBlock.reasoningContent && \n awsModel.special_request_schema?.thinking?.type === \"enabled\") {\n const reasoningText = contentBlock.reasoningContent.reasoningText?.text;\n if (reasoningText) {\n thinking_result += reasoningText;\n }\n }\n \n // Also check for legacy thinking field format\n if (include_thinking_data && contentBlock.thinking && \n awsModel.special_request_schema?.thinking?.type === \"enabled\") {\n thinking_result += contentBlock.thinking;\n }\n \n return thinking_result;\n}"
|
|
2156
|
-
}
|
|
2157
|
-
},
|
|
2158
|
-
{
|
|
2159
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
2160
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
2161
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
2162
|
-
"hook_event_name": "PreToolUse",
|
|
2163
|
-
"tool_name": "Grep",
|
|
2164
|
-
"tool_input": {
|
|
2165
|
-
"pattern": "import.*bedrock-models",
|
|
2166
|
-
"glob": "bedrock-wrapper.js",
|
|
2167
|
-
"output_mode": "content",
|
|
2168
|
-
"-B": 1,
|
|
2169
|
-
"-A": 3,
|
|
2170
|
-
"-n": true
|
|
2171
|
-
}
|
|
2172
|
-
},
|
|
2173
|
-
{
|
|
2174
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
2175
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
2176
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
2177
|
-
"hook_event_name": "PreToolUse",
|
|
2178
|
-
"tool_name": "Bash",
|
|
2179
|
-
"tool_input": {
|
|
2180
|
-
"command": "grep -n \"bedrock-models\" bedrock-wrapper.js",
|
|
2181
|
-
"description": "Find exact import line format"
|
|
2182
|
-
}
|
|
2183
|
-
},
|
|
2184
|
-
{
|
|
2185
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
2186
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
2187
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
2188
|
-
"hook_event_name": "PreToolUse",
|
|
2189
|
-
"tool_name": "Read",
|
|
2190
|
-
"tool_input": {
|
|
2191
|
-
"file_path": "C:\\git\\bedrock-wrapper\\bedrock-wrapper.js",
|
|
2192
|
-
"offset": 13,
|
|
2193
|
-
"limit": 3
|
|
2194
|
-
}
|
|
2195
|
-
},
|
|
2196
|
-
{
|
|
2197
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
2198
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
2199
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
2200
|
-
"hook_event_name": "PreToolUse",
|
|
2201
|
-
"tool_name": "Edit",
|
|
2202
|
-
"tool_input": {
|
|
2203
|
-
"file_path": "C:\\git\\bedrock-wrapper\\bedrock-wrapper.js",
|
|
2204
|
-
"old_string": "// AWS SDK",
|
|
2205
|
-
"new_string": "import { addThinkingConfig, extractThinkingFromResponse } from \\\"./thinking-patch.js\\\";\\n// AWS SDK"
|
|
2206
|
-
}
|
|
2207
|
-
},
|
|
2208
|
-
{
|
|
2209
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
2210
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
2211
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
2212
|
-
"hook_event_name": "PreToolUse",
|
|
2213
|
-
"tool_name": "Bash",
|
|
2214
|
-
"tool_input": {
|
|
2215
|
-
"command": "git checkout bedrock-wrapper.js",
|
|
2216
|
-
"description": "Revert to clean state again"
|
|
2217
|
-
}
|
|
2218
|
-
},
|
|
2219
|
-
{
|
|
2220
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
2221
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
2222
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
2223
|
-
"hook_event_name": "PreToolUse",
|
|
2224
|
-
"tool_name": "TodoWrite",
|
|
2225
|
-
"tool_input": {
|
|
2226
|
-
"todos": [
|
|
2227
|
-
{
|
|
2228
|
-
"content": "Fix Claude thinking tags in Converse API - part 2",
|
|
2229
|
-
"status": "completed",
|
|
2230
|
-
"id": "12"
|
|
2231
|
-
}
|
|
2232
|
-
]
|
|
2233
|
-
}
|
|
2234
|
-
},
|
|
2235
|
-
{
|
|
2236
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
2237
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
2238
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
2239
|
-
"hook_event_name": "PreToolUse",
|
|
2240
|
-
"tool_name": "TodoWrite",
|
|
2241
|
-
"tool_input": {
|
|
2242
|
-
"todos": [
|
|
2243
|
-
{
|
|
2244
|
-
"content": "Integrate thinking support directly into bedrock-wrapper.js Converse API path",
|
|
2245
|
-
"status": "in_progress",
|
|
2246
|
-
"id": "13"
|
|
2247
|
-
}
|
|
2248
|
-
]
|
|
2249
|
-
}
|
|
2250
|
-
},
|
|
2251
|
-
{
|
|
2252
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
2253
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
2254
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
2255
|
-
"hook_event_name": "PreToolUse",
|
|
2256
|
-
"tool_name": "MultiEdit",
|
|
2257
|
-
"tool_input": {
|
|
2258
|
-
"file_path": "C:\\git\\bedrock-wrapper\\bedrock-wrapper.js",
|
|
2259
|
-
"edits": [
|
|
2260
|
-
{
|
|
2261
|
-
"old_string": " // Build simple inference configuration (no model-specific parameters)\n const inferenceConfig = {\n maxTokens: max_gen_tokens,\n temperature: temperature,\n ...(top_p !== undefined && { topP: top_p })\n };",
|
|
2262
|
-
"new_string": " // Build inference configuration (handle thinking mode for Claude models)\n const inferenceConfig = {\n maxTokens: max_gen_tokens,\n temperature: temperature,\n ...(top_p !== undefined && { topP: top_p })\n };\n \n // Handle thinking mode for Claude models\n if (awsModel.special_request_schema?.thinking?.type === \"enabled\") {\n // Apply thinking mode constraints for Converse API\n inferenceConfig.temperature = 1; // temperature must be 1 for thinking\n delete inferenceConfig.topP; // top_p must be unset for thinking\n \n // Add thinking budget configuration\n let budget_tokens = awsModel.special_request_schema?.thinking?.budget_tokens;\n if (budget_tokens > (max_gen_tokens * 0.8)) {\n budget_tokens = Math.floor(max_gen_tokens * 0.8);\n }\n if (budget_tokens < 1024) {\n budget_tokens = 1024;\n }\n \n // Ensure max tokens is sufficient for thinking\n if (inferenceConfig.maxTokens <= budget_tokens) {\n inferenceConfig.maxTokens = Math.floor(budget_tokens * 1.2);\n }\n }"
|
|
2263
|
-
},
|
|
2264
|
-
{
|
|
2265
|
-
"old_string": " // Add system prompts if any\n if (systemPrompts.length > 0) {\n converseRequest.system = systemPrompts;\n }",
|
|
2266
|
-
"new_string": " // Add system prompts if any\n if (systemPrompts.length > 0) {\n converseRequest.system = systemPrompts;\n }\n \n // Add thinking configuration for Claude models\n if (awsModel.special_request_schema?.thinking?.type === \"enabled\") {\n let budget_tokens = awsModel.special_request_schema?.thinking?.budget_tokens;\n if (budget_tokens > (inferenceConfig.maxTokens * 0.8)) {\n budget_tokens = Math.floor(inferenceConfig.maxTokens * 0.8);\n }\n if (budget_tokens < 1024) {\n budget_tokens = 1024;\n }\n \n converseRequest.additionalModelRequestFields = {\n thinking: {\n type: \"enabled\",\n budget_tokens: budget_tokens\n }\n };\n \n if (awsModel.special_request_schema?.anthropic_beta) {\n converseRequest.additionalModelRequestFields.anthropic_beta = awsModel.special_request_schema.anthropic_beta;\n }\n }"
|
|
2267
|
-
},
|
|
2268
|
-
{
|
|
2269
|
-
"old_string": " for await (const event of responseStream.stream) {\n if (event.contentBlockDelta) {\n const text = event.contentBlockDelta.delta?.text;\n if (text) {\n // Only process reasoning tags for GPT-OSS models (minimal model-specific logic)\n const processedText = processReasoningTags(text, awsModel);\n if (processedText) {\n yield processedText;\n }\n }\n }\n }",
|
|
2270
|
-
"new_string": " let is_thinking = false;\n let should_think = include_thinking_data && awsModel.special_request_schema?.thinking?.type === \"enabled\";\n \n for await (const event of responseStream.stream) {\n if (event.contentBlockDelta) {\n const text = event.contentBlockDelta.delta?.text;\n const thinking = event.contentBlockDelta.delta?.thinking;\n const reasoningContent = event.contentBlockDelta.delta?.reasoningContent;\n \n // Handle Claude thinking data (streaming) - check both reasoningContent and thinking\n const thinkingText = reasoningContent?.reasoningText?.text || thinking;\n if (should_think && thinkingText) {\n if (!is_thinking) {\n is_thinking = true;\n yield `<think>${thinkingText}`;\n } else {\n yield thinkingText;\n }\n }\n // Handle regular text content\n else if (text) {\n // End thinking mode if we were in it\n if (is_thinking) {\n is_thinking = false;\n yield `</think>\\n\\n${text}`;\n } else {\n // Process reasoning tags for GPT-OSS models only\n const processedText = processReasoningTags(text, awsModel);\n if (processedText) {\n yield processedText;\n }\n }\n }\n }\n }\n \n // Close thinking tag if still open\n if (is_thinking) {\n yield \"</think>\";\n }"
|
|
2271
|
-
},
|
|
2272
|
-
{
|
|
2273
|
-
"old_string": " // Extract text from response (simple, unified response format)\n if (response.output && response.output.message && response.output.message.content) {\n for (const contentBlock of response.output.message.content) {\n if (contentBlock.text) {\n // Only process reasoning tags for GPT-OSS models (minimal model-specific logic)\n const processedText = processReasoningTags(contentBlock.text, awsModel);\n if (processedText) {\n yield processedText;\n }\n }\n }\n }",
|
|
2274
|
-
"new_string": " // Extract text and thinking from response (handle Claude thinking)\n if (response.output && response.output.message && response.output.message.content) {\n let thinking_result = \"\";\n let text_result = \"\";\n \n for (const contentBlock of response.output.message.content) {\n // Extract thinking data for Claude models (from reasoningContent)\n if (include_thinking_data && contentBlock.reasoningContent && \n awsModel.special_request_schema?.thinking?.type === \"enabled\") {\n const reasoningText = contentBlock.reasoningContent.reasoningText?.text;\n if (reasoningText) {\n thinking_result += reasoningText;\n }\n }\n \n // Also check for legacy thinking field format\n if (include_thinking_data && contentBlock.thinking && \n awsModel.special_request_schema?.thinking?.type === \"enabled\") {\n thinking_result += contentBlock.thinking;\n }\n \n // Extract regular text content\n if (contentBlock.text) {\n text_result += contentBlock.text;\n }\n }\n \n // Process reasoning tags for GPT-OSS models\n text_result = processReasoningTags(text_result, awsModel);\n \n // Combine thinking and text for Claude models\n let result = thinking_result ? `<think>${thinking_result}</think>\\n\\n${text_result}` : text_result;\n \n if (result) {\n yield result;\n }\n }"
|
|
2275
|
-
}
|
|
2276
|
-
]
|
|
2277
|
-
}
|
|
2278
|
-
},
|
|
2279
|
-
{
|
|
2280
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
2281
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
2282
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
2283
|
-
"hook_event_name": "PreToolUse",
|
|
2284
|
-
"tool_name": "Bash",
|
|
2285
|
-
"tool_input": {
|
|
2286
|
-
"command": "rm thinking-patch.js test-thinking-manual.js test-thinking-fix.js",
|
|
2287
|
-
"description": "Remove temporary test and patch files"
|
|
2288
|
-
}
|
|
2289
|
-
},
|
|
2290
|
-
{
|
|
2291
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
2292
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
2293
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
2294
|
-
"hook_event_name": "PreToolUse",
|
|
2295
|
-
"tool_name": "Write",
|
|
2296
|
-
"tool_input": {
|
|
2297
|
-
"file_path": "C:\\git\\bedrock-wrapper\\test-integrated-thinking.js",
|
|
2298
|
-
"content": "// Test the integrated thinking support in Converse API\nimport { bedrockWrapper } from \"./bedrock-wrapper.js\";\nimport dotenv from 'dotenv';\n\ndotenv.config();\n\nconst awsCreds = {\n region: process.env.AWS_REGION,\n accessKeyId: process.env.AWS_ACCESS_KEY_ID,\n secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,\n};\n\nasync function testIntegratedThinking() {\n const messages = [{ role: \"user\", content: \"Think step by step about what 2+2 equals. Be very thorough in your reasoning.\" }];\n \n const openaiChatCompletionsCreateObject = {\n messages,\n model: \"Claude-4-1-Opus-Thinking\",\n max_tokens: 2000,\n stream: false,\n temperature: 0.7,\n include_thinking_data: true\n };\n\n console.log(\"Testing Claude-4-1-Opus-Thinking with Invoke API:\");\n console.log(\"=\".repeat(60));\n \n try {\n let response = \"\";\n for await (const chunk of bedrockWrapper(awsCreds, openaiChatCompletionsCreateObject, { logging: false, useConverseAPI: false })) {\n response += chunk;\n }\n console.log(\"Invoke API Response:\");\n console.log(response);\n console.log(\"\\\\nContains <think> tags:\", response.includes(\"<think>\"));\n } catch (error) {\n console.log(\"Invoke API Error:\", error.message);\n }\n\n console.log(\"\\\\n\" + \"=\".repeat(60));\n console.log(\"Testing Claude-4-1-Opus-Thinking with Converse API (INTEGRATED):\");\n console.log(\"=\".repeat(60));\n \n try {\n let response = \"\";\n for await (const chunk of bedrockWrapper(awsCreds, openaiChatCompletionsCreateObject, { logging: false, useConverseAPI: true })) {\n response += chunk;\n }\n console.log(\"Converse API Response:\");\n console.log(response);\n console.log(\"\\\\nContains <think> tags:\", response.includes(\"<think>\"));\n } catch (error) {\n console.log(\"Converse API Error:\", error.message);\n }\n}\n\ntestIntegratedThinking().catch(console.error);"
|
|
2299
|
-
}
|
|
2300
|
-
},
|
|
2301
|
-
{
|
|
2302
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
2303
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
2304
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
2305
|
-
"hook_event_name": "PreToolUse",
|
|
2306
|
-
"tool_name": "Bash",
|
|
2307
|
-
"tool_input": {
|
|
2308
|
-
"command": "node test-integrated-thinking.js",
|
|
2309
|
-
"description": "Test the integrated thinking support"
|
|
2310
|
-
}
|
|
2311
|
-
},
|
|
2312
|
-
{
|
|
2313
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
2314
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
2315
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
2316
|
-
"hook_event_name": "PreToolUse",
|
|
2317
|
-
"tool_name": "Bash",
|
|
2318
|
-
"tool_input": {
|
|
2319
|
-
"command": "rm test-integrated-thinking.js",
|
|
2320
|
-
"description": "Remove test file"
|
|
2321
|
-
}
|
|
2322
|
-
},
|
|
2323
|
-
{
|
|
2324
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
2325
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
2326
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
2327
|
-
"hook_event_name": "PreToolUse",
|
|
2328
|
-
"tool_name": "TodoWrite",
|
|
2329
|
-
"tool_input": {
|
|
2330
|
-
"todos": [
|
|
2331
|
-
{
|
|
2332
|
-
"content": "Integrate thinking support directly into bedrock-wrapper.js Converse API path",
|
|
2333
|
-
"status": "completed",
|
|
2334
|
-
"id": "13"
|
|
2335
|
-
}
|
|
2336
|
-
]
|
|
2337
|
-
}
|
|
2338
|
-
},
|
|
2339
|
-
{
|
|
2340
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
2341
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
2342
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
2343
|
-
"hook_event_name": "PreToolUse",
|
|
2344
|
-
"tool_name": "Bash",
|
|
2345
|
-
"tool_input": {
|
|
2346
|
-
"command": "npm run test",
|
|
2347
|
-
"description": "Run the test to see the current behavior"
|
|
2348
|
-
}
|
|
2349
|
-
},
|
|
2350
|
-
{
|
|
2351
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
2352
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
2353
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
2354
|
-
"hook_event_name": "PreToolUse",
|
|
2355
|
-
"tool_name": "Read",
|
|
2356
|
-
"tool_input": {
|
|
2357
|
-
"file_path": "C:\\git\\bedrock-wrapper\\test-models.js",
|
|
2358
|
-
"offset": 54,
|
|
2359
|
-
"limit": 20
|
|
2360
|
-
}
|
|
2361
|
-
},
|
|
2362
|
-
{
|
|
2363
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
2364
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
2365
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
2366
|
-
"hook_event_name": "PreToolUse",
|
|
2367
|
-
"tool_name": "Read",
|
|
2368
|
-
"tool_input": {
|
|
2369
|
-
"file_path": "C:\\git\\bedrock-wrapper\\test-models.js",
|
|
2370
|
-
"offset": 56,
|
|
2371
|
-
"limit": 10
|
|
2372
|
-
}
|
|
2373
|
-
},
|
|
2374
|
-
{
|
|
2375
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
2376
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
2377
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
2378
|
-
"hook_event_name": "PreToolUse",
|
|
2379
|
-
"tool_name": "Edit",
|
|
2380
|
-
"tool_input": {
|
|
2381
|
-
"file_path": "C:\\git\\bedrock-wrapper\\test-models.js",
|
|
2382
|
-
"old_string": " top_p: LLM_TOP_P,",
|
|
2383
|
-
"new_string": " top_p: LLM_TOP_P,\\n include_thinking_data: true"
|
|
2384
|
-
}
|
|
2385
|
-
},
|
|
2386
|
-
{
|
|
2387
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
2388
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
2389
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
2390
|
-
"hook_event_name": "PreToolUse",
|
|
2391
|
-
"tool_name": "Bash",
|
|
2392
|
-
"tool_input": {
|
|
2393
|
-
"command": "git checkout test-models.js",
|
|
2394
|
-
"description": "Revert the bad edit"
|
|
2395
|
-
}
|
|
2396
|
-
},
|
|
2397
|
-
{
|
|
2398
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
2399
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
2400
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
2401
|
-
"hook_event_name": "PreToolUse",
|
|
2402
|
-
"tool_name": "Bash",
|
|
2403
|
-
"tool_input": {
|
|
2404
|
-
"command": "sed -n '61,63p' test-models.js | cat -A",
|
|
2405
|
-
"description": "Check exact formatting"
|
|
2406
|
-
}
|
|
2407
|
-
},
|
|
2408
|
-
{
|
|
2409
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
2410
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
2411
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
2412
|
-
"hook_event_name": "PreToolUse",
|
|
2413
|
-
"tool_name": "Edit",
|
|
2414
|
-
"tool_input": {
|
|
2415
|
-
"file_path": "C:\\git\\bedrock-wrapper\\test-models.js",
|
|
2416
|
-
"old_string": " const openaiChatCompletionsCreateObject = {\n messages,\n model,\n max_tokens: LLM_MAX_GEN_TOKENS,\n stream: isStreaming,\n temperature: LLM_TEMPERATURE,\n top_p: LLM_TOP_P,\n };",
|
|
2417
|
-
"new_string": " const openaiChatCompletionsCreateObject = {\n messages,\n model,\n max_tokens: LLM_MAX_GEN_TOKENS,\n stream: isStreaming,\n temperature: LLM_TEMPERATURE,\n top_p: LLM_TOP_P,\n include_thinking_data: true,\n };"
|
|
2418
|
-
}
|
|
2419
|
-
},
|
|
2420
|
-
{
|
|
2421
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
2422
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
2423
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
2424
|
-
"hook_event_name": "PreToolUse",
|
|
2425
|
-
"tool_name": "Edit",
|
|
2426
|
-
"tool_input": {
|
|
2427
|
-
"file_path": "C:\\git\\bedrock-wrapper\\CHANGELOG.md",
|
|
2428
|
-
"old_string": "# Changelog\nAll notable changes to this project will be documented in this file.\n\n## [2.4.5] - 2025-08-06 (GPT-OSS Models)",
|
|
2429
|
-
"new_string": "# Changelog\nAll notable changes to this project will be documented in this file.\n\n## [2.4.6] - 2025-08-12 (Converse API Thinking Support)\n### Fixed\n- **Critical Fix**: Claude thinking models now properly return `<think>` tags when using Converse API\n - Added thinking configuration support to Converse API path in `bedrock-wrapper.js`\n - Integrated `additionalModelRequestFields` with proper thinking budget configuration\n - Enhanced response processing to handle `reasoningContent.reasoningText.text` format\n - Updated test configuration to include `include_thinking_data: true` parameter\n- Converse API now has full feature parity with Invoke API for thinking models\n\n### Technical Details\n- **Thinking Configuration**: Proper `budget_tokens` validation and `maxTokens` constraints\n- **Response Processing**: Support for both streaming and non-streaming thinking extraction\n- **API Consistency**: Both Invoke and Converse APIs now produce identical thinking output\n- **Test Coverage**: Updated test suite to validate thinking functionality across both APIs\n\n## [2.4.5] - 2025-08-06 (GPT-OSS Models)"
|
|
2430
|
-
}
|
|
2431
|
-
},
|
|
2432
|
-
{
|
|
2433
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
2434
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
2435
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
2436
|
-
"hook_event_name": "PreToolUse",
|
|
2437
|
-
"tool_name": "Edit",
|
|
2438
|
-
"tool_input": {
|
|
2439
|
-
"file_path": "C:\\git\\bedrock-wrapper\\bedrock-wrapper.js",
|
|
2440
|
-
"old_string": " // Only add messages with actual content (Converse API doesn't allow empty content)\n if (content.length > 0 && content.some(item => item.text && item.text.trim() !== '')) {\n converseMessages.push({\n role: msg.role,\n content: content\n });\n }",
|
|
2441
|
-
"new_string": " // Only add messages with actual content (Converse API doesn't allow empty content)\n if (content.length > 0) {\n converseMessages.push({\n role: msg.role,\n content: content\n });\n }"
|
|
2442
|
-
}
|
|
2443
|
-
},
|
|
2444
|
-
{
|
|
2445
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
2446
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
2447
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
2448
|
-
"hook_event_name": "PreToolUse",
|
|
2449
|
-
"tool_name": "Edit",
|
|
2450
|
-
"tool_input": {
|
|
2451
|
-
"file_path": "C:\\git\\bedrock-wrapper\\bedrock-wrapper.js",
|
|
2452
|
-
"old_string": " // Handle thinking mode for Claude models\n if (awsModel.special_request_schema?.thinking?.type === \"enabled\") {\n // Apply thinking mode constraints for Converse API\n inferenceConfig.temperature = 1; // temperature must be 1 for thinking\n delete inferenceConfig.topP; // top_p must be unset for thinking\n \n // Add thinking budget configuration\n let budget_tokens = awsModel.special_request_schema?.thinking?.budget_tokens;\n if (budget_tokens > (max_gen_tokens * 0.8)) {\n budget_tokens = Math.floor(max_gen_tokens * 0.8);\n }\n if (budget_tokens < 1024) {\n budget_tokens = 1024;\n }\n \n // Ensure max tokens is sufficient for thinking\n if (inferenceConfig.maxTokens <= budget_tokens) {\n inferenceConfig.maxTokens = Math.floor(budget_tokens * 1.2);\n }\n }",
|
|
2453
|
-
"new_string": " // Handle thinking mode for Claude models\n let budget_tokens;\n if (awsModel.special_request_schema?.thinking?.type === \"enabled\") {\n // Apply thinking mode constraints for Converse API\n inferenceConfig.temperature = 1; // temperature must be 1 for thinking\n delete inferenceConfig.topP; // top_p must be unset for thinking\n \n // Calculate thinking budget configuration\n budget_tokens = awsModel.special_request_schema?.thinking?.budget_tokens;\n if (budget_tokens > (max_gen_tokens * 0.8)) {\n budget_tokens = Math.floor(max_gen_tokens * 0.8);\n }\n if (budget_tokens < 1024) {\n budget_tokens = 1024;\n }\n \n // Ensure max tokens is sufficient for thinking\n if (inferenceConfig.maxTokens <= budget_tokens) {\n inferenceConfig.maxTokens = Math.floor(budget_tokens * 1.2);\n }\n }"
|
|
2454
|
-
}
|
|
2455
|
-
},
|
|
2456
|
-
{
|
|
2457
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
2458
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
2459
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
2460
|
-
"hook_event_name": "PreToolUse",
|
|
2461
|
-
"tool_name": "Edit",
|
|
2462
|
-
"tool_input": {
|
|
2463
|
-
"file_path": "C:\\git\\bedrock-wrapper\\bedrock-wrapper.js",
|
|
2464
|
-
"old_string": " // Add thinking configuration for Claude models\n if (awsModel.special_request_schema?.thinking?.type === \"enabled\") {\n let budget_tokens = awsModel.special_request_schema?.thinking?.budget_tokens;\n if (budget_tokens > (inferenceConfig.maxTokens * 0.8)) {\n budget_tokens = Math.floor(inferenceConfig.maxTokens * 0.8);\n }\n if (budget_tokens < 1024) {\n budget_tokens = 1024;\n }\n \n converseRequest.additionalModelRequestFields = {\n thinking: {\n type: \"enabled\",\n budget_tokens: budget_tokens\n }\n };\n \n if (awsModel.special_request_schema?.anthropic_beta) {\n converseRequest.additionalModelRequestFields.anthropic_beta = awsModel.special_request_schema.anthropic_beta;\n }\n }",
|
|
2465
|
-
"new_string": " // Add thinking configuration for Claude models\n if (awsModel.special_request_schema?.thinking?.type === \"enabled\") {\n converseRequest.additionalModelRequestFields = {\n thinking: {\n type: \"enabled\",\n budget_tokens: budget_tokens\n }\n };\n \n if (awsModel.special_request_schema?.anthropic_beta) {\n converseRequest.additionalModelRequestFields.anthropic_beta = awsModel.special_request_schema.anthropic_beta;\n }\n }"
|
|
2466
|
-
}
|
|
2467
|
-
},
|
|
2468
|
-
{
|
|
2469
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
2470
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
2471
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
2472
|
-
"hook_event_name": "PreToolUse",
|
|
2473
|
-
"tool_name": "Edit",
|
|
2474
|
-
"tool_input": {
|
|
2475
|
-
"file_path": "C:\\git\\bedrock-wrapper\\test-converse-api.js",
|
|
2476
|
-
"old_string": " const converseStoppedCorrectly = !converseResponse.includes(\"6, 7\");\n const invokeStoppedCorrectly = !invokeResponse.includes(\"6, 7\");",
|
|
2477
|
-
"new_string": " // Stop sequence [\"6\"] should stop BEFORE outputting \"6\"\n const converseStoppedCorrectly = !converseResponse.includes(\"6\");\n const invokeStoppedCorrectly = !invokeResponse.includes(\"6\");"
|
|
2478
|
-
}
|
|
2479
|
-
},
|
|
2480
|
-
{
|
|
2481
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
2482
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
2483
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
2484
|
-
"hook_event_name": "PreToolUse",
|
|
2485
|
-
"tool_name": "Read",
|
|
2486
|
-
"tool_input": {
|
|
2487
|
-
"file_path": "C:\\git\\bedrock-wrapper\\README.md"
|
|
2488
|
-
}
|
|
2489
|
-
},
|
|
2490
|
-
{
|
|
2491
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
2492
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
2493
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
2494
|
-
"hook_event_name": "PreToolUse",
|
|
2495
|
-
"tool_name": "Read",
|
|
2496
|
-
"tool_input": {
|
|
2497
|
-
"file_path": "C:\\git\\bedrock-wrapper\\package.json"
|
|
2498
|
-
}
|
|
2499
|
-
},
|
|
2500
|
-
{
|
|
2501
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
2502
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
2503
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
2504
|
-
"hook_event_name": "PreToolUse",
|
|
2505
|
-
"tool_name": "Read",
|
|
2506
|
-
"tool_input": {
|
|
2507
|
-
"file_path": "C:\\git\\bedrock-wrapper\\.gitignore"
|
|
2508
|
-
}
|
|
2509
|
-
},
|
|
2510
|
-
{
|
|
2511
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
2512
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
2513
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
2514
|
-
"hook_event_name": "PreToolUse",
|
|
2515
|
-
"tool_name": "LS",
|
|
2516
|
-
"tool_input": {
|
|
2517
|
-
"path": "C:\\git\\bedrock-wrapper"
|
|
2518
|
-
}
|
|
2519
|
-
},
|
|
2520
|
-
{
|
|
2521
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
2522
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
2523
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
2524
|
-
"hook_event_name": "PreToolUse",
|
|
2525
|
-
"tool_name": "Read",
|
|
2526
|
-
"tool_input": {
|
|
2527
|
-
"file_path": "C:\\git\\bedrock-wrapper\\CLAUDE.md"
|
|
2528
|
-
}
|
|
2529
|
-
},
|
|
2530
|
-
{
|
|
2531
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
2532
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
2533
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
2534
|
-
"hook_event_name": "PreToolUse",
|
|
2535
|
-
"tool_name": "Write",
|
|
2536
|
-
"tool_input": {
|
|
2537
|
-
"file_path": "C:\\git\\bedrock-wrapper\\CLAUDE.md",
|
|
2538
|
-
"content": "# CLAUDE.md\n\nThis file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.\n\n## Project Overview\n\nBedrock Wrapper (v2.5.0) is an npm package that translates OpenAI-compatible API objects to AWS Bedrock's serverless inference LLMs. It supports 32+ models including Claude, Nova, GPT-OSS, Llama, and Mistral families with features like vision support, thinking modes, and stop sequences.\n\n## Core Architecture\n\nThe system has two main API paths and three core components:\n\n### API Paths\n\n1. **Converse API Path** (`useConverseAPI: true`):\n - Unified request/response format across all models\n - Simplified message handling without model-specific formatting\n - Native system prompt support\n - Cleaner multimodal handling\n - Located at lines 510-677 in bedrock-wrapper.js\n\n2. **Invoke API Path** (default):\n - Model-specific request formatting and response parsing\n - Complex prompt construction for non-messages API models\n - Located at lines 680-727 in bedrock-wrapper.js\n\n### Core Components\n\n1. **bedrock-wrapper.js**: Main async generator function\n - `bedrockWrapper()`: Entry point supporting both APIs\n - `convertToConverseFormat()`: Converts OpenAI messages to Converse API format\n - `processMessagesForInvoke()`: Handles model-specific message processing\n - `buildInvokePrompt()`: Constructs model-specific prompts\n - `buildInvokeRequest()`: Creates model-specific request objects\n - Thinking mode support with `<think>` tags for Claude and `<reasoning>` tags for GPT-OSS\n\n2. **bedrock-models.js**: Model configuration registry\n - Each model entry contains: modelName, modelId, vision support, API type, response paths\n - Special configurations for thinking models (budget_tokens, anthropic_beta headers)\n - Stop sequences parameter mapping per model family\n\n3. **utils.js**: Helper utilities\n\n## Development Commands\n\n```bash\n# Install dependencies\nnpm install\n\n# Clean reinstall\nnpm run clean\n\n# Test all models with both APIs (comparison mode)\nnpm run test\n\n# Test with specific API\nnpm run test:invoke # Invoke API only\nnpm run test:converse # Converse API only\n\n# Test vision capabilities (11 vision-enabled models)\nnpm run test-vision\nnpm run test-vision:invoke\nnpm run test-vision:converse\n\n# Test stop sequences (Claude, Nova, GPT-OSS, Mistral)\nnpm run test-stop\nnpm run test-stop:invoke\nnpm run test-stop:converse\n\n# Test Converse API specifically\nnpm run test-converse\n\n# Interactive CLI testing\nnpm run interactive\n```\n\n## Environment Configuration\n\nCreate `.env` file:\n```\nAWS_REGION=us-west-2\nAWS_ACCESS_KEY_ID=your_access_key\nAWS_SECRET_ACCESS_KEY=your_secret_key\nLLM_MAX_GEN_TOKENS=1024\nLLM_TEMPERATURE=0.1\nLLM_TOP_P=0.9\n```\n\n## Adding New Models\n\nRequired fields in bedrock-models.js:\n- `modelName`: Consumer-facing name\n- `modelId`: AWS Bedrock identifier\n- `vision`: Boolean for image support\n- `messages_api`: Boolean (true for Claude/Nova/GPT-OSS, false for prompt-based)\n- `response_chunk_element`: JSON path for streaming responses\n- `response_nonchunk_element`: JSON path for non-streaming responses\n- `special_request_schema`: Model-specific requirements\n- `stop_sequences_param_name`: Parameter name for stop sequences\n\n## Critical Implementation Details\n\n### Converse API Thinking Support\n- Thinking configuration added via `additionalModelRequestFields`\n- Response thinking data extracted from `reasoningContent.reasoningText.text`\n- Budget tokens calculated with constraints: 1024 <= budget_tokens <= (maxTokens * 0.8)\n- Temperature forced to 1.0, top_p removed for thinking models\n\n### Nova Models Special Handling\n- Detect via `special_request_schema.schemaVersion === \"messages-v1\"`\n- Content must be array format: `[{text: content}]`\n- Parameters nested in `inferenceConfig` object\n\n### Image Processing\n- Sharp library resizes images to max 2048x2048\n- Converts all images to JPEG format\n- Supports base64, data URLs, and HTTP URLs\n- Image-only messages are valid (no text required)\n\n### Stop Sequences Support Matrix\n| Model Family | Support | Parameter | Max Count |\n|-------------|---------|-----------|-----------|\n| Claude | \u00e2\u0153\u2026 | stop_sequences | 8,191 |\n| Nova | \u00e2\u0153\u2026 | stopSequences | 4 |\n| GPT-OSS | \u00e2\u0153\u2026 | stop_sequences | TBD |\n| Mistral | \u00e2\u0153\u2026 | stop | 10 |\n| Llama | \u00e2\udc9d\u0152 | N/A | N/A |\n\n### Test Files Output\n- `test-models-output.txt`: Full model test results\n- `test-vision-models-output.txt`: Vision test results\n- `test-stop-sequences-output.txt`: Stop sequences test results\n- `test-converse-api-output.txt`: Converse API comparison results\n\n## Common Issues and Solutions\n\n### Thinking Models Not Showing Tags\n- Ensure `include_thinking_data: true` is in the request\n- Converse API extracts from `reasoningContent.reasoningText.text`\n- Invoke API uses model-specific `thinking_response_chunk_element`\n\n### Stop Sequences Not Working\n- Llama models don't support stop sequences (AWS limitation)\n- Stop sequence stops generation BEFORE the sequence appears\n- Both `stop` and `stop_sequences` parameters are accepted\n\n### Image Processing Failures\n- Ensure images are under 2048x2048 pixels\n- Use JPEG format for best compatibility\n- Check model has `vision: true` in configuration\n\n## Testing Best Practices\n- Always test with both APIs using `--both` flag for comparison\n- Check output files for detailed error messages\n- Use `npm run interactive` for debugging specific models\n- Test thinking models with `include_thinking_data: true`"
|
|
2539
|
-
}
|
|
2540
|
-
},
|
|
2541
|
-
{
|
|
2542
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
2543
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
2544
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
2545
|
-
"hook_event_name": "PreToolUse",
|
|
2546
|
-
"tool_name": "LS",
|
|
2547
|
-
"tool_input": {
|
|
2548
|
-
"path": "C:\\git\\bedrock-proxy-endpoint"
|
|
2549
|
-
}
|
|
2550
|
-
},
|
|
2551
|
-
{
|
|
2552
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
2553
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
2554
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
2555
|
-
"hook_event_name": "PreToolUse",
|
|
2556
|
-
"tool_name": "Read",
|
|
2557
|
-
"tool_input": {
|
|
2558
|
-
"file_path": "C:\\git\\bedrock-proxy-endpoint\\server.js"
|
|
2559
|
-
}
|
|
2560
|
-
},
|
|
2561
|
-
{
|
|
2562
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
2563
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
2564
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
2565
|
-
"hook_event_name": "PreToolUse",
|
|
2566
|
-
"tool_name": "Read",
|
|
2567
|
-
"tool_input": {
|
|
2568
|
-
"file_path": "C:\\git\\bedrock-proxy-endpoint\\package.json"
|
|
2569
|
-
}
|
|
2570
|
-
},
|
|
2571
|
-
{
|
|
2572
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
2573
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
2574
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
2575
|
-
"hook_event_name": "PreToolUse",
|
|
2576
|
-
"tool_name": "Read",
|
|
2577
|
-
"tool_input": {
|
|
2578
|
-
"file_path": "C:\\git\\bedrock-proxy-endpoint\\README.md"
|
|
2579
|
-
}
|
|
2580
|
-
},
|
|
2581
|
-
{
|
|
2582
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
2583
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
2584
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
2585
|
-
"hook_event_name": "PreToolUse",
|
|
2586
|
-
"tool_name": "Read",
|
|
2587
|
-
"tool_input": {
|
|
2588
|
-
"file_path": "C:\\git\\bedrock-proxy-endpoint\\example\\example.js"
|
|
2589
|
-
}
|
|
2590
|
-
},
|
|
2591
|
-
{
|
|
2592
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
2593
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
2594
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
2595
|
-
"hook_event_name": "PreToolUse",
|
|
2596
|
-
"tool_name": "Read",
|
|
2597
|
-
"tool_input": {
|
|
2598
|
-
"file_path": "C:\\git\\bedrock-proxy-endpoint\\CHANGELOG.md"
|
|
2599
|
-
}
|
|
2600
|
-
},
|
|
2601
|
-
{
|
|
2602
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
2603
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
2604
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
2605
|
-
"hook_event_name": "PreToolUse",
|
|
2606
|
-
"tool_name": "ExitPlanMode",
|
|
2607
|
-
"tool_input": {
|
|
2608
|
-
"plan": "## Plan to Add `useConverseAPI` Parameter to Bedrock Proxy Endpoint\n\nI'll add the `useConverseAPI` optional parameter to the bedrock-proxy-endpoint project, following the same pattern as the existing `include_thinking_data` parameter.\n\n### Changes Required:\n\n#### 1. **server.js** (Main proxy server file)\n- **Line 128-129**: Add `use_converse_api = false` to the parameter extraction, right after `include_thinking_data`\n- **Line 172**: Add `use_converse_api` to the `openaiChatCompletionsCreateObject`\n- **Line 193**: Update the `bedrockWrapper` call to pass `useConverseAPI: use_converse_api` in the options object\n- **Line 209**: Update the non-streaming `bedrockWrapper` call similarly\n\n#### 2. **README.md** (Documentation)\n- Add documentation for the new `use_converse_api` parameter in the \"Important values\" section (around line 90)\n- Update the example code to show the new parameter (around line 134)\n- Add a note explaining the benefits of the Converse API\n\n#### 3. **example/example.js** (Example file)\n- Add the `use_converse_api` parameter to the example (around line 40)\n- Add a comment explaining when to use it\n\n#### 4. **package.json**\n- Update version from 2.4.5 to 2.5.0 to match the bedrock-wrapper version that includes Converse API support\n\n#### 5. **CHANGELOG.md**\n- Add a new entry for version 2.5.0 documenting the Converse API support\n\n### Implementation Details:\n\nThe parameter will:\n- Default to `false` to maintain backward compatibility (uses Invoke API by default)\n- When set to `true`, use AWS Bedrock's Converse API for unified request/response format\n- Work exactly like `include_thinking_data` - as an optional boolean parameter in the OpenAI chat completions request\n\n### Benefits of this addition:\n- Allows users to opt-in to the simpler, unified Converse API\n- Provides better consistency across different model families\n- Maintains full backward compatibility with existing implementations\n- Follows the established pattern for optional parameters in the codebase"
|
|
2609
|
-
}
|
|
2610
|
-
},
|
|
2611
|
-
{
|
|
2612
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
2613
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
2614
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
2615
|
-
"hook_event_name": "PreToolUse",
|
|
2616
|
-
"tool_name": "TodoWrite",
|
|
2617
|
-
"tool_input": {
|
|
2618
|
-
"todos": [
|
|
2619
|
-
{
|
|
2620
|
-
"content": "Update server.js to add use_converse_api parameter extraction and pass to bedrockWrapper",
|
|
2621
|
-
"status": "pending",
|
|
2622
|
-
"id": "1"
|
|
2623
|
-
},
|
|
2624
|
-
{
|
|
2625
|
-
"content": "Update README.md to document the new use_converse_api parameter",
|
|
2626
|
-
"status": "pending",
|
|
2627
|
-
"id": "2"
|
|
2628
|
-
},
|
|
2629
|
-
{
|
|
2630
|
-
"content": "Update example/example.js to include use_converse_api in the example",
|
|
2631
|
-
"status": "pending",
|
|
2632
|
-
"id": "3"
|
|
2633
|
-
},
|
|
2634
|
-
{
|
|
2635
|
-
"content": "Update package.json version to 2.5.0",
|
|
2636
|
-
"status": "pending",
|
|
2637
|
-
"id": "4"
|
|
2638
|
-
},
|
|
2639
|
-
{
|
|
2640
|
-
"content": "Update CHANGELOG.md to document version 2.5.0 with Converse API support",
|
|
2641
|
-
"status": "pending",
|
|
2642
|
-
"id": "5"
|
|
2643
|
-
}
|
|
2644
|
-
]
|
|
2645
|
-
}
|
|
2646
|
-
},
|
|
2647
|
-
{
|
|
2648
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
2649
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
2650
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
2651
|
-
"hook_event_name": "PreToolUse",
|
|
2652
|
-
"tool_name": "TodoWrite",
|
|
2653
|
-
"tool_input": {
|
|
2654
|
-
"todos": [
|
|
2655
|
-
{
|
|
2656
|
-
"content": "Update server.js to add use_converse_api parameter extraction and pass to bedrockWrapper",
|
|
2657
|
-
"status": "in_progress",
|
|
2658
|
-
"id": "1"
|
|
2659
|
-
},
|
|
2660
|
-
{
|
|
2661
|
-
"content": "Update README.md to document the new use_converse_api parameter",
|
|
2662
|
-
"status": "pending",
|
|
2663
|
-
"id": "2"
|
|
2664
|
-
},
|
|
2665
|
-
{
|
|
2666
|
-
"content": "Update example/example.js to include use_converse_api in the example",
|
|
2667
|
-
"status": "pending",
|
|
2668
|
-
"id": "3"
|
|
2669
|
-
},
|
|
2670
|
-
{
|
|
2671
|
-
"content": "Update package.json version to 2.5.0",
|
|
2672
|
-
"status": "pending",
|
|
2673
|
-
"id": "4"
|
|
2674
|
-
},
|
|
2675
|
-
{
|
|
2676
|
-
"content": "Update CHANGELOG.md to document version 2.5.0 with Converse API support",
|
|
2677
|
-
"status": "pending",
|
|
2678
|
-
"id": "5"
|
|
2679
|
-
}
|
|
2680
|
-
]
|
|
2681
|
-
}
|
|
2682
|
-
},
|
|
2683
|
-
{
|
|
2684
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
2685
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
2686
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
2687
|
-
"hook_event_name": "PreToolUse",
|
|
2688
|
-
"tool_name": "Edit",
|
|
2689
|
-
"tool_input": {
|
|
2690
|
-
"file_path": "C:\\git\\bedrock-proxy-endpoint\\server.js",
|
|
2691
|
-
"old_string": " // Extract parameters from the incoming request\n const {\n messages = [],\n model = 'Llama-3-8b',\n max_tokens = 800,\n temperature = 0.1,\n top_p = 0.9,\n stream = true,\n include_thinking_data = false\n } = req.body;",
|
|
2692
|
-
"new_string": " // Extract parameters from the incoming request\n const {\n messages = [],\n model = 'Llama-3-8b',\n max_tokens = 800,\n temperature = 0.1,\n top_p = 0.9,\n stream = true,\n include_thinking_data = false,\n use_converse_api = false\n } = req.body;"
|
|
2693
|
-
}
|
|
2694
|
-
},
|
|
2695
|
-
{
|
|
2696
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
2697
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
2698
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
2699
|
-
"hook_event_name": "PreToolUse",
|
|
2700
|
-
"tool_name": "Edit",
|
|
2701
|
-
"tool_input": {
|
|
2702
|
-
"file_path": "C:\\git\\bedrock-proxy-endpoint\\server.js",
|
|
2703
|
-
"old_string": " // ----------------------------------------------------------------------\n // -- create an object that copies your openai chat completions object --\n // ----------------------------------------------------------------------\n const openaiChatCompletionsCreateObject = {\n messages: messages,\n model: model,\n max_tokens: max_tokens,\n stream: stream,\n temperature: temperature,\n top_p: top_p,\n include_thinking_data: include_thinking_data,\n ...(req.body.stop && { stop: req.body.stop }),\n ...(req.body.stop_sequences && { stop_sequences: req.body.stop_sequences })\n };",
|
|
2704
|
-
"new_string": " // ----------------------------------------------------------------------\n // -- create an object that copies your openai chat completions object --\n // ----------------------------------------------------------------------\n const openaiChatCompletionsCreateObject = {\n messages: messages,\n model: model,\n max_tokens: max_tokens,\n stream: stream,\n temperature: temperature,\n top_p: top_p,\n include_thinking_data: include_thinking_data,\n use_converse_api: use_converse_api,\n ...(req.body.stop && { stop: req.body.stop }),\n ...(req.body.stop_sequences && { stop_sequences: req.body.stop_sequences })\n };"
|
|
2705
|
-
}
|
|
2706
|
-
},
|
|
2707
|
-
{
|
|
2708
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
2709
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
2710
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
2711
|
-
"hook_event_name": "PreToolUse",
|
|
2712
|
-
"tool_name": "Edit",
|
|
2713
|
-
"tool_input": {
|
|
2714
|
-
"file_path": "C:\\git\\bedrock-proxy-endpoint\\server.js",
|
|
2715
|
-
"old_string": " // -------------------\n // -- streamed call --\n // -------------------\n for await (const chunk of bedrockWrapper(awsCreds, openaiChatCompletionsCreateObject, { logging: CONSOLE_LOGGING })) {",
|
|
2716
|
-
"new_string": " // -------------------\n // -- streamed call --\n // -------------------\n for await (const chunk of bedrockWrapper(awsCreds, openaiChatCompletionsCreateObject, { logging: CONSOLE_LOGGING, useConverseAPI: use_converse_api })) {"
|
|
2717
|
-
}
|
|
2718
|
-
},
|
|
2719
|
-
{
|
|
2720
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
2721
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
2722
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
2723
|
-
"hook_event_name": "PreToolUse",
|
|
2724
|
-
"tool_name": "Edit",
|
|
2725
|
-
"tool_input": {
|
|
2726
|
-
"file_path": "C:\\git\\bedrock-proxy-endpoint\\server.js",
|
|
2727
|
-
"old_string": " // ---------------------\n // -- unstreamed call --\n // ---------------------\n const response = await bedrockWrapper(awsCreds, openaiChatCompletionsCreateObject, { logging: CONSOLE_LOGGING });",
|
|
2728
|
-
"new_string": " // ---------------------\n // -- unstreamed call --\n // ---------------------\n const response = await bedrockWrapper(awsCreds, openaiChatCompletionsCreateObject, { logging: CONSOLE_LOGGING, useConverseAPI: use_converse_api });"
|
|
2729
|
-
}
|
|
2730
|
-
},
|
|
2731
|
-
{
|
|
2732
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
2733
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
2734
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
2735
|
-
"hook_event_name": "PreToolUse",
|
|
2736
|
-
"tool_name": "TodoWrite",
|
|
2737
|
-
"tool_input": {
|
|
2738
|
-
"todos": [
|
|
2739
|
-
{
|
|
2740
|
-
"content": "Update server.js to add use_converse_api parameter extraction and pass to bedrockWrapper",
|
|
2741
|
-
"status": "completed",
|
|
2742
|
-
"id": "1"
|
|
2743
|
-
},
|
|
2744
|
-
{
|
|
2745
|
-
"content": "Update README.md to document the new use_converse_api parameter",
|
|
2746
|
-
"status": "in_progress",
|
|
2747
|
-
"id": "2"
|
|
2748
|
-
},
|
|
2749
|
-
{
|
|
2750
|
-
"content": "Update example/example.js to include use_converse_api in the example",
|
|
2751
|
-
"status": "pending",
|
|
2752
|
-
"id": "3"
|
|
2753
|
-
},
|
|
2754
|
-
{
|
|
2755
|
-
"content": "Update package.json version to 2.5.0",
|
|
2756
|
-
"status": "pending",
|
|
2757
|
-
"id": "4"
|
|
2758
|
-
},
|
|
2759
|
-
{
|
|
2760
|
-
"content": "Update CHANGELOG.md to document version 2.5.0 with Converse API support",
|
|
2761
|
-
"status": "pending",
|
|
2762
|
-
"id": "5"
|
|
2763
|
-
}
|
|
2764
|
-
]
|
|
2765
|
-
}
|
|
2766
|
-
},
|
|
2767
|
-
{
|
|
2768
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
2769
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
2770
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
2771
|
-
"hook_event_name": "PreToolUse",
|
|
2772
|
-
"tool_name": "Edit",
|
|
2773
|
-
"tool_input": {
|
|
2774
|
-
"file_path": "C:\\git\\bedrock-proxy-endpoint\\README.md",
|
|
2775
|
-
"old_string": "- Important values\n - `baseUrl`: Root address of server based on your `.env` configuration.\n - `apiKey`: Descibed in the *Authentication* section above.\n - `messages`: Array of objects in role / content format.\n - `model`: This is the `modelName` from the list of supported models found on the `Bedrock Wrapper` README file [here](https://github.com/jparkerweb/bedrock-wrapper?tab=readme-ov-file#supported-models); The `/models` enpoint of this server will also return a list of supported models.\n - `include_thinking_data`: _Optional_ boolean parameter that when set to `true` will include the model's thinking process in the response (only used with thinking models such as `Claude-3-7-Sonnet-Thinking`).\n - `stop` or `stop_sequences`: _Optional_ parameter to specify text sequences that will cause the model to stop generating (e.g., `[\"STOP\", \"END\"]`).",
|
|
2776
|
-
"new_string": "- Important values\n - `baseUrl`: Root address of server based on your `.env` configuration.\n - `apiKey`: Descibed in the *Authentication* section above.\n - `messages`: Array of objects in role / content format.\n - `model`: This is the `modelName` from the list of supported models found on the `Bedrock Wrapper` README file [here](https://github.com/jparkerweb/bedrock-wrapper?tab=readme-ov-file#supported-models); The `/models` enpoint of this server will also return a list of supported models.\n - `include_thinking_data`: _Optional_ boolean parameter that when set to `true` will include the model's thinking process in the response (only used with thinking models such as `Claude-3-7-Sonnet-Thinking`).\n - `use_converse_api`: _Optional_ boolean parameter that when set to `true` will use AWS Bedrock's Converse API instead of the Invoke API. The Converse API provides a unified request/response format across all models, better conversation management, and cleaner multimodal handling. Defaults to `false` for backward compatibility.\n - `stop` or `stop_sequences`: _Optional_ parameter to specify text sequences that will cause the model to stop generating (e.g., `[\"STOP\", \"END\"]`)."
|
|
2777
|
-
}
|
|
2778
|
-
},
|
|
2779
|
-
{
|
|
2780
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
2781
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
2782
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
2783
|
-
"hook_event_name": "PreToolUse",
|
|
2784
|
-
"tool_name": "Edit",
|
|
2785
|
-
"tool_input": {
|
|
2786
|
-
"file_path": "C:\\git\\bedrock-proxy-endpoint\\README.md",
|
|
2787
|
-
"old_string": " const chatCompletion = await openai.chat.completions.create({\n messages: messages,\n model: \"Claude-4-Sonnet\",\n max_tokens: 2048,\n temperature: 0.4,\n top_p: 0.7,\n stream: true,\n include_thinking_data: false, // Set to true for thinking models like \"Claude-4-Sonnet-Thinking\"\n });",
|
|
2788
|
-
"new_string": " const chatCompletion = await openai.chat.completions.create({\n messages: messages,\n model: \"Claude-4-Sonnet\",\n max_tokens: 2048,\n temperature: 0.4,\n top_p: 0.7,\n stream: true,\n include_thinking_data: false, // Set to true for thinking models like \"Claude-4-Sonnet-Thinking\"\n use_converse_api: false, // Set to true to use the unified Converse API instead of Invoke API\n });"
|
|
2789
|
-
}
|
|
2790
|
-
},
|
|
2791
|
-
{
|
|
2792
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
2793
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
2794
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
2795
|
-
"hook_event_name": "PreToolUse",
|
|
2796
|
-
"tool_name": "TodoWrite",
|
|
2797
|
-
"tool_input": {
|
|
2798
|
-
"todos": [
|
|
2799
|
-
{
|
|
2800
|
-
"content": "Update server.js to add use_converse_api parameter extraction and pass to bedrockWrapper",
|
|
2801
|
-
"status": "completed",
|
|
2802
|
-
"id": "1"
|
|
2803
|
-
},
|
|
2804
|
-
{
|
|
2805
|
-
"content": "Update README.md to document the new use_converse_api parameter",
|
|
2806
|
-
"status": "completed",
|
|
2807
|
-
"id": "2"
|
|
2808
|
-
},
|
|
2809
|
-
{
|
|
2810
|
-
"content": "Update example/example.js to include use_converse_api in the example",
|
|
2811
|
-
"status": "in_progress",
|
|
2812
|
-
"id": "3"
|
|
2813
|
-
},
|
|
2814
|
-
{
|
|
2815
|
-
"content": "Update package.json version to 2.5.0",
|
|
2816
|
-
"status": "pending",
|
|
2817
|
-
"id": "4"
|
|
2818
|
-
},
|
|
2819
|
-
{
|
|
2820
|
-
"content": "Update CHANGELOG.md to document version 2.5.0 with Converse API support",
|
|
2821
|
-
"status": "pending",
|
|
2822
|
-
"id": "5"
|
|
2823
|
-
}
|
|
2824
|
-
]
|
|
2825
|
-
}
|
|
2826
|
-
},
|
|
2827
|
-
{
|
|
2828
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
2829
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
2830
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
2831
|
-
"hook_event_name": "PreToolUse",
|
|
2832
|
-
"tool_name": "Edit",
|
|
2833
|
-
"tool_input": {
|
|
2834
|
-
"file_path": "C:\\git\\bedrock-proxy-endpoint\\example\\example.js",
|
|
2835
|
-
"old_string": " const chatCompletion = await openai.chat.completions.create({\n messages: messages,\n model: \"Claude-3-7-Sonnet-Thinking\", // Try: \"Claude-4-Sonnet\", \"Claude-4-Opus\", \"Claude-4-Sonnet-Thinking\", \"Claude-4-Opus-Thinking\"\n max_tokens: 2048,\n temperature: 0.4,\n top_p: 0.7,\n stream: true,\n include_thinking_data: true, // Works with thinking models\n });",
|
|
2836
|
-
"new_string": " const chatCompletion = await openai.chat.completions.create({\n messages: messages,\n model: \"Claude-3-7-Sonnet-Thinking\", // Try: \"Claude-4-Sonnet\", \"Claude-4-Opus\", \"Claude-4-Sonnet-Thinking\", \"Claude-4-Opus-Thinking\"\n max_tokens: 2048,\n temperature: 0.4,\n top_p: 0.7,\n stream: true,\n include_thinking_data: true, // Works with thinking models\n use_converse_api: false, // Set to true to use the unified Converse API (better consistency across models)\n });"
|
|
2837
|
-
}
|
|
2838
|
-
},
|
|
2839
|
-
{
|
|
2840
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
2841
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
2842
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
2843
|
-
"hook_event_name": "PreToolUse",
|
|
2844
|
-
"tool_name": "TodoWrite",
|
|
2845
|
-
"tool_input": {
|
|
2846
|
-
"todos": [
|
|
2847
|
-
{
|
|
2848
|
-
"content": "Update server.js to add use_converse_api parameter extraction and pass to bedrockWrapper",
|
|
2849
|
-
"status": "completed",
|
|
2850
|
-
"id": "1"
|
|
2851
|
-
},
|
|
2852
|
-
{
|
|
2853
|
-
"content": "Update README.md to document the new use_converse_api parameter",
|
|
2854
|
-
"status": "completed",
|
|
2855
|
-
"id": "2"
|
|
2856
|
-
},
|
|
2857
|
-
{
|
|
2858
|
-
"content": "Update example/example.js to include use_converse_api in the example",
|
|
2859
|
-
"status": "completed",
|
|
2860
|
-
"id": "3"
|
|
2861
|
-
},
|
|
2862
|
-
{
|
|
2863
|
-
"content": "Update package.json version to 2.5.0",
|
|
2864
|
-
"status": "in_progress",
|
|
2865
|
-
"id": "4"
|
|
2866
|
-
},
|
|
2867
|
-
{
|
|
2868
|
-
"content": "Update CHANGELOG.md to document version 2.5.0 with Converse API support",
|
|
2869
|
-
"status": "pending",
|
|
2870
|
-
"id": "5"
|
|
2871
|
-
}
|
|
2872
|
-
]
|
|
2873
|
-
}
|
|
2874
|
-
},
|
|
2875
|
-
{
|
|
2876
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
2877
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
2878
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
2879
|
-
"hook_event_name": "PreToolUse",
|
|
2880
|
-
"tool_name": "Edit",
|
|
2881
|
-
"tool_input": {
|
|
2882
|
-
"file_path": "C:\\git\\bedrock-proxy-endpoint\\package.json",
|
|
2883
|
-
"old_string": " \"version\": \"2.4.5\",",
|
|
2884
|
-
"new_string": " \"version\": \"2.5.0\","
|
|
2885
|
-
}
|
|
2886
|
-
},
|
|
2887
|
-
{
|
|
2888
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
2889
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
2890
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
2891
|
-
"hook_event_name": "PreToolUse",
|
|
2892
|
-
"tool_name": "TodoWrite",
|
|
2893
|
-
"tool_input": {
|
|
2894
|
-
"todos": [
|
|
2895
|
-
{
|
|
2896
|
-
"content": "Update server.js to add use_converse_api parameter extraction and pass to bedrockWrapper",
|
|
2897
|
-
"status": "completed",
|
|
2898
|
-
"id": "1"
|
|
2899
|
-
},
|
|
2900
|
-
{
|
|
2901
|
-
"content": "Update README.md to document the new use_converse_api parameter",
|
|
2902
|
-
"status": "completed",
|
|
2903
|
-
"id": "2"
|
|
2904
|
-
},
|
|
2905
|
-
{
|
|
2906
|
-
"content": "Update example/example.js to include use_converse_api in the example",
|
|
2907
|
-
"status": "completed",
|
|
2908
|
-
"id": "3"
|
|
2909
|
-
},
|
|
2910
|
-
{
|
|
2911
|
-
"content": "Update package.json version to 2.5.0",
|
|
2912
|
-
"status": "completed",
|
|
2913
|
-
"id": "4"
|
|
2914
|
-
},
|
|
2915
|
-
{
|
|
2916
|
-
"content": "Update CHANGELOG.md to document version 2.5.0 with Converse API support",
|
|
2917
|
-
"status": "in_progress",
|
|
2918
|
-
"id": "5"
|
|
2919
|
-
}
|
|
2920
|
-
]
|
|
2921
|
-
}
|
|
2922
|
-
},
|
|
2923
|
-
{
|
|
2924
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
2925
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
2926
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
2927
|
-
"hook_event_name": "PreToolUse",
|
|
2928
|
-
"tool_name": "Edit",
|
|
2929
|
-
"tool_input": {
|
|
2930
|
-
"file_path": "C:\\git\\bedrock-proxy-endpoint\\CHANGELOG.md",
|
|
2931
|
-
"old_string": "# Changelog\nAll notable changes to this project will be documented in this file.\n\n## [2.4.5] - 2025-08-06",
|
|
2932
|
-
"new_string": "# Changelog\nAll notable changes to this project will be documented in this file.\n\n## [2.5.0] - 2025-08-12\n### Added\n- Updated to use Bedrock Wrapper v2.5.0\n- Support for AWS Bedrock Converse API via `use_converse_api` parameter\n - Optional boolean parameter that defaults to `false` for backward compatibility\n - When set to `true`, uses the unified Converse API instead of Invoke API\n - Provides consistent request/response format across all model families\n - Simplifies conversation management and multimodal handling\n - Better support for system prompts and tool use (where applicable)\n- Converse API benefits include:\n - Unified API format across Claude, Nova, GPT-OSS, Llama, and Mistral models\n - Cleaner handling of thinking models with proper `reasoningContent` extraction\n - Simplified message format without model-specific prompt construction\n - Native support for system prompts as a separate field\n\n### Technical Details\n- The `use_converse_api` parameter follows the same pattern as `include_thinking_data`\n- Passes through to bedrock-wrapper's `useConverseAPI` option\n- Works with both streaming and non-streaming responses\n- Maintains full backward compatibility when not specified or set to `false`\n\n## [2.4.5] - 2025-08-06"
|
|
2933
|
-
}
|
|
2934
|
-
},
|
|
2935
|
-
{
|
|
2936
|
-
"session_id": "e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3",
|
|
2937
|
-
"transcript_path": "C:\\Users\\Justin.Parker\\.claude\\projects\\C--git-bedrock-wrapper\\e4cf59ef-9d22-45bf-9c6c-53e3cb9efda3.jsonl",
|
|
2938
|
-
"cwd": "C:\\git\\bedrock-wrapper",
|
|
2939
|
-
"hook_event_name": "PreToolUse",
|
|
2940
|
-
"tool_name": "TodoWrite",
|
|
2941
|
-
"tool_input": {
|
|
2942
|
-
"todos": [
|
|
2943
|
-
{
|
|
2944
|
-
"content": "Update server.js to add use_converse_api parameter extraction and pass to bedrockWrapper",
|
|
2945
|
-
"status": "completed",
|
|
2946
|
-
"id": "1"
|
|
2947
|
-
},
|
|
2948
|
-
{
|
|
2949
|
-
"content": "Update README.md to document the new use_converse_api parameter",
|
|
2950
|
-
"status": "completed",
|
|
2951
|
-
"id": "2"
|
|
2952
|
-
},
|
|
2953
|
-
{
|
|
2954
|
-
"content": "Update example/example.js to include use_converse_api in the example",
|
|
2955
|
-
"status": "completed",
|
|
2956
|
-
"id": "3"
|
|
2957
|
-
},
|
|
2958
|
-
{
|
|
2959
|
-
"content": "Update package.json version to 2.5.0",
|
|
2960
|
-
"status": "completed",
|
|
2961
|
-
"id": "4"
|
|
2962
|
-
},
|
|
2963
|
-
{
|
|
2964
|
-
"content": "Update CHANGELOG.md to document version 2.5.0 with Converse API support",
|
|
2965
|
-
"status": "completed",
|
|
2966
|
-
"id": "5"
|
|
2967
|
-
}
|
|
2968
|
-
]
|
|
2969
|
-
}
|
|
2970
|
-
}
|
|
2971
|
-
]
|