File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed
source/extensions/filters/http/transformation Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -529,7 +529,19 @@ std::tuple<bool, bool> AiTransformer::transformHeaders(
529529 } else {
530530 absl::StrAppend (&path,
531531 AiTransformerConstants::get ().GEMINI_GENERATE_CONTENT );
532- }
532+ }
533+ } else if (provider == AiTransformerConstants::get ().PROVIDER_BEDROCK ) {
534+ ASSERT (!model.empty (), " Bedrock: required model setting is missing!" );
535+ path = replaceModelInPath (
536+ lookupEndpointMetadata (endpoint_metadata, " base_path" ), model);
537+ if (enable_chat_streaming_) {
538+ absl::StrAppend (
539+ &path, AiTransformerConstants::get ().BEDROCK_CONVERSE_STREAM
540+ } else {
541+ absl::StrAppend (&path,
542+ AiTransformerConstants::get ().BEDROCK_CONVERSE );
543+ }
544+ }
533545
534546 // Gemini doc is still using the `key` qs param but the Google GenAI sdk has
535547 // switched to use the `x-goog-api-key` header. Here is the reason we also
Original file line number Diff line number Diff line change @@ -25,15 +25,20 @@ struct AiTransformerValues {
2525 const std::string PROVIDER_GEMINI{" gemini" };
2626 const std::string PROVIDER_OPENAI{" openai" };
2727 const std::string PROVIDER_VERTEXAI{" vertexai" };
28+ const std::string PROVIDER_BEDROCK{" bedrock" };
2829
2930 const std::string SCHEMA_ANTHROPIC{" anthropic" };
3031 const std::string SCHEMA_GEMINI{" gemini" };
3132 const std::string SCHEMA_OPENAI{" openai" };
33+ const std::string SCHEMA_BEDROCK{" bedrock" };
3234
3335 const std::string GEMINI_GENERATE_CONTENT{" generateContent" };
3436 const std::string GEMINI_STREAM_GENERATE_CONTENT{" streamGenerateContent" };
3537 const std::string GEMINI_STREAM_QS_PARAM{" alt=sse" };
3638
39+ const std::string BEDROCK_CONVERSE{" converse" };
40+ const std::string BEDROCK_CONVERSE_STREAM{" converse-stream" };
41+
3742 const Http::LowerCaseString AnthropicApiKeyHeader{" x-api-key" };
3843 const Http::LowerCaseString AnthropicVersionHeader{" anthropic-version" };
3944 const Http::LowerCaseString AzureApiKeyHeader{" api-key" };
You can’t perform that action at this time.
0 commit comments