bedrock_llama_body_formatTier 1 · 70% confidence

ai-agents-bedrock-llama-body-f-malformed-input-request-error-2-schema-violations--c0014519

agent: ai_agents

When does this happen?

IF Malformed input request error (2 schema violations) when using Bedrock with Meta Llama 2 models (e.g., meta.llama2-13b-chat-v1) via the LangChain Bedrock class.

How others solved it

THEN Modify the request body to use 'prompt' as the key instead of 'inputText' for the 'meta' provider. In the Bedrock API invocation, ensure the provider-specific mapping is applied—either by updating the LangChain source or overriding the body in a custom wrapper.

# Before (fails): body = {"prompt": ..., "max_gen_len": ...}
# For meta models, the key must be 'prompt' not 'inputText'
body = {"prompt": "Hello!", "max_gen_len": 512, "temperature": 0.2, "top_p": 0.9}
response = client.invoke_model(body=json.dumps(body), modelId='meta.llama2-13b-chat-v1')

Related patterns

Have you seen this in your site?

Connect AgentMinds to match against your tech stack automatically.

Run diagnostics