You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: prompt/prompt-executor/prompt-executor-clients/prompt-executor-bedrock-client/src/jvmMain/kotlin/ai/koog/prompt/executor/clients/bedrock/BedrockLLMClient.kt
* Configuration settings for connecting to the AWS Bedrock API.
67
69
*
68
70
* @property region The AWS region where Bedrock service is hosted.
69
71
* @property timeoutConfig Configuration for connection timeouts.
70
72
* @property endpointUrl Optional custom endpoint URL for testing or private deployments.
73
+
* @property apiMethod The API method to use for interacting with Bedrock models that support messages, defaults to [BedrockAPIMethod.InvokeModel].
71
74
* @property maxRetries Maximum number of retries for failed requests.
72
75
* @property enableLogging Whether to enable detailed AWS SDK logging.
73
76
* @property moderationGuardrailsSettings Optional settings of the AWS bedrock Guardrails (see [AWS documentation](https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails-use-independent-api.html) ) that would be used for the [LLMClient.moderate] request
74
77
* @property fallbackModelFamily Optional fallback model family to use for unsupported models. If not provided, unsupported models will throw an exception.
* Defines Bedrock API methods to interact with the models that support messages.
92
+
*/
93
+
publicsealedinterfaceBedrockAPIMethod {
94
+
/**
95
+
* Defines `/model/{modelId}/invoke` API method.
96
+
* When using this method, request body is formatted manually and is specific to the invoked model.
97
+
*
98
+
* Consider using [Converse] if possible, since this is a newer method aiming to provide a consistent interface for all models.
99
+
*
100
+
* [AWS API docs](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_InvokeModel.html)
101
+
*/
102
+
publicobject InvokeModel : BedrockAPIMethod
103
+
104
+
/**
105
+
* Defines `/model/{modelId}/converse` API method.
106
+
* Provides a consistent interface that works with all models that support messages.
107
+
* Supports custom inference parameters for models that require it.
108
+
*
109
+
* [AWS API docs](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_Converse.html)
110
+
*/
111
+
publicobject Converse : BedrockAPIMethod
112
+
}
113
+
86
114
/**
87
115
* Represents the settings configuration for Bedrock guardrails.
88
116
*
@@ -92,21 +120,24 @@ public class BedrockClientSettings(
92
120
* @property guardrailVersion The version of the guardrail configuration.
93
121
*/
94
122
publicclassBedrockGuardrailsSettings(
95
-
internalvalguardrailIdentifier:String,
96
-
internalvalguardrailVersion:String,
123
+
publicvalguardrailIdentifier:String,
124
+
publicvalguardrailVersion:String,
97
125
)
98
126
99
127
/**
100
128
* Creates a new Bedrock LLM client configured with the specified AWS credentials and settings.
101
129
*
102
130
* @param bedrockClient The runtime client for interacting with Bedrock, highly configurable
131
+
* @param apiMethod The API method to use for interacting with Bedrock models that support messages, defaults to [BedrockAPIMethod.InvokeModel].
103
132
* @param moderationGuardrailsSettings Optional settings of the AWS bedrock Guardrails (see [AWS documentation](https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails-use-independent-api.html) ) that would be used for the [LLMClient.moderate] request
104
-
* @param fallbackModelFamily Optional fallback model family to use for unsupported models
133
+
* @param fallbackModelFamily Optional fallback model family to use for unsupported models. If not provided, unsupported models will throw an exception.
105
134
* @param clock A clock used for time-based operations
106
135
* @return A configured [LLMClient] instance for Bedrock
0 commit comments