Fix renaming model original name can also be requested
Browse files- test/aws copy.py +18 -0
- utils.py +1 -1
test/aws copy.py
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import requests
|
2 |
+
import json
|
3 |
+
from requests_auth_aws_sigv4 import AWSSigV4
|
4 |
+
|
5 |
+
REGION = 'us-east-1'
|
6 |
+
aws_auth = AWSSigV4('bedrock', region=REGION) # If not provided, check for AWS Credentials from Environment Variables
|
7 |
+
|
8 |
+
body = json.dumps({
|
9 |
+
"max_tokens": 4096,
|
10 |
+
"messages": [{"role": "user", "content": "Hello, world"}],
|
11 |
+
"anthropic_version": "bedrock-2023-05-31"
|
12 |
+
})
|
13 |
+
r = requests.request(
|
14 |
+
'POST',
|
15 |
+
f'https://bedrock-runtime.{REGION}.amazonaws.com/model/anthropic.claude-3-sonnet-20240229-v1:0/invoke',
|
16 |
+
data=body,
|
17 |
+
auth=aws_auth)
|
18 |
+
print(r.text)
|
utils.py
CHANGED
@@ -12,7 +12,7 @@ def update_config(config_data):
|
|
12 |
model_dict[model] = model
|
13 |
if type(model) == dict:
|
14 |
model_dict.update({new: old for old, new in model.items()})
|
15 |
-
model_dict.update({old: old for old, new in model.items()})
|
16 |
provider['model'] = model_dict
|
17 |
config_data['providers'][index] = provider
|
18 |
api_keys_db = config_data['api_keys']
|
|
|
12 |
model_dict[model] = model
|
13 |
if type(model) == dict:
|
14 |
model_dict.update({new: old for old, new in model.items()})
|
15 |
+
# model_dict.update({old: old for old, new in model.items()})
|
16 |
provider['model'] = model_dict
|
17 |
config_data['providers'][index] = provider
|
18 |
api_keys_db = config_data['api_keys']
|