diff --git a/bedrock/README.md b/bedrock/README.md index 27e864ab..12e8b57f 100644 --- a/bedrock/README.md +++ b/bedrock/README.md @@ -12,4 +12,4 @@ This is to document the exploration of AWS bedrock and the resources created 1. Create an agent 1. create a service role for the agent 1. After creation, link it to the knowledge base -1. prepare the agent \ No newline at end of file +1. prepare the agent diff --git a/bedrock/main.tf b/bedrock/main.tf index ec80d32b..e41a7833 100644 --- a/bedrock/main.tf +++ b/bedrock/main.tf @@ -1,3 +1,11 @@ +terraform { + required_providers { + aws = { + source = "hashicorp/aws" + version = "~> 5.0" + } + } +} resource "aws_s3_bucket" "nftc_kb_bucket" { bucket = "nftc-kb-bucket" @@ -67,6 +75,7 @@ resource "aws_bedrock_knowledge_base" "nftc_kb" { resource "aws_bedrockagent_data_source" "example" { knowledge_base_id = aws_bedrock_knowledge_base.nftc_kb.id name = "nftc-kb-datasource" + data_deletion_policy = "DELETE" data_source_configuration { type = "S3" s3_configuration { @@ -155,19 +164,115 @@ resource "aws_bedrockagent_agent" "nftc_agent" { agent_name = "nftc-agent" agent_resource_role_arn = aws_iam_role.example.arn foundation_model = "anthropic.claude-v3-sonnet" - instruction = """ - Your task is to extract data about research tools, such as animal models and cell lines biobanks from scientific publications. When provided with a name or synonym for a research tool, you will generate a comprehensive list of temporal "observations" about the research tool that describe the natural history of the model as they relate to development or age. For example, an observation could be "The pigs developed tumor type X at Y months of age." Do not include observations about humans with NF1. Your response must be formatted to be compliant with the following JSON: - [ + instruction = < + $search_results$ + + If you reference information from a search result within your answer, you must include a citation to source where the information was found. Each result has a corresponding source ID that you should reference. + Note that may contain multiple if you include information from multiple results in your answer. + Do NOT directly quote the in your answer. Your job is to answer the user's question as concisely as possible. + You must output your answer in the following format. Pay attention and follow the formatting and spacing exactly: + + + + [ + { + "resourceName": "the resource name, likely the same as the input concept from the user", + "resourceType": ["Animal Model", "Cell Line"], + "observationText": "This is an example sentence.", + "observationType": [ + "Body Length", + "Body weight", + "Coat Color", + "Disease Susceptibility", + "Feed Intake", + "Feeding Behavior", + "Growth rate", + "Motor Activity", + "Organ Development", + "Reflex Development", + "Reproductive Behavior", + "Social Behavior", + "Swimming Behavior", + "Tumor Growth", + "Issue", + "Depositor Comment", + "Usage Instructions", + "General Comment or Review", + "Other" + ], + "observationPhase": ["prenatal", "postnatal", null], + "observationTime": "a double; the time during the development of the organism at which the observation occurred", + "observationTimeUnits": ["days", "weeks", "months", "years"], + "sourcePublication": "pubmed ID or DOI" + }, + ] + + + source ID + + + + + [ { - resourceType: [Animal Model, Cell Line], - observationText: This is an example sentence., - observationType: [Body Length, Body weight, Coat Color, Disease Susceptibility, Feed Intake, Feeding Behavior, Growth rate, Motor Activity, Organ Development, Reflex Development, Reproductive Behavior, Social Behavior, Swimming Behavior, Tumor Growth, Issue, Depositor Comment, Usage Instructions, General Comment or Review, Other], - observationPhase: [prenatal, postnatal, null], - observationTime: a double; the time during the development of the organism which the observation occurred, - observationTimeUnits: [days, weeks, months, years] + "resourceName": "the resource name, likely the same as the input concept from the user", + "resourceType": ["Animal Model", "Cell Line"], + "observationText": "This is an example sentence.", + "observationType": [ + "Body Length", + "Body weight", + "Coat Color", + "Disease Susceptibility", + "Feed Intake", + "Feeding Behavior", + "Growth rate", + "Motor Activity", + "Organ Development", + "Reflex Development", + "Reproductive Behavior", + "Social Behavior", + "Swimming Behavior", + "Tumor Growth", + "Issue", + "Depositor Comment", + "Usage Instructions", + "General Comment or Review", + "Other" + ], + "observationPhase": ["prenatal", "postnatal", null], + "observationTime": "a double; the time during the development of the organism at which the observation occurred", + "observationTimeUnits": ["days", "weeks", "months", "years"], + "sourcePublication": "pubmed ID or DOI" + }, + ] + + + source ID + + + + EOT + inference_configuration = { + max_length = 2048 + stop_sequences=["Human"] + temperature= 0 + top_k= 250 + top_p= 1 } + } ] - """ tags = { Name = "nftc-agent" }