FIX: Update bedrock endpoint (#272)
* FIX: Update bedrock endpoint AWS updated their endpoints per https://docs.aws.amazon.com/general/latest/gr/bedrock.html * lint
This commit is contained in:
parent
0c9e18799c
commit
cbfd8507b1
|
@ -27,13 +27,6 @@ module ::DiscourseAi
|
||||||
raise CompletionFailed if !SiteSetting.ai_bedrock_secret_access_key.present?
|
raise CompletionFailed if !SiteSetting.ai_bedrock_secret_access_key.present?
|
||||||
raise CompletionFailed if !SiteSetting.ai_bedrock_region.present?
|
raise CompletionFailed if !SiteSetting.ai_bedrock_region.present?
|
||||||
|
|
||||||
url =
|
|
||||||
URI(
|
|
||||||
"https://bedrock.#{SiteSetting.ai_bedrock_region}.amazonaws.com/model/#{model}/invoke",
|
|
||||||
)
|
|
||||||
url.path = url.path + "-with-response-stream" if block_given?
|
|
||||||
headers = { "Content-Type" => "application/json" }
|
|
||||||
|
|
||||||
signer =
|
signer =
|
||||||
Aws::Sigv4::Signer.new(
|
Aws::Sigv4::Signer.new(
|
||||||
access_key_id: SiteSetting.ai_bedrock_access_key_id,
|
access_key_id: SiteSetting.ai_bedrock_access_key_id,
|
||||||
|
@ -46,7 +39,8 @@ module ::DiscourseAi
|
||||||
response_data = +""
|
response_data = +""
|
||||||
response_raw = +""
|
response_raw = +""
|
||||||
|
|
||||||
url_api = "https://bedrock.us-east-1.amazonaws.com/model/#{model}/"
|
url_api =
|
||||||
|
"https://bedrock-runtime.#{SiteSetting.ai_bedrock_region}.amazonaws.com/model/#{model}/"
|
||||||
if block_given?
|
if block_given?
|
||||||
url_api = url_api + "invoke-with-response-stream"
|
url_api = url_api + "invoke-with-response-stream"
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue