pub mod converse;
pub mod invoke;
pub mod transformations;
use super::model_config::{BedrockApiType, get_model_config};
use crate::core::providers::unified_provider::ProviderError;
use crate::core::types::chat::ChatRequest;
use serde_json::Value;
pub async fn route_chat_request(
client: &super::client::BedrockClient,
request: &ChatRequest,
) -> Result<Value, ProviderError> {
let model_config = get_model_config(&request.model)?;
match model_config.api_type {
BedrockApiType::Converse | BedrockApiType::ConverseStream => {
converse::execute_converse(client, request).await
}
BedrockApiType::Invoke | BedrockApiType::InvokeStream => {
invoke::execute_invoke(client, request).await
}
}
}
pub fn supports_converse(model_id: &str) -> bool {
if let Ok(config) = get_model_config(model_id) {
matches!(
config.api_type,
BedrockApiType::Converse | BedrockApiType::ConverseStream
)
} else {
false
}
}
pub fn supports_streaming(model_id: &str) -> bool {
if let Ok(config) = get_model_config(model_id) {
config.supports_streaming
} else {
false
}
}