https://www.boundaryml.com logo
🟡 Issue with BAML Error (401) and PDF File Name V...
# questions
j
Has anyone seen the following baml error with bedrock claude and know why it's popping up when running with TS:
Copy code
---REQUEST OPTIONS---
    ---ERROR (InvalidAuthentication (401))---
    ServiceError(
        ServiceError {
            source: ValidationException(
                ValidationException {
                    message: Some(
                        "The document file name can only contain alphanumeric characters, whitespace characters, hyphens, parentheses, and square brackets. The name can't contain more than one consecutive whitespace character. Check that the file name conforms to these restrictions and retry your request.",
                    ),
                    meta: ErrorMetadata {
                        code: Some(
                            "ValidationException",
                        ),
                        message: Some(
                            "The document file name can only contain alphanumeric characters, whitespace characters, hyphens, parentheses, and square brackets. The name can't contain more than one consecutive whitespace character. Check that the file name conforms to these restrictions and retry your request.",
                        ),
                        extras: Some(
                            {
                                "aws_request_id": "22222-7cde-222-bc2e-3190206ddafb",
                            },
                        ),
                    },
                },
            ),
A simple function which is given a PDF:
Copy code
function Extract(
  PDF: pdf
) -> StandardResponse {
  client BedrockClaude
  prompt #"
    <role>You are a....</role>
    {{ quotePDF }}
    {{ ctx.output_format }}
  "#
}
Calling it in TS:
Copy code
const base64Pdf = Buffer.from(pdfBuffer).toString("base64")
const pdfObject = Pdf.fromBase64(base64Pdf)
const result = await b.Extract(pdfObject)
The fileName of the PDF is
Template-Example.pdf
I think I am doing everything right 🤔
Ahhh, Nevermind - I just needed to upgrade to get that minor bug fix in which was released in
>=0.210
I guess I'll leave this here incase someone has the same problem?
v
Thanks for self resolving!