AWS SDK DeletePromptで を使用する - AWS SDK コードの例

Doc AWS SDK Examples GitHub リポジトリには、他にも SDK の例があります。 AWS

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

AWS SDK DeletePromptで を使用する

次の例は、DeletePrompt を使用する方法を説明しています。

アクション例は、より大きなプログラムからのコードの抜粋であり、コンテキスト内で実行する必要があります。次のコード例で、このアクションのコンテキストを確認できます。

Python
SDK for Python (Boto3)
注記

GitHub には、その他のリソースもあります。AWS コード例リポジトリ で全く同じ例を見つけて、設定と実行の方法を確認してください。

Amazon Bedrock マネージドプロンプトを削除します。

def delete_prompt(client, prompt_id): """ Deletes an Amazon Bedrock managed prompt. Args: client: Amazon Bedrock Agent boto3 client. prompt_id (str): The identifier of the prompt that you want to delete. Returns: dict: The response from the DeletePrompt operation. """ try: logger.info("Deleting prompt ID: %s.", prompt_id) response = client.delete_prompt( promptIdentifier=prompt_id ) logger.info("Finished deleting prompt ID: %s", prompt_id) return response except ClientError as e: logger.exception("Client error deleting prompt: %s", str(e)) raise except Exception as e: logger.exception("Unexpected error deleting prompt: %s", str(e)) raise
  • API の詳細については、 AWS SDK for Python (Boto3) API リファレンスDeletePrompt」を参照してください。