- Newest
- Most votes
- Most comments
Hi,
Have a look at https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/bedrock-runtime/client/invoke_model.html
You have to specify the guardrail id with guardrailIdentifier param in the call of invoke() verb
response = client.invoke_model(
body=b'bytes'|file,
contentType='string',
accept='string',
modelId='string',
trace='ENABLED'|'DISABLED',
guardrailIdentifier='string',
guardrailVersion='string'
)
Best,
Dider
Not sure what do you mean by the sane as langchain, but you can check the new API https://docs.aws.amazon.com/bedrock/latest/userguide/conversation-inference.html#conversation-inference-examples
answered 2 years ago
In Python, the keys of dictionaries are variable references unless explicitly quoted...
So I believe this error is coming from your:
{id: "n390w1o2ad4s"}
...Which should instead be:
{"id": "n390w1o2ad4s"}
(id() is a built-in function in Python, otherwise you'd get a reference error)
However, I'm not sure this is actually the correct parameter to specify a guardrail. The parameter is guardrailIdentifier for boto3 as noted in the other answer, and for LangChain you might want to check the docs here?
