xebia.com
Amazon Bedrock in Action
Krzysztof Kąkol
Chief of Data Engineering @ Xebia Poland
xebia.com
Krzysztof Kąkol
Chief of Data Engineering and
Solutions Architect in Xebia Poland
AWS Community Builder & AWS Ambassador
https://www.linkedin.com/in/krzysztofkakol/
Other stuff:
Classical and jazz pianist
PhD in AI-driven sound processing
xebia.com
Access a range of leading FMs
through a single API
Extend the power of LLMs
with your data using retrieval
augmented generation (RAG)
Privately customize FMs with
your own data
Amazon Bedrock
Build agents that execute
complex business tasks by
dynamically invoking APIs
Get the best price
performance without
managing infrastructure
Enable data security and
compliance
xebia.com
Layer 1
Content generation
xebia.com
Content generation
xebia.com
Content generation
boto3_bedrock = boto3.client('bedrock-runtime')
response = boto3_bedrock.invoke_model(
body = '{"inputText": "Create short email from John Smith to SuperHotels requesting for special offers of hotels in San Francisco."}',
modelId = 'amazon.titan-tg1-large'
)
response_body = json.loads(response.get('body').read())
print(response_body.get('results')[0].get('outputText'))
Dear SuperHotels,
I hope this email finds you well. I am reaching out to inquire about any special offers or discounts available at your hotels in
San Francisco. As a frequent traveler, I value quality accommodations and great value. I would be delighted to learn about
any current promotions or packages that you have to offer.
Thank you for your attention to this matter.
I look forward to hearing back from you soon.
Best regards,
John Smith
xebia.com
Layer 2
Custom knowledge
xebia.com
Retrieval Augmented Generation
xebia.com
Retrieval Augmented Generation
CONTEXT
xebia.com
Retrieval Augmented Generation
xebia.com
Demo
Knowledge Base
(RAG) in Bedrock
xebia.com
Retrieval Augmented Generation
xebia.com
Retrieval Augmented Generation
client = boto3.client('bedrock-agent-runtime’)
response = client.retrieve_and_generate(
input={
'text’:”Who is Andy Dufresne?”,
},
retrieveAndGenerateConfiguration={
'type': 'KNOWLEDGE_BASE',
'knowledgeBaseConfiguration': {
'knowledgeBaseId': ’ABC12345',
'modelArn': 'arn:aws:bedrock:us-east-1::foundation-model/anthropic.claude-v2'
}
},
)
"output": { "text": ”...”},
"citations": [{
"generatedResponsePart": {
"textResponsePart": { "text": ”...", "span": { "start": 0, "end": 198 } }
},
"retrievedReferences": [ {
"content": { "text": ”..." },
"location": {
"type": "S3",
"s3Location": { "uri": "s3://test-bedrock-kb-texts/shawshank_redemption.pdf"
}
}
...
xebia.com
Layer 3
Automation (agents)
xebia.com
Agents
xebia.com
Demo
Agents in
Bedrock
xebia.com
Travel Agency agent
xebia.com
Agents
client = boto3.client('bedrock-agent-runtime’)
response = client.invoke_agent(
agentAliasId='AJJCWRSIB2',
agentId='3LZHTSX13Q',
inputText='Can you show the offers list?',
sessionId='abc123’
)
completion = ""
for event in response.get("completion"):
chunk = event["chunk"]
completion = completion + chunk["bytes"].decode()
Here are the available destinations/offers:
- Egypt, Hurghada
- Italy, Venice
- Mexico, Cancun
xebia.com
• Amazon Bedrock gives access to plenty of different foundation models
• You can easily orchestrate potentially difficult tasks (like RAGs or agents), all the heavy lifting is done
by Bedrock
• Bedrock enables high-level API which simplifies implementing even sophisticated LLM-related scenarios
Summary
xebia.com
Questions?
https://www.linkedin.com/in/krzysztofkakol/
Rate this session
xebia.com
Thank you!
kkakol@xebia.com

Amazon Bedrock in Action - presentation of the Bedrock's capabilities