{"record":{"id":"d0be976f593a9731","repo":"BoundaryML/baml","slug":"prompt-exposure-for-aws-client-is-not-supported","errorCode":null,"errorMessage":"Prompt exposure for AWS client is not supported","messagePattern":"Prompt exposure for AWS client is not supported","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/baml-runtime/src/internal/llm_client/primitive/mod.rs","lineNumber":250,"sourceCode":"        }\n    }\n}\n\nimpl LLMPrimitiveProvider {\n    pub fn chat_to_message(\n        &self,\n        chat: &[RenderedChatMessage],\n    ) -> Result<serde_json::Map<String, serde_json::Value>> {\n        use super::traits::ToProviderMessageExt;\n\n        match self {\n            LLMPrimitiveProvider::OpenAI(client) => client.chat_to_message(chat),\n            LLMPrimitiveProvider::Anthropic(client) => client.chat_to_message(chat),\n            LLMPrimitiveProvider::Google(client) => client.chat_to_message(chat),\n            LLMPrimitiveProvider::Vertex(client) => client.chat_to_message(chat),\n            #[cfg(feature = \"bedrock\")]\n            LLMPrimitiveProvider::Aws(client) => {\n                anyhow::bail!(\"Prompt exposure for AWS client is not supported\")\n            }\n        }\n    }\n\n    pub fn completion_to_provider_body(\n        &self,\n        prompt: &str,\n    ) -> Result<serde_json::Map<String, serde_json::Value>> {\n        Ok(match self {\n            LLMPrimitiveProvider::OpenAI(client) => client.completion_to_provider_body(prompt),\n            LLMPrimitiveProvider::Anthropic(client) => client.completion_to_provider_body(prompt),\n            LLMPrimitiveProvider::Google(client) => client.completion_to_provider_body(prompt),\n            LLMPrimitiveProvider::Vertex(client) => client.completion_to_provider_body(prompt),\n            #[cfg(feature = \"bedrock\")]\n            LLMPrimitiveProvider::Aws(client) => {\n                anyhow::bail!(\"Prompt exposure for AWS client is not supported\")\n            }\n        })","sourceCodeStart":232,"sourceCodeEnd":268,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/engine/baml-runtime/src/internal/llm_client/primitive/mod.rs#L232-L268","documentation":"chat_to_message exposes the rendered prompt as a provider-format message body; the AWS Bedrock client deliberately does not support this prompt-exposure feature and bails. Bedrock's InvokeModel/Converse flow does not provide the raw rendered prompt payload this API returns.","triggerScenarios":"Calling LLMPrimitiveProvider::chat_to_message (prompt exposure / raw prompt retrieval, e.g. for prompt testing or echo features) on a client whose provider is aws-bedrock with the bedrock feature compiled in.","commonSituations":"Using prompt-exposure tooling (e.g. BAML's prompt preview/test APIs) against a function configured with an aws-bedrock client.","solutions":["Use a non-AWS provider client (openai/anthropic/google/vertex) when you need raw prompt exposure","Skip prompt-exposure calls for Bedrock clients and handle the error gracefully (catch the bail and return a not-supported indicator)","Retrieve prompts via Bedrock-specific means or vendor tooling outside baml-runtime"],"exampleFix":"// before\nlet msg = provider.chat_to_message(&chat)?; // panics/bails for Bedrock\n// after\nlet msg = match provider.chat_to_message(&chat) {\n    Ok(m) => m,\n    Err(e) if e.to_string().contains(\"Prompt exposure for AWS\") => return Err(Unsupported),\n    Err(e) => return Err(e.into()),\n};","handlingStrategy":"try-catch","validationCode":"// Skip exposure for Bedrock clients\nif matches!(provider, LLMPrimitiveProvider::Aws(_)) {\n    return Ok(None); // prompt exposure unsupported\n}","typeGuard":"fn supports_prompt_exposure(p: &LLMPrimitiveProvider) -> bool {\n    !matches!(p, LLMPrimitiveProvider::Aws(_))\n}","tryCatchPattern":"match provider.chat_to_message(&chat) {\n    Ok(m) => m,\n    Err(e) if e.to_string().contains(\"Prompt exposure for AWS client\") => Default::default(),\n    Err(e) => return Err(e.into()),\n}","preventionTips":["Only call chat_to_message for openai/anthropic/google/vertex providers","Feature-check provider capabilities before prompt-exposure APIs","Route Bedrock-backed functions away from prompt preview tooling"],"tags":["rust","aws-bedrock","prompt-exposure","not-implemented"],"backgroundTag":"operation-not-supported","analyzedSha":"bd85ce9dee1463ff04d27efd20531013a4ff46c1","analyzedAt":"2026-09-12T03:38:25.718Z","contentChangedAt":"2026-09-12T03:38:25.718Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}