domingo, 7 de abril de 2024

GENERATIVE API USING BEDROCK PART 2 (KNOWLEDGE BASE )

KNOWLEDGE BASE GENERATIVE MODEL

 

URL:

https://3glika507i.execute-api.us-east-1.amazonaws.com/default/Bedrock3

 

AUTHENTICATION:

Basic Authentication

Username: Administrator

Password: ********

 

BODY:

{

    "prompt": "CAM - Pin Pad Information",

    "knowledgeBaseId": "********"

}

 

Where:

Prompt It is the question that is asked to the generative model so that it responds according to the files that are saved in S3.

knowledgeBaseId = It is the ID of the knowledge base in the orchestration section of bedrock

 S3











Note:

 The score indicates the degree of coincidence in finding the information in the indexed documents. From experience above 0.49 it would indicate that he found some information in some document.




PRICING

Minimum Knowledge bases for Amazon Bedrock costs due to OpenSearch:

 ·         With Redundant Active Replicas enabled: $720 per month

·         Without Redundant Active Replicas enabled: $360 per month

https://faun.pub/aws-bedrock-knowledge-base-minimum-cost-beware-f2a2dac383d0

https://docs.aws.amazon.com/opensearch-service/latest/developerguide/serverless-overview.html


SYNC-UP KNOWLEDGE BASE

1.- Upload your files to the project's S3 bucket

MANUAL 


AUTOMATIC

URL:

https://3glika507i.execute-api.us-east-1.amazonaws.com/default/BedrockUploadFile

 

AUTHENTICATION:

Basic Authentication

Username: Administrator

Password: ********

 

BODY:

{

    "filename": "test.pdf"

}


Where:

filename = It is the file name to upload


You get the uploadUrl to upload the file


File in S3 bucket


2.- Sycn Files

 

URL:

https://3glika507i.execute-api.us-east-1.amazonaws.com/default/BedrockSync

 

AUTHENTICATION:

Basic Authentication

Username: Administrator

Password: ********

 

BODY:

{

    "knowledgeBaseId": "********",

    "dataSourceId": "********"

}

 

Where:

knowledgeBaseId = It is the ID of the knowledge base in the orchestration section of bedrock

dataSourceId = It is the identifier of the data source where bedrock pointed to the S3 bucket.




3.- Check if the synchronization is finished

 URL:

https://3glika507i.execute-api.us-east-1.amazonaws.com/default/BedrockSyncStatus

 

AUTHENTICATION:

Basic Authentication

Username: Administrator

Password: ********

 

BODY:

{

    "Job_Id": "S3HYNCEYS0",

    "knowledgeBaseId": "********",

    "dataSourceId": "********"

}

 

Where:

Job_Id = It is the identification of the job that bedrock is doing to synchronize the files.

knowledgeBaseId = It is the ID of the knowledge base in the orchestration section of bedrock

dataSourceId = It is the identifier of the data source where bedrock pointed to the S3 bucket.




4.- Gets the list of knowledge base files hosted on S3

 URL:

https://3glika507i.execute-api.us-east-1.amazonaws.com/default/BedrockFileList

 

AUTHENTICATION:

Basic Authentication

Username: Administrator

Password: ********

  

BODY:

{

    "Bucket": "beta-tcs-lucia-resources",

    "Prefix": "KBS_GENAI"

}

 

Where:

Bucket = Root storage name

Prefix = Subfolder inside the bucket




No hay comentarios:

Publicar un comentario