ValidationException action is invalid json string using boto3

0

Hi all,

I'm trying to create a quantum task using the boto client and I get a ValidationException "action is invalid json string".

I am creating a python string for the "action" that seems legal, but for some reason I keep getting this exception. The (very simple) string is:

{"braketSchemaHeader": {"name": "braket.ir.jaqcd.program", "version": "1"}, "results": [], "basis_rotation_instructions": [], "instructions": [{"type": "h", "target": 0}, {"type": "h", "target": 1}, {"type": "h", "target": 0}, ]}

I get no other more detailed information on the exception or validation.

Thanks in advance for your help
Best

fim
質問済み 3年前345ビュー
2回答
0

Hi all,

The original message is not showing the complete json action... I'll try to edit it to show the complete string.

But the answer is: the offending character is the last comma in the instructions. You can check that using json.loads(action_string) with and without the comma.

The next problem to solve was the "properties". The boto3 documentation is horrible in the description of the fields. In fact, no description at all.

Thanks
Best

fim
回答済み 3年前
0

Glad to hear that you were able to find the issue with action string!

Thanks for the feedback on the boto3 documentation! This is super helpful. I'm assuming you're referring to the documentation for the parameters here https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/braket.html#Braket.Client.create_quantum_task

We'll work on adding more details to boto3. Meanwhile you can look at the amazon-braket-schemas repository https://github.com/aws/amazon-braket-schemas-python/blob/main/src/braket/ir/jaqcd/program_v1.py which contains the specifications for this field.

We would also love to hear more about the other issues you encountered using Braket and learn more about what tools/details you think you would have found helpful in order to improve your experience. Please feel free to add in additional observations here and we'll try to incorporate those.

AWS
回答済み 3年前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ