From 8a01751991178f7636030eb99e7f75c035707ffd Mon Sep 17 00:00:00 2001 From: Roman Rizzi Date: Thu, 23 Nov 2023 14:39:21 -0300 Subject: [PATCH] FIX: We don't need to prepend anthropic. to bedrock models (#308) --- lib/completions/endpoints/aws_bedrock.rb | 2 +- spec/lib/completions/endpoints/aws_bedrock_spec.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/completions/endpoints/aws_bedrock.rb b/lib/completions/endpoints/aws_bedrock.rb index 09a8d6d0..4fb3ae27 100644 --- a/lib/completions/endpoints/aws_bedrock.rb +++ b/lib/completions/endpoints/aws_bedrock.rb @@ -22,7 +22,7 @@ module DiscourseAi def model_uri api_url = - "https://bedrock-runtime.#{SiteSetting.ai_bedrock_region}.amazonaws.com/model/anthropic.#{model}/invoke" + "https://bedrock-runtime.#{SiteSetting.ai_bedrock_region}.amazonaws.com/model/#{model}/invoke" api_url = @streaming_mode ? (api_url + "-with-response-stream") : api_url diff --git a/spec/lib/completions/endpoints/aws_bedrock_spec.rb b/spec/lib/completions/endpoints/aws_bedrock_spec.rb index 4b655a91..f637b9ad 100644 --- a/spec/lib/completions/endpoints/aws_bedrock_spec.rb +++ b/spec/lib/completions/endpoints/aws_bedrock_spec.rb @@ -66,7 +66,7 @@ RSpec.describe DiscourseAi::Completions::Endpoints::AwsBedrock do WebMock .stub_request( :post, - "https://bedrock-runtime.#{SiteSetting.ai_bedrock_region}.amazonaws.com/model/anthropic.#{model_name}/invoke", + "https://bedrock-runtime.#{SiteSetting.ai_bedrock_region}.amazonaws.com/model/#{model_name}/invoke", ) .with(body: request_body) .to_return(status: 200, body: JSON.dump(response(response_text))) @@ -112,7 +112,7 @@ RSpec.describe DiscourseAi::Completions::Endpoints::AwsBedrock do WebMock .stub_request( :post, - "https://bedrock-runtime.#{SiteSetting.ai_bedrock_region}.amazonaws.com/model/anthropic.#{model_name}/invoke-with-response-stream", + "https://bedrock-runtime.#{SiteSetting.ai_bedrock_region}.amazonaws.com/model/#{model_name}/invoke-with-response-stream", ) .with(body: stream_request_body) .to_return(status: 200, body: chunks)