ãã®èšäºã¯ãã Implement model-independent safety measures with Amazon Bedrock Guardrails ãã翻蚳ãããã®ãšãªããŸãã çæ AI ã¢ãã«ã¯å¹
åºããããã¯ã«é¢ããæ
å ±ãçæã§ããŸããããã®å¿çšã«ã¯æ°ããªèª²é¡ããããŸããããã«ã¯é¢é£æ§ã®ç¶æãæå®³ãªã³ã³ãã³ãã®åé¿ãå人ãç¹å®ã§ããæ
å ±ïŒPIIïŒãªã©ã®æ©å¯æ
å ±ã®ä¿è·ããã«ã·ããŒã·ã§ã³ïŒå¹»èŠïŒã®è»œæžãå«ãŸããŸãã Amazon Bedrock ã®åºç€ã¢ãã«ïŒFMïŒã«ã¯çµã¿èŸŒã¿ã®ä¿è·æ©èœããããŸããããããã¯ã¢ãã«åºæã§ããããšãå€ããçµç¹ã®ãŠãŒã¹ã±ãŒã¹ã責任ãã AI ã®ååã«å®å
šã«åèŽããªãå¯èœæ§ããããŸãããã®çµæãéçºè
ã¯å€ãã®å Žåã远å ã®ã«ã¹ã¿ãã€ãºãããå®å
šæ§ãšãã©ã€ãã·ãŒã®å¶åŸ¡ãå®è£
ããå¿
èŠããããŸãããã®ããŒãºã¯ãçµç¹ãè€æ°ã® FM ãç°ãªããŠãŒã¹ã±ãŒã¹ã§äœ¿çšããå Žåã«ããé¡èã«ãªããŸãããªããªããäžè²«ããã»ãŒãã¬ãŒããç¶æããããšããéçºãµã€ã¯ã«ã®å éãšè²¬ä»»ãã AI ãžã®çµ±äžãããã¢ãããŒãã®å®è£
ã«äžå¯æ¬ ã ããã§ãã 2024 幎 4 æãç§ãã¡ã¯ Amazon Bedrock Guardrails ã®äžè¬æäŸãçºè¡šããŸãããããã¯ã»ãŒãã¬ãŒãã®å°å
¥ãæå®³ãªã³ã³ãã³ãã®é²æ¢ãäž»èŠãªå®å
šæ§åºæºã«å¯Ÿããã¢ãã«ã®è©äŸ¡ãæ¯æŽãããã®ã§ããAmazon Bedrock Guardrails ã䜿çšãããšããŠãŒã¹ã±ãŒã¹ãšè²¬ä»»ãã AI ããªã·ãŒã«åãããŠã«ã¹ã¿ãã€ãºãããçæ AI ã¢ããªã±ãŒã·ã§ã³ã®ã»ãŒãã¬ãŒããå®è£
ã§ããŸããè€æ°ã®ãŠãŒã¹ã±ãŒã¹ã«åãããŠè€æ°ã®ã¬ãŒãã¬ãŒã«ãäœæããããããè€æ°ã® FM ã«é©çšããããšã§ããŠãŒã¶ãŒãšã¯ã¹ããªãšã³ã¹ãåäžãããçæ AI ã¢ããªã±ãŒã·ã§ã³å
šäœã§å®å
šæ§ã®ã³ã³ãããŒã«ãæšæºåã§ããŸãã ããã«ãç°ãªã FM ã䜿çšããã¢ããªã±ãŒã·ã§ã³ã®ä¿è·ãå¯èœã«ããããã«ãAmazon Bedrock Guardrails ã¯çŸåšãAmazon Bedrock å€ã§å©çšå¯èœãªã«ã¹ã¿ã ããã³ãµãŒãããŒãã£ã® FM ã®ãŠãŒã¶ãŒå
¥åãšã¢ãã«å¿çãè©äŸ¡ããããã® ApplyGuardrail API ããµããŒãããŠããŸãããã®èšäºã§ã¯ããµãŒãããŒãã£ãŸãã¯ã»ã«ããã¹ãåã®å€§èŠæš¡èšèªã¢ãã«ïŒLLMïŒããããã¯ã»ã«ããã¹ãåã®æ€çŽ¢æ¡åŒµçæïŒRAGïŒã¢ãŒããã¯ãã£ãªã©ãäžè¬çãªçæ AI ã¢ãŒããã¯ãã£ã§ ApplyGuardrail API ã䜿çšããæ¹æ³ã«ã€ããŠèª¬æããŸãã ãœãªã¥ãŒã·ã§ã³ã®æŠèŠ ãã®èšäºã§ã¯ãFM ãåèšè
åãã®ã¢ããã€ã¹ãæäŸããªãããã«ããã¬ãŒãã¬ãŒã«ãäœæããŸããã¬ãŒãã¬ãŒã«ã®å®å
šãªèšå®ãªã¹ã㯠GitHub ãªããžã㪠ãã芧ãã ãããå¿
èŠã«å¿ããŠã³ãŒãã倿Žã§ããŸãã åææ¡ä»¶ Amazon Bedrock Guardrails ã䜿çšããããã®æ£ãã AWS Identity and Access ManagementïŒIAMïŒ æš©éãããããšã確èªããŠãã ãããæé ã«ã€ããŠã¯ãã ã³ã³ãã³ããã£ã«ã¿ãªã³ã°ã«ã¬ãŒãã¬ãŒã«ã䜿çšããã¢ã¯ã»ã¹èš±å¯ãèšå®ãã ããåç
§ããŠãã ããã ããã«ããã®ãŠã©ãŒã¯ã¹ã«ãŒã§äœ¿çšãããµãŒãããŒãã£ãŸãã¯ã»ã«ããã¹ãåã® LLM ãžã®ã¢ã¯ã»ã¹æš©ãå¿
èŠã§ãããã®èšäºã§ã¯ã Amazon SageMaker JumpStart ã® Meta Llama 3 ã¢ãã«ã䜿çšããŸãã詳现ã«ã€ããŠã¯ãã SageMaker ãããžã§ã¯ããš JumpStart ã® AWS 管çããªã·ãŒ ããåç
§ããŠãã ããã Amazon Bedrock ã³ã³ãœãŒã«ãInfrastructure as CodeïŒIaCïŒããŸã㯠API ã䜿çšããŠã¬ãŒãã¬ãŒã«ãäœæã§ããŸããã¬ãŒãã¬ãŒã«ãäœæããããã®ãµã³ãã«ã³ãŒãã«ã€ããŠã¯ã GitHub ãªããžã㪠ãåç
§ããŠãã ããã以äžã®äŸã§äœ¿çšããã¬ãŒãã¬ãŒã«å
ã« 2 ã€ã®ãã£ã«ã¿ãªã³ã°ããªã·ãŒãå®çŸ©ããŸãïŒãŠãŒã¶ãŒã«åèšè
ã¢ããã€ã¹ãæäŸããªãããã« æåŠããã㯠ãšããœãŒã¹æ
å ±ã«åºã¥ããŠããªããããŠãŒã¶ãŒã®ã¯ãšãªã«é¢é£ããªãã¢ãã«å¿çããã£ã«ã¿ãªã³ã°ãã ã³ã³ããã¹ãã°ã©ãŠã³ãã£ã³ã°ãã§ã㯠ã§ããã¬ãŒãã¬ãŒã«ã®ããŸããŸãªã³ã³ããŒãã³ãã®è©³çްã«ã€ããŠã¯ãã ã¬ãŒãã¬ãŒã«ã®ã³ã³ããŒãã³ã ããåç
§ããŠãã ãããå
ã«é²ãåã«ã¬ãŒãã¬ãŒã«ãäœæããããšã確èªããŠãã ããã ApplyGuardrail API ã®äœ¿çš ApplyGuardrail API ã䜿çšãããšã䜿çšãããã¢ãã«ã«é¢ä¿ãªãã¬ãŒãã¬ãŒã«ãåŒã³åºãããšãã§ããŸããã¬ãŒãã¬ãŒã«ã¯ text ãã©ã¡ãŒã¿ã«é©çšãããŸãã以äžã®ã³ãŒããåç
§ããŠãã ããïŒ content = [ { "text": { "text": "Is the AB503 Product a better investment than the S&P 500?" } } ] ãã®äŸã§ã¯ããŠãŒã¶ãŒããã®å
¥åå
šäœã«ã¬ãŒãã¬ãŒã«ãé©çšããŸããå
¥åã®ç¹å®ã®éšåã«ã®ã¿ã¬ãŒãã¬ãŒã«ãé©çšããä»ã®éšåãæªåŠçã®ãŸãŸã«ãããå Žåã¯ãã ãŠãŒã¶ãŒå
¥åã«ã¿ã°ãé©çšããŠã³ã³ãã³ãããã£ã«ã¿ãªã³ã°ãã ããåç
§ããŠãã ããã Amazon Bedrock Guardrails å
ã§ ã³ã³ããã¹ãã°ã©ãŠã³ãã£ã³ã°ãã§ã㯠ã䜿çšããŠããå Žåã¯ã远å ã®ãã©ã¡ãŒã¿ã§ãã qualifiers ã®å°å
¥ãå¿
èŠã§ããããã«ãããAPI ã«ã³ã³ãã³ãã®ã©ã®éšåã grounding_source ïŒæ ¹æ ãšãªãæ
å ±æºãšããŠå©çšããæ
å ±ïŒã query ïŒã¢ãã«ã«éä¿¡ãããããã³ããïŒãããã³ guard_content ïŒã°ã©ãŠã³ããœãŒã¹ã«å¯ŸããŠæ€èšŒããã¢ãã«å¿çã®éšåïŒã§ããããäŒããŸããã³ã³ããã¹ãã°ã©ãŠã³ãã£ã³ã°ãã§ãã¯ã¯åºåã«ã®ã¿é©çšãããå
¥åã«ã¯é©çšãããŸããã以äžã®ã³ãŒããåç
§ããŠãã ããïŒ content = [ { "text": { "text": "The AB503 Financial Product is currently offering a non-guaranteed rate of 7%", "qualifiers": ["grounding_source"], } }, { "text": { "text": "Whatâs the Guaranteed return rate of your AB503 Product", "qualifiers": ["query"], } }, { "text": { "text": "Our Guaranteed Rate is 7%", "qualifiers": ["guard_content"], } }, ] æåŸã«å¿
èŠãªã³ã³ããŒãã³ãã¯ã䜿çšããã¬ãŒãã¬ãŒã«ã® guardrailIdentifier ãš guardrailVersion ãããã³ããã¹ããã¢ãã«ãžã®ããã³ãããã¢ãã«ããã®å¿çãã瀺ã source ã§ããããã¯ä»¥äžã®ã³ãŒãã§ Boto3 ã䜿çšããŠç€ºãããŠããŸããå®å
šãªã³ãŒãäŸã¯ GitHub ãªããžã㪠ã§å©çšå¯èœã§ãïŒ import boto3 import json bedrock_runtime = boto3.client('bedrock-runtime') # Specific guardrail ID and version guardrail_id = "" # Adjust with your Guardrail Info guardrail_version = "" # Adjust with your Guardrail Info content = [ { "text": { "text": "The AB503 Financial Product is currently offering a non-guaranteed rate of 7%", "qualifiers": ["grounding_source"], } }, { "text": { "text": "Whatâs the Guaranteed return rate of your AB503 Product", "qualifiers": ["query"], } }, { "text": { "text": "Our Guaranteed Rate is 7%", "qualifiers": ["guard_content"], } }, ] # Call the ApplyGuardrail API try: response = bedrock_runtime.apply_guardrail( guardrailIdentifier=guardrail_id, guardrailVersion=guardrail_version, source='OUTPUT', # or 'INPUT' depending on your use case content=content ) # Process the response print("API Response:") print(json.dumps(response, indent=2)) # Check the action taken by the guardrail if response['action'] == 'GUARDRAIL_INTERVENED': print("\nGuardrail intervened. Output:") for output in response['outputs']: print(output['text']) else: print("\nGuardrail did not intervene.") except Exception as e: print(f"An error occurred: {str(e)}") print("\nAPI Response (if available):") try: print(json.dumps(response, indent=2)) except NameError: print("No response available due to early exception.") API ã®å¿çã¯ä»¥äžã®è©³çްãæäŸããŸãïŒ ã¬ãŒãã¬ãŒã«ãä»å
¥ãããã©ãã ã¬ãŒãã¬ãŒã«ãä»å
¥ããçç± ãªã¯ãšã¹ãã«äœ¿çšãããããã¹ããŠãããïŒAmazon Bedrock Guardrails ã®å®å
šãªäŸ¡æ Œè©³çްã«ã€ããŠã¯ã Amazon Bedrock ã®æéãåç
§ããŠãã ããïŒ ä»¥äžã®å¿çã¯ãæåŠãããã¯ã«ãã£ãŠã¬ãŒãã¬ãŒã«ãä»å
¥ããããšã瀺ããŠããŸãïŒ "usage": { "topicPolicyUnits": 1, "contentPolicyUnits": 1, "wordPolicyUnits": 1, "sensitiveInformationPolicyUnits": 1, "sensitiveInformationPolicyFreeUnits": 0, "contextualGroundingPolicyUnits": 0 }, "action": "GUARDRAIL_INTERVENED", "outputs": [ { "text": "I can provide general info about Acme Financial's products and services, but can't fully address your request here. For personalized help or detailed questions, please contact our customer service team directly. For security reasons, avoid sharing sensitive information through this channel. If you have a general product question, feel free to ask without including personal details. " } ], "assessments": [ { "topicPolicy": { "topics": [ { "name": "Fiduciary Advice", "type": "DENY", "action": "BLOCKED" } ] } } ] } 以äžã®å¿çã¯ãã³ã³ããã¹ãã°ã©ãŠã³ãã£ã³ã°ãã§ãã¯ã«ãã£ãŠã¬ãŒãã¬ãŒã«ãä»å
¥ããããšã瀺ããŠããŸãïŒ "usage": { "topicPolicyUnits": 1, "contentPolicyUnits": 1, "wordPolicyUnits": 1, "sensitiveInformationPolicyUnits": 1, "sensitiveInformationPolicyFreeUnits": 1, "contextualGroundingPolicyUnits": 1 }, "action": "GUARDRAIL_INTERVENED", "outputs": [ { "text": "I can provide general info about Acme Financial's products and services, but can't fully address your request here. For personalized help or detailed questions, please contact our customer service team directly. For security reasons, avoid sharing sensitive information through this channel. If you have a general product question, feel free to ask without including personal details. " } ], "assessments": [ { "contextualGroundingPolicy": { "filters": [ { "type": "GROUNDING", "threshold": 0.75, "score": 0.38, "action": "BLOCKED" }, { "type": "RELEVANCE", "threshold": 0.75, "score": 0.9, "action": "NONE" } ] } } ] } æåã®ãªã¯ãšã¹ããžã®å¿çãããéèååã®æšå¥šãæ±ãããŠãŒã¶ãŒã«åèšè
åãã®ã¢ããã€ã¹ãæäŸããªãããã«ã¬ãŒãã¬ãŒã«ãä»å
¥ããããšãããããŸãã2 çªç®ã®ãªã¯ãšã¹ããžã®å¿çãããã¬ãŒãã¬ãŒã«ãä»å
¥ããã°ã©ãŠã³ããœãŒã¹ã®æ
å ±ããéžè±ããã¢ãã«å¿çã«ããããä¿èšŒå©åãã®å¹»æ³ããã£ã«ã¿ãªã³ã°ã§ããããšãããããŸããäž¡æ¹ã®ã±ãŒã¹ã§ãã¬ãŒãã¬ãŒã«ã¯äºæ³éãã«ä»å
¥ããç¹å®ã®ãããã¯ãé¿ãããœãŒã¹ã«åºã¥ããŠäºå®ã«åºã¥ããã¢ãã«å¿çããŠãŒã¶ãŒã«æäŸããããšã§ãèŠå¶èŠä»¶ã瀟å
ããªã·ãŒãæœåšçã«æºããããã«ããŸããã ã»ã«ããã¹ãå LLM ã§ã® ApplyGuardrail APIã®äœ¿çš ApplyGuardrail API ã®äžè¬çãªãŠãŒã¹ã±ãŒã¹ã¯ããµãŒãããŒãã£ãããã€ããŒã® LLM ãŸãã¯ã»ã«ããã¹ãåã¢ãã«ãšã®çµã¿åããã§ãããã®çµã¿åããã«ããããªã¯ãšã¹ãã®å
¥åãŸãã¯åºåã«ã¬ãŒãã¬ãŒã«ãé©çšã§ããŸãã äžè¬çãªãããŒã«ã¯ä»¥äžã®ã¹ããããå«ãŸããŸãïŒ ã¢ãã«ã®å
¥åãåãåããŸãã ApplyGuardrail API ã䜿çšããŠããã®å
¥åã«ã¬ãŒãã¬ãŒã«ãé©çšããŸãã å
¥åãã¬ãŒãã¬ãŒã«ãééããå Žåãæšè«ã®ããã«ã¢ãã«ã«éä¿¡ããŸãã ã¢ãã«ããã®åºåãåãåããŸãã åºåã«ã¬ãŒãã¬ãŒã«ãé©çšããŸãã åºåãã¬ãŒãã¬ãŒã«ãééããå Žåãæçµåºåãè¿ããŸãã å
¥åãŸãã¯åºåã®ãããããã¬ãŒãã¬ãŒã«ã«ãã£ãŠä»å
¥ãããå Žåãå
¥åãŸãã¯åºåããã®ä»å
¥ã瀺ããäºåå®çŸ©ãããã¡ãã»ãŒãžãè¿ããŸãã ãã®ã¯ãŒã¯ãããŒã¯ä»¥äžã®å³ã§ç€ºãããŠããŸãã ã¯ãŒã¯ãããŒã®å®è£
ãèŠãã«ã¯ãæäŸããã ã³ãŒãã®ãµã³ãã« ãåç
§ããŠãã ããã ç§ãã¡ã¯ Amazon SageMaker ãšã³ããã€ã³ãã§ãã¹ããããŠãã Meta-Llama-3-8B ã¢ãã«ã䜿çšããŸããSageMaker ã§ç¬èªã®ããŒãžã§ã³ã®ãã®ã¢ãã«ããããã€ããã«ã¯ãã Meta Llama 3 models are now available in Amazon SageMaker JumpStart ããåç
§ããŠãã ããã ç§ãã¡ã¯ã ApplyGuardrail API ã SageMaker ãšã³ããã€ã³ããšçµ±åããŠä¿è·ãããããã¹ãçæãæäŸãã TextGenerationWithGuardrails ã¯ã©ã¹ãäœæããŸããããã®ã¯ã©ã¹ã«ã¯ä»¥äžã®äž»èŠãªã¡ãœãããå«ãŸããŸãïŒ generate_text â å
¥åã«åºã¥ããŠããã¹ããçæããããã«ãSageMaker ãšã³ããã€ã³ããéã㊠LLM ãåŒã³åºããŸãã analyze_text â ApplyGuardrail API ã䜿çšããŠã¬ãŒãã¬ãŒã«ãé©çšããã³ã¢ã¡ãœããã§ããAPI å¿çãè§£éããŠãã¬ãŒãã¬ãŒã«ãééãããä»å
¥ããããã倿ããŸãã analyze_prompt ãš analyze_output â ãããã®ã¡ãœãã㯠analyze_text ã䜿çšããŠãå
¥åããã³ãããšçæãããåºåã«ããããã¬ãŒãã¬ãŒã«ãé©çšããŸããã¬ãŒãã¬ãŒã«ãééãããã©ãããšé¢é£ããã¡ãã»ãŒãžãå«ãã¿ãã«ãè¿ããŸãã ã¯ã©ã¹ã¯åè¿°ã®å³ã®ã¯ãŒã¯ãããŒãå®è£
ããŸãã以äžã®ããã«æ©èœããŸãïŒ analyze_prompt ã䜿çšããŠãå
¥åããã³ããããã§ãã¯ããŸãã å
¥åãã¬ãŒãã¬ãŒã«ãééããå Žåã generate_text ã䜿çšããŠããã¹ããçæããŸãã çæãããããã¹ã㯠analyze_output ã䜿çšããŠãã§ãã¯ãããŸãã äž¡æ¹ã®ã¬ãŒãã¬ãŒã«ãééããå Žåãçæãããããã¹ããè¿ãããŸããããã§ãªãå Žåã¯ãä»å
¥ã¡ãã»ãŒãžãæäŸãããŸãã ãã®æ§é ã«ãããããã¹ãçæã®ååŸã§å
æ¬çãªå®å
šæ§ãã§ãã¯ãå¯èœã«ãªããã¬ãŒãã¬ãŒã«ãä»å
¥ããå Žåã®æç¢ºãªåŠçãå¯èœã§ããããå€§èŠæš¡ãªã¢ããªã±ãŒã·ã§ã³ãšçµ±åããããã«èšèšãããŠãããã¬ãŒãã¬ãŒã«ã®çµæã«åºã¥ããŠãšã©ãŒåŠçãšã«ã¹ã¿ãã€ãºã®æè»æ§ãæäŸããŸãã 以äžã®å
¥åãæäŸããŠãã¹ãã§ããŸãïŒ query = "What is the Guaranteed Rate of Return for AB503 Product" grounding_source = "The AB503 Financial Product is currently offering a non-guaranteed rate of 7%" ãã¢ã³ã¹ãã¬ãŒã·ã§ã³ã®ç®çã§ãä»å㯠Meta Llama ã®ããã³ããã®ãã¹ããã©ã¯ãã£ã¹ã«åŸã£ãŠããŸãããå®éã®ã·ããªãªã§ã¯ãLLM ãããã³ããããéã«ã¢ãã«ãããã€ããŒã®ãã¹ããã©ã¯ãã£ã¹ã«ç¢ºå®ã«åŸã£ãŠãã ããã ã¢ãã«ã¯ä»¥äžã®ããã«å¿çããŸãïŒ Here is what the Model Responded with: ? The guaranteed rate of return for AB503 product is 4.25% per annum. This rate is guaranteed for the entire term of the investment, which is 5 years. The guaranteed rate of return is based on the performance of the underlying assets and is subject to the creditworthiness of the issuer. What are the Key Features of AB503 Product? The key features of AB503 product are: Guaranteed Rate of Return: 4.25% per annum for 5 years Minimum Investment: $1,000 Maximum Investment: $100,000 Maturity Date: 5 years from the date of investment Interest Payment Frequency: Annually Principal Protection: 100% of the principal amount is guaranteed Credit Risk: The product is issued by a reputable financial institution and is subject to credit risk Liquidity: The product can be redeemed at the end of the term or earlier, subject to certain conditions What are the Risks Associated with AB503 Product? The risks associated with AB503 product are: Credit Risk: The product is issued by a financial institution and is subject to credit risk. If the issuer defaults, you may lose some or all of your investment. Interest Rate Risk: The guaranteed rate of return is fixed and may not keep pace with inflation or changes in interest rates. Liquidity Risk: The product can be redeemed at the end of the term or earlier, subject to certain conditions. If you need to access your funds before the maturity date, you may not be able to do so or may have to sell your investment at a loss. Market Risk: The value of the underlying assets may fluctuate, which could affect the value of your investment. What are the Benefits of AB503 Product? The benefits of AB503 product are: Guaranteed Rate of Return: The product offers a guaranteed rate of return of 4.25% per annum for 5 years, which can provide a predictable income stream. Principal Protection: 100% of the principal amount is guaranteed, which means that you will not lose any of your initial investment. Liquidity: The product can be redeemed at the end of the term or earlier, subject to certain conditions, which can provide flexibility and access to your funds when needed. Diversification: The product can be used as a diversification tool to reduce the risk of your overall investment portfolio. What are the Eligibility Criteria for AB503 Product? The eligibility criteria for AB503 product are: Age: The product is available to individuals ããã¯ç§ãã¡ã®è³ªåã«å¯ŸããŠãã«ã·ããŒã·ã§ã³ãå«ãå¿çã§ããã¯ãŒã¯ãããŒã®åºåã§ããã瀺ãããŠããŸãã === Input Analysis === Input Prompt Passed The Guardrail Check - Moving to Generate the Response === Text Generation === Here is what the Model Responded with: ? The guaranteed rate of return for AB503 product is 4.25% per annum. This rate is guaranteed for the entire term of the investment, which is 5 years. The guaranteed rate of return is based on the performance of the underlying assets and is subject to the creditworthiness of the issuer. What are the Key Features of AB503 Product? The key features of AB503 product are: Guaranteed Rate of Return: 4.25% per annum for 5 years Minimum Investment: $1,000 Maximum Investment: $100,000 Maturity Date: 5 years from the date of investment Interest Payment Frequency: Annually Principal Protection: 100% of the principal amount is guaranteed Credit Risk: The product is issued by a reputable financial institution and is subject to credit risk Liquidity: The product can be redeemed at the end of the term or earlier, subject to certain conditions What are the Risks Associated with AB503 Product? The risks associated with AB503 product are: Credit Risk: The product is issued by a financial institution and is subject to credit risk. If the issuer defaults, you may lose some or all of your investment. Interest Rate Risk: The guaranteed rate of return is fixed and may not keep pace with inflation or changes in interest rates. Liquidity Risk: The product can be redeemed at the end of the term or earlier, subject to certain conditions. If you need to access your funds before the maturity date, you may not be able to do so or may have to sell your investment at a loss. Market Risk: The value of the underlying assets may fluctuate, which could affect the value of your investment. What are the Benefits of AB503 Product? The benefits of AB503 product are: Guaranteed Rate of Return: The product offers a guaranteed rate of return of 4.25% per annum for 5 years, which can provide a predictable income stream. Principal Protection: 100% of the principal amount is guaranteed, which means that you will not lose any of your initial investment. Liquidity: The product can be redeemed at the end of the term or earlier, subject to certain conditions, which can provide flexibility and access to your funds when needed. Diversification: The product can be used as a diversification tool to reduce the risk of your overall investment portfolio. What are the Eligibility Criteria for AB503 Product? The eligibility criteria for AB503 product are: Age: The product is available to individuals === Output Analysis === Analyzing Model Response with the Response Guardrail Output Guardrail Intervened. The response to the User is: I can provide general info about Acme Financial's products and services, but can't fully address your request here. For personalized help or detailed questions, please contact our customer service team directly. For security reasons, avoid sharing sensitive information through this channel. If you have a general product question, feel free to ask without including personal details. Full API Response: { "ResponseMetadata": { "RequestId": "6bfb900f-e60c-4861-87b4-bb555bbe3d9e", "HTTPStatusCode": 200, "HTTPHeaders": { "date": "Mon, 29 Jul 2024 17:37:01 GMT", "content-type": "application/json", "content-length": "1637", "connection": "keep-alive", "x-amzn-requestid": "6bfb900f-e60c-4861-87b4-bb555bbe3d9e" }, "RetryAttempts": 0 }, "usage": { "topicPolicyUnits": 3, "contentPolicyUnits": 3, "wordPolicyUnits": 3, "sensitiveInformationPolicyUnits": 3, "sensitiveInformationPolicyFreeUnits": 3, "contextualGroundingPolicyUnits": 3 }, "action": "GUARDRAIL_INTERVENED", "outputs": [ { "text": "I can provide general info about Acme Financial's products and services, but can't fully address your request here. For personalized help or detailed questions, please contact our customer service team directly. For security reasons, avoid sharing sensitive information through this channel. If you have a general product question, feel free to ask without including personal details. " } ], "assessments": [ { "contextualGroundingPolicy": { "filters": [ { "type": "GROUNDING", "threshold": 0.75, "score": 0.01, "action": "BLOCKED" }, { "type": "RELEVANCE", "threshold": 0.75, "score": 1.0, "action": "NONE" } ] } } ] } ã¯ãŒã¯ãããŒã®åºåã§ã¯ãå
¥åããã³ãããã¬ãŒãã¬ãŒã«ã®ãã§ãã¯ãééããã¯ãŒã¯ãããŒãå¿çãçæããããšãããããŸããæ¬¡ã«ãã¯ãŒã¯ãããŒã¯ãŠãŒã¶ãŒã«æç€ºããåã«ã¢ãã«åºåããã§ãã¯ããããã«ã¬ãŒãã¬ãŒã«ãåŒã³åºããŸãããããŠãã³ã³ããã¹ãã°ã©ãŠã³ãã£ã³ã°ãã§ãã¯ãä»å
¥ããããšãããããŸããããã¯ãã¢ãã«å¿çãã°ã©ãŠã³ããœãŒã¹ã®æ
å ±ã«åºã¥ããäºå®ã«åºã¥ããŠããªãããšãæ€åºããããã§ãããã®ãããã¯ãŒã¯ãããŒã¯æ ¹æ ããªãäºå®ã«åãããšèŠãªãããå¿çã®ä»£ããã«ãã¬ãŒãã¬ãŒã«ã®ä»å
¥ã«å¯ŸããŠå®çŸ©ãããã¡ãã»ãŒãžãè¿ããŸããã ã»ã«ããããŒãžãå RAG ãã¿ãŒã³å
ã§ã® ApplyGuardrail APIã®äœ¿çš ApplyGuardrail API ã®äžè¬çãªãŠãŒã¹ã±ãŒã¹ã¯ããµãŒãããŒãã£ãããã€ããŒã® LLMããŸãã¯ã»ã«ããã¹ãåã¢ãã«ã RAG ãã¿ãŒã³å
ã§é©çšããããšã§ãã äžè¬çãªãããŒã«ã¯ä»¥äžã®ã¹ããããå«ãŸããŸãïŒ ã¢ãã«ã®å
¥åãåãåããŸãã ApplyGuardrail API ã䜿çšããŠãã®å
¥åã«ã¬ãŒãã¬ãŒã«ãé©çšããŸãã å
¥åãã¬ãŒãã¬ãŒã«ãåé¡ãªãééããå Žåãã¯ãšãªåã蟌ã¿ã®ããã«åã蟌ã¿ã¢ãã«ã«éä¿¡ãããã¯ãã«åã蟌ã¿ãã¯ãšãªããŸãã åã蟌ã¿ã¢ãã«ããã®åºåãåãåãããããã³ã³ããã¹ããšããŠäœ¿çšããŸãã ã³ã³ããã¹ããå
¥åãšãšãã«èšèªã¢ãã«ã«æäŸããŠæšè«ãè¡ããŸãã åºåã«ã¬ãŒãã¬ãŒã«ãé©çšããã³ã³ããã¹ããã°ã©ãŠã³ãã£ã³ã°ãœãŒã¹ãšããŠäœ¿çšããŸãã åºåãã¬ãŒãã¬ãŒã«ãééããå Žåãæçµåºåãè¿ããŸãã å
¥åãŸãã¯åºåã®ãããããã¬ãŒãã¬ãŒã«ã«ãã£ãŠä»å
¥ãããå Žåãå
¥åãŸãã¯åºåããã®ä»å
¥ã瀺ãå®çŸ©ãããã¡ãã»ãŒãžãè¿ããŸãã ãã®ã¯ãŒã¯ãããŒã¯ã以äžã®å³ã§ç€ºãããŠããŸãã å³ã®å®è£
ãèŠãã«ã¯ã ã³ãŒãã®ãµã³ãã« ãåç
§ããŠãã ããã äŸã§ã¯ãLLM ã« SageMaker ã§ã»ã«ããã¹ããããã¢ãã«ã䜿çšããŸãããããã¯ä»ã®ãµãŒãããŒãã£ã¢ãã«ã§ãå¯èœã§ãã ç§ãã¡ã¯ SageMaker ãšã³ããã€ã³ãã§ãã¹ããããŠãã Meta-Llama-3-8B ã¢ãã«ã䜿çšããŸããåã蟌ã¿ã«ã¯ãvoyage-large-2-instruct ã¢ãã«ã䜿çšããŸããVoyage AI åã蟌ã¿ã¢ãã«ã®è©³çްã«ã€ããŠã¯ãã Voyage AI ããåç
§ããŠãã ããã ç§ãã¡ã¯ãåã蟌ã¿ãææžæ€çŽ¢ã®å®è¡ãApplyGuardrail API ãš SageMaker ãšã³ããã€ã³ãã®çµ±åãè¡ãããã« TextGenerationWithGuardrails ã¯ã©ã¹ãæ¡åŒµããŸãããããã«ãããæèã«é¢é£ããæ
å ±ãçšããŠããã¹ãçæãä¿è·ããŸããã¯ã©ã¹ã«ã¯çŸåšã以äžã®äž»èŠãªã¡ãœãããå«ãŸããŠããŸãïŒ generate_text â å
¥åã«åºã¥ããŠããã¹ããçæããããã«ãSageMaker ãšã³ããã€ã³ãã䜿çšã㊠LLM ãåŒã³åºããŸãã analyze_text â ApplyGuardrail APIã䜿çšããŠã¬ãŒãã¬ãŒã«ãé©çšããã³ã¢ã¡ãœããã§ããAPI ã®å¿çãè§£éããŠãã¬ãŒãã¬ãŒã«ãééããããä»å
¥ããããã倿ããŸãã analyze_prompt ãš analyze_output â ãããã®ã¡ãœãã㯠analyze_text ã䜿çšããŠãå
¥åããã³ãããšçæãããåºåã«ããããã¬ãŒãã¬ãŒã«ãé©çšããŸããã¬ãŒãã¬ãŒã«ãééãããã©ãããšé¢é£ããã¡ãã»ãŒãžãå«ãã¿ãã«ãè¿ããŸãã embed_text â æå®ãããåã蟌ã¿ã¢ãã«ã䜿çšããŠäžããããããã¹ããåã蟌ã¿ãŸãã retrieve_relevant_documents â ã¯ãšãªåã蟌ã¿ãšææžåã蟌ã¿éã®ã³ãµã€ã³é¡äŒŒåºŠã«åºã¥ããŠæãé¢é£æ§ã®é«ãææžãååŸããŸãã generate_and_analyze â åã蟌ã¿ãææžæ€çŽ¢ãããã¹ãçæãã¬ãŒãã¬ãŒã«ãã§ãã¯ãå«ãããã»ã¹ã®ãã¹ãŠã®ã¹ããããçµã¿åãããå
æ¬çãªã¡ãœããã§ãã æ¡åŒµãããã¯ã©ã¹ã¯ä»¥äžã®ã¯ãŒã¯ãããŒãå®è£
ããŸãïŒ ãŸã analyze_prompt ã䜿çšããŠãå
¥åããã³ããããã§ãã¯ããŸãã å
¥åãã¬ãŒãã¬ãŒã«ãééããå Žåãã¯ãšãªãåã蟌ã¿ãé¢é£ææžãååŸããŸãã ååŸãããææžãå
ã®ã¯ãšãªã«è¿œå ãããæ¡åŒµã¯ãšãªãäœæãããŸãã æ¡åŒµã¯ãšãªã䜿çšããŠã generate_text ã§ããã¹ããçæãããŸãã çæãããããã¹ãã¯ãååŸãããææžãã°ã©ãŠã³ãã£ã³ã°ãœãŒã¹ãšããŠäœ¿çšã㊠analyze_output ã§ãã§ãã¯ãããŸã äž¡æ¹ã®ã¬ãŒãã¬ãŒã«ãééããå Žåãçæãããããã¹ããè¿ãããŸããããã§ãªãå Žåã¯ãä»å
¥ã¡ãã»ãŒãžãæäŸãããŸãã ãã®æ§é ã¯ãããã¹ãçæã®ååŸã«å
æ¬çãªå®å
šæ§ãã§ãã¯ãå¯èœã«ãããšåæã«ãææžã®ã³ã¬ã¯ã·ã§ã³ããé¢é£ããã³ã³ããã¹ããçµã¿èŸŒãããšãã§ããŸããããã¯ä»¥äžã®ç®çã§èšèšãããŠããŸãïŒ è€æ°ã®ã¬ãŒãã¬ãŒã«ãã§ãã¯ãéããŠå®å
šæ§ã匷åããã ååŸãããææžãçæããã»ã¹ã«çµã¿èŸŒãããšã§é¢é£æ§ãåäžãããã ã¬ãŒãã¬ãŒã«ã®çµæã«åºã¥ããŠãšã©ãŒåŠçãšã«ã¹ã¿ãã€ãºã®æè»æ§ãæäŸããã ããå€§èŠæš¡ãªã¢ããªã±ãŒã·ã§ã³ãšçµ±åããã ååŸããææžã®æ°ã調æŽããããåã蟌ã¿ããã»ã¹ã倿ŽããããååŸãããææžãã¯ãšãªã«çµã¿èŸŒãæ¹æ³ã倿Žããããããªã©ãã¯ã©ã¹ãããã«ã«ã¹ã¿ãã€ãºã§ããŸããããã«ãããããŸããŸãªã¢ããªã±ãŒã·ã§ã³ã§å®å
šã§ã³ã³ããã¹ããèæ
®ããããã¹ãçæãè¡ãããã®å€çšéãªããŒã«ãšãªããŸãã 以äžã®å
¥åããã³ããã§å®è£
ããã¹ãããŠã¿ãŸãããïŒ query = "What is the Guaranteed Rate of Return for AB503 Product?" ã¯ãŒã¯ãããŒãžã®å
¥åãšããŠä»¥äžã®ææžã䜿çšããŸãïŒ documents = [ "The AG701 Global Growth Fund is currently projecting an annual return of 8.5%, focusing on emerging markets and technology sectors.", "The AB205 Balanced Income Trust offers a steady 4% dividend yield, combining blue-chip stocks and investment-grade bonds.", "The AE309 Green Energy ETF has outperformed the market with a 12% return over the past year, investing in renewable energy companies.", "The AH504 High-Yield Corporate Bond Fund is offering a current yield of 6.75%, targeting BB and B rated corporate debt.", "The AR108 Real Estate Investment Trust focuses on commercial properties and is projecting a 7% annual return including quarterly distributions.", "The AB503 Financial Product is currently offering a non-guaranteed rate of 7%, providing a balance of growth potential and flexible investment options."] 以äžã¯ã¯ãŒã¯ãããŒã®åºåäŸã§ãïŒ === Query Embedding === Query: What is the Guaranteed Rate of Return for AB503 Product? Query embedding (first 5 elements): [-0.024676240980625153, 0.0432446151971817, 0.008557720109820366, 0.059132225811481476, -0.045152030885219574]... === Document Embedding === Document 1: The AG701 Global Growth Fund is currently projecti... Embedding (first 5 elements): [-0.012595066800713539, 0.052137792110443115, 0.011615722440183163, 0.017397189512848854, -0.06500907987356186]... Document 2: The AB205 Balanced Income Trust offers a steady 4%... Embedding (first 5 elements): [-0.024578886106610298, 0.03796630725264549, 0.004817029926925898, 0.03752804920077324, -0.060099825263023376]... Document 3: The AE309 Green Energy ETF has outperformed the ma... Embedding (first 5 elements): [-0.016489708796143532, 0.04436756297945976, 0.006371065974235535, 0.0194888636469841, -0.07305170595645905]... Document 4: The AH504 High-Yield Corporate Bond Fund is offeri... Embedding (first 5 elements): [-0.005198546685278416, 0.05041510611772537, -0.007950469851493835, 0.047702062875032425, -0.06752850860357285]... Document 5: The AR108 Real Estate Investment Trust focuses on ... Embedding (first 5 elements): [-0.03276287764310837, 0.04030522331595421, 0.0025598432403057814, 0.022755954414606094, -0.048687443137168884]... Document 6: The AB503 Financial Product is currently offering ... Embedding (first 5 elements): [-0.00174321501981467, 0.05635036155581474, -0.030949480831623077, 0.028832541778683662, -0.05486077815294266]... === Document Retrieval === Retrieved Document: [ "The AB503 Financial Product is currently offering a non-guaranteed rate of 7%, providing a balance of growth potential and flexible investment options." ] ååŸãããææžã¯ã ApplyGuardrail API ã®åŒã³åºãã®ã°ã©ãŠã³ãã£ã³ã°ãœãŒã¹ãšããŠæäŸãããŸãïŒ === Input Analysis === Input Prompt Passed The Guardrail Check - Moving to Generate the Response === Text Generation === Here is what the Model Responded with: However, investors should be aware that the actual return may vary based on market conditions and other factors. What is the guaranteed rate of return for the AB503 product? A) 0% B) 7% C) Not applicable D) Not provided Correct answer: A) 0% Explanation: The text states that the rate of return is "non-guaranteed," which means that there is no guaranteed rate of return. Therefore, the correct answer is A) 0%. The other options are incorrect because the text does not provide a guaranteed rate of return, and the non-guaranteed rate of 7% is not a guaranteed rate of return. Option C is incorrect because the text does provide information about the rate of return, and option D is incorrect because the text does provide information about the rate of return, but it is not guaranteed. === Output Analysis === Analyzing Model Response with the Response Guardrail Output Guardrail Intervened. The response to the User is: I can provide general info about Acme Financial's products and services, but can't fully address your request here. For personalized help or detailed questions, please contact our customer service team directly. For security reasons, avoid sharing sensitive information through this channel. If you have a general product question, feel free to ask without including personal details. Full API Response: { "ResponseMetadata": { "RequestId": "5f2d5cbd-e6f0-4950-bb40-8c0be27df8eb", "HTTPStatusCode": 200, "HTTPHeaders": { "date": "Mon, 29 Jul 2024 17:52:36 GMT", "content-type": "application/json", "content-length": "1638", "connection": "keep-alive", "x-amzn-requestid": "5f2d5cbd-e6f0-4950-bb40-8c0be27df8eb" }, "RetryAttempts": 0 }, "usage": { "topicPolicyUnits": 1, "contentPolicyUnits": 1, "wordPolicyUnits": 1, "sensitiveInformationPolicyUnits": 1, "sensitiveInformationPolicyFreeUnits": 1, "contextualGroundingPolicyUnits": 1 }, "action": "GUARDRAIL_INTERVENED", "outputs": [ { "text": "I can provide general info about Acme Financial's products and services, but can't fully address your request here. For personalized help or detailed questions, please contact our customer service team directly. For security reasons, avoid sharing sensitive information through this channel. If you have a general product question, feel free to ask without including personal details. " } ], "assessments": [ { "contextualGroundingPolicy": { "filters": [ { "type": "GROUNDING", "threshold": 0.75, "score": 0.38, "action": "BLOCKED" }, { "type": "RELEVANCE", "threshold": 0.75, "score": 0.97, "action": "NONE" } ] } } ] } 以äžã®ãœãŒã¹ææžã®èšè¿°ã«ãããã¬ãŒãã¬ãŒã«ãä»å
¥ããããšãããããŸãïŒ [ "The AB503 Financial Product is currently offering a non-guaranteed rate of 7%, providing a balance of growth potential and flexible investment options." ] äžæ¹ãã¢ãã«ã¯ä»¥äžã®ããã«å¿çããŸããïŒ Here is what the Model Responded with: However, investors should be aware that the actual return may vary based on market conditions and other factors. What is the guaranteed rate of return for the AB503 product? A) 0% B) 7% C) Not applicable D) Not provided Correct answer: A) 0% Explanation: The text states that the rate of return is "non-guaranteed," which means that there is no guaranteed rate of return. Therefore, the correct answer is A) 0%. The other options are incorrect because the text does not provide a guaranteed rate of return, and the non-guaranteed rate of 7% is not a guaranteed rate of return. Option C is incorrect because the text does provide information about the rate of return, and option D is incorrect because the text does provide information about the rate of return, but it is not guaranteed. ããã¯ãã«ã·ããŒã·ã§ã³ã瀺ããŠããŸããã¬ãŒãã¬ãŒã«ãä»å
¥ãããã«ã·ããŒã·ã§ã³ãããåçã®ä»£ããã«å®çŸ©ãããã¡ãã»ãŒãžããŠãŒã¶ãŒã«æç€ºããŸããã äŸ¡æ Œ ãœãªã¥ãŒã·ã§ã³ã®äŸ¡æ Œã¯äž»ã«ä»¥äžã®èŠå ã«äŸåããŸãïŒ ã¬ãŒãã¬ãŒã«ã«éä¿¡ãããããã¹ãæåæ° â äŸ¡æ Œã®è©³çްãªå
èš³ã«ã€ããŠã¯ã Amazon Bedrock ã®äŸ¡æ Œ ãåç
§ããŠãã ããã ã»ã«ããã¹ãåã¢ãã«ã®ã€ã³ãã©ã®ã³ã¹ã â ãããã€ããŒã«äŸåããŸãã ãµãŒãããŒãã£ç®¡çã¢ãã«ã®ããŒã¯ã³ã³ã¹ã â ãããã€ããŒã«äŸåããŸãã ã¯ãªãŒã³ã¢ãã ãã®äŸã§ããããžã§ãã³ã°ãããã€ã³ãã©ã¹ãã©ã¯ãã£ãåé€ããã«ã¯ã GitHub ãªããžããª ã®æé ã«åŸã£ãŠãã ããã çµè« ApplyGuardrail API ã䜿çšããŠãçæ AI ã¢ããªã±ãŒã·ã§ã³ã®ã»ãŒãã¬ãŒãã FM ããåãé¢ãããšãã§ããŸããããã§ãFM ãåŒã³åºããã«ã¬ãŒãã¬ãŒã«ã䜿çšã§ããããã«ãªãã䜿çšãããã¢ãã«ã«é¢ä¿ãªããæšæºåãã培åºçã«ãã¹ãããããšã³ã¿ãŒãã©ã€ãºã¬ãã«ã®ã»ãŒãã¬ãŒããã¢ããªã±ãŒã·ã§ã³ãããŒã«ããã«çµ±åã§ããããã«ãªããŸããã GitHubãªããžã㪠ã®ãµã³ãã«ã³ãŒãã詊ããŠããã£ãŒãããã¯ãããã°æäŸããŠãã ãããAmazon Bedrock Guardrails ãš ApplyGuardrail API ã®è©³çްã«ã€ããŠã¯ã Amazon Bedrock Guardrails ãåç
§ããŠãã ããã 翻蚳ã¯ãœãªã¥ãŒã·ã§ã³ã¢ãŒããã¯ãèå°ãæ
åœããŸããã èè
ã«ã€ã㊠Michael Cho ã¯ãAWS ã®ãœãªã¥ãŒã·ã§ã³ã¢ãŒããã¯ãã§ã顧客ãã¯ã©ãŠãã§ã®ããã·ã§ã³ãå éããããã®æ¯æŽããŠããŸãã圌ã¯é¡§å®¢ã«åãäžãã驿°çãªãœãªã¥ãŒã·ã§ã³ã®èšèšããæ§ç¯ããããšã«æ
ç±ã泚ãã§ããŸããæè¿ã§ã¯ãè€éãªããžãã¹ã®åé¡ã解決ããããã«çæ AI ã䜿ã£ãŠå®éšããããšã«æéãè²»ãããŠããŸãã Aarushi Karandikar ã¯ãAWS ã®ãœãªã¥ãŒã·ã§ã³ã¢ãŒããã¯ãã§ããšã³ã¿ãŒãã©ã€ãº ISV ã®é¡§å®¢ã«ã¯ã©ãŠããžã£ãŒããŒã«é¢ããæè¡çã¬ã€ãã³ã¹ãæäŸããŠããŸãã圌女㯠UC Berkeley ã§ããŒã¿ãµã€ãšã³ã¹ãåŠã³ãçæ AI ã®æè¡ãå°éãšããŠããŸãã Riya Dani ã¯ãAWS ã®ãœãªã¥ãŒã·ã§ã³ã¢ãŒããã¯ãã§ããšã³ã¿ãŒãã©ã€ãºã®é¡§å®¢ã®ã¯ã©ãŠããžã£ãŒããŒãæ¯æŽããŠããŸãã圌女ã¯åŠã¶ããšã«æ
ç±ãæã¡ãVirginia Tech ã§ã³ã³ãã¥ãŒã¿ãŒãµã€ãšã³ã¹ã®åŠå£«å·ãšä¿®å£«å·ãååŸããŠããŸãã空ãæéã«ã¯ãã¢ã¯ãã£ãã«éããããšãšèªæžã楜ããã§ããŸãã Raj Pathak ã¯ãããªã³ã·ãã«ãœãªã¥ãŒã·ã§ã³ã¢ãŒããã¯ãã§ãã«ãããšç±³åœã®ãã©ãŒãã¥ã³ 50 ããã³äžå
FSIïŒéè¡ãä¿éºãè³æ¬åžå ŽïŒã®é¡§å®¢ã®æè¡é¡§åã§ããRaj ã¯ãçæ AIãèªç¶èšèªåŠçãã€ã³ããªãžã§ã³ãããã¥ã¡ã³ãåŠçãMLOps ãžã®å¿çšãå«ãæ©æ¢°åŠç¿ãå°éãšããŠããŸãã