bedrock-wrapper 1.0.13 → 1.0.15
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/README.md +2 -1
- package/bedrock-models.js +29 -0
- package/bedrock-wrapper.js +3 -1
- package/docs/bedrock-proxy-endpoint.jpg +0 -0
- package/package.json +2 -2
- package/docs/bedrock-tunnel-endpoint.jpg +0 -0
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# 🪨 Bedrock Wrapper
|
|
2
|
-
Bedrock Wrapper is an npm package that simplifies the integration of existing OpenAI-compatible API objects with AWS Bedrock's serverless inference LLMs. Follow the steps below to integrate into your own application, or alternativly use the
|
|
2
|
+
Bedrock Wrapper is an npm package that simplifies the integration of existing OpenAI-compatible API objects with AWS Bedrock's serverless inference LLMs. Follow the steps below to integrate into your own application, or alternativly use the 🔀 [Bedrock Proxy Endpoint](https://github.com/jparkerweb/bedrock-proxy-endpoint) project to spin up your own custom OpenAI server endpoint for even easier inference (using the standard `baseUrl`, and `apiKey` params).
|
|
3
3
|
|
|
4
4
|
---
|
|
5
5
|
|
|
@@ -98,6 +98,7 @@ Bedrock Wrapper is an npm package that simplifies the integration of existing Op
|
|
|
98
98
|
|----------------|------------------------------------|
|
|
99
99
|
| Llama-3-8b | meta.llama3-8b-instruct-v1:0 |
|
|
100
100
|
| Llama-3-70b | meta.llama3-70b-instruct-v1:0 |
|
|
101
|
+
| Mistral-7b | mistral.mistral-7b-instruct-v0:2 |
|
|
101
102
|
| Mixtral-8x7b | mistral.mixtral-8x7b-instruct-v0:1 |
|
|
102
103
|
| Mistral-Large | mistral.mistral-large-2402-v1:0 |
|
|
103
104
|
|
package/bedrock-models.js
CHANGED
|
@@ -22,6 +22,7 @@ export const bedrock_models = [
|
|
|
22
22
|
"eom_text": "<|eot_id|>",
|
|
23
23
|
"display_role_names": true,
|
|
24
24
|
"max_tokens_param_name": "max_gen_len",
|
|
25
|
+
"max_supported_response_tokens": 2048,
|
|
25
26
|
"response_chunk_element": "generation",
|
|
26
27
|
},
|
|
27
28
|
{
|
|
@@ -46,8 +47,34 @@ export const bedrock_models = [
|
|
|
46
47
|
"eom_text": "<|eot_id|>",
|
|
47
48
|
"display_role_names": true,
|
|
48
49
|
"max_tokens_param_name": "max_gen_len",
|
|
50
|
+
"max_supported_response_tokens": 2048,
|
|
49
51
|
"response_chunk_element": "generation",
|
|
50
52
|
},
|
|
53
|
+
{
|
|
54
|
+
// ================
|
|
55
|
+
// == Mistral-7b ==
|
|
56
|
+
// ================
|
|
57
|
+
"modelName": "Mistral-7b",
|
|
58
|
+
"modelId": "mistral.mistral-7b-instruct-v0:2",
|
|
59
|
+
"bos_text": "<s>",
|
|
60
|
+
"role_system_message_prefix": "",
|
|
61
|
+
"role_system_message_suffix": "",
|
|
62
|
+
"role_system_prefix": "",
|
|
63
|
+
"role_system_suffix": "",
|
|
64
|
+
"role_user_message_prefix": "[INST]",
|
|
65
|
+
"role_user_message_suffix": "[/INST]",
|
|
66
|
+
"role_user_prefix": "",
|
|
67
|
+
"role_user_suffix": "",
|
|
68
|
+
"role_assistant_message_prefix": "",
|
|
69
|
+
"role_assistant_message_suffix": "",
|
|
70
|
+
"role_assistant_prefix": "",
|
|
71
|
+
"role_assistant_suffix": "",
|
|
72
|
+
"eom_text": "</s>",
|
|
73
|
+
"display_role_names": false,
|
|
74
|
+
"max_tokens_param_name": "max_tokens",
|
|
75
|
+
"max_supported_response_tokens": 8192,
|
|
76
|
+
"response_chunk_element": "outputs[0].text",
|
|
77
|
+
},
|
|
51
78
|
{
|
|
52
79
|
// ==================
|
|
53
80
|
// == Mixtral-8x7b ==
|
|
@@ -70,6 +97,7 @@ export const bedrock_models = [
|
|
|
70
97
|
"eom_text": "</s>",
|
|
71
98
|
"display_role_names": false,
|
|
72
99
|
"max_tokens_param_name": "max_tokens",
|
|
100
|
+
"max_supported_response_tokens": 4096,
|
|
73
101
|
"response_chunk_element": "outputs[0].text",
|
|
74
102
|
},
|
|
75
103
|
{
|
|
@@ -94,6 +122,7 @@ export const bedrock_models = [
|
|
|
94
122
|
"eom_text": "</s>",
|
|
95
123
|
"display_role_names": false,
|
|
96
124
|
"max_tokens_param_name": "max_tokens",
|
|
125
|
+
"max_supported_response_tokens": 8192,
|
|
97
126
|
"response_chunk_element": "outputs[0].text",
|
|
98
127
|
},
|
|
99
128
|
];
|
package/bedrock-wrapper.js
CHANGED
|
@@ -96,11 +96,13 @@ export async function* bedrockWrapper(awsCreds, openaiChatCompletionsCreateObjec
|
|
|
96
96
|
console.log(`\nPrompt: ${prompt}\n`);
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
+
const max_gen_tokens = max_tokens <= awsModel.max_supported_response_tokens ? max_tokens : awsModel.max_supported_response_tokens;
|
|
100
|
+
|
|
99
101
|
// Format the request payload using the model's native structure.
|
|
100
102
|
const request = {
|
|
101
103
|
prompt,
|
|
102
104
|
// Optional inference parameters:
|
|
103
|
-
[awsModel.max_tokens_param_name]:
|
|
105
|
+
[awsModel.max_tokens_param_name]: max_gen_tokens,
|
|
104
106
|
temperature: temperature,
|
|
105
107
|
top_p: top_p,
|
|
106
108
|
};
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bedrock-wrapper",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.15",
|
|
4
4
|
"description": "🪨 Bedrock Wrapper is an npm package that simplifies the integration of existing OpenAI-compatible API objects with AWS Bedrock's serverless inference LLMs.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"author": "",
|
|
22
22
|
"license": "ISC",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@aws-sdk/client-bedrock-runtime": "^3.
|
|
24
|
+
"@aws-sdk/client-bedrock-runtime": "^3.575.0",
|
|
25
25
|
"dotenv": "^16.4.5"
|
|
26
26
|
}
|
|
27
27
|
}
|
|
Binary file
|